aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2013-01-25 23:29:31 +0100
committerHarald Eilertsen <haraldei@anduin.net>2013-01-25 23:29:31 +0100
commit49ec7b8074d7fafda3c94c89d61d6ffd65c9ccbc (patch)
tree128624a415f24f026a4d10d2ad334412cf66abb2 /config
parent429fd2cc1332ce3406eda363998eef6883465be7 (diff)
downloadhmnoweb-49ec7b8074d7fafda3c94c89d61d6ffd65c9ccbc.tar.gz
hmnoweb-49ec7b8074d7fafda3c94c89d61d6ffd65c9ccbc.tar.bz2
hmnoweb-49ec7b8074d7fafda3c94c89d61d6ffd65c9ccbc.zip
Add deploy script for refinery config.
Diffstat (limited to 'config')
-rw-r--r--config/deploy/refinery_setup.rb46
1 files changed, 46 insertions, 0 deletions
diff --git a/config/deploy/refinery_setup.rb b/config/deploy/refinery_setup.rb
new file mode 100644
index 0000000..2ada124
--- /dev/null
+++ b/config/deploy/refinery_setup.rb
@@ -0,0 +1,46 @@
+unless Capistrano::Configuration.respond_to?(:instance)
+ abort "This extension requires Capistrano 2"
+end
+
+Capistrano::Configuration.instance.load do
+
+ namespace :deploy do
+ namespace :refinery do
+
+ desc <<-DESC
+ Creates the refinery core config for the application.
+ DESC
+ task :setup, :except => { :no_release => true } do
+
+ default_template = <<-EOF
+ # encoding: utf-8
+ Refinery::Core.configure do |config|
+ config.rescue_not_found = Rails.env.production?
+ config.s3_backend = !(ENV['S3_KEY'].nil? || ENV['S3_SECRET'].nil?)
+ config.base_cache_key = :rip
+ config.site_name = "Religionsfrihet i Praksis"
+ config.authenticity_token_on_frontend = true
+ config.dragonfly_secret = "#{SecureRandom.hex(24)}"
+ config.ie6_upgrade_message_enabled = true
+ config.show_internet_explorer_upgrade_message = false
+ end
+ EOF
+
+ run "mkdir -p #{shared_path}/config/refinery"
+ IO.write("#{shared_path}/config/refinery/core.rb", default_template);
+ end
+
+ desc <<-DESC
+ [internal] Updates the symlink for secret_token.rb file to the just deployed release.
+ DESC
+ task :symlink, :except => { :no_release => true } do
+ run "ln -nfs #{shared_path}/config/refinery/core.rb #{release_path}/config/refinery/core.rb"
+ end
+
+ end
+
+ after "deploy:setup", "deploy:refinery:setup" unless fetch(:skip_refinery_setup, false)
+ after "deploy:finalize_update", "deploy:refinery:symlink"
+ end
+
+end