diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/capistrano/tasks/refinerycms.rake | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/lib/capistrano/tasks/refinerycms.rake b/lib/capistrano/tasks/refinerycms.rake new file mode 100644 index 0000000..29f4bd4 --- /dev/null +++ b/lib/capistrano/tasks/refinerycms.rake @@ -0,0 +1,60 @@ +require 'capistrano/refinerycms/helpers' +require 'securerandom' +require 'active_support/inflector' + +include Capistrano::RefineryCMS::Helpers + +namespace :load do + + task :defaults do + + # Settings for config/initializers/refinery/core.rb + set :refinerycms_site_name, 'RefineryCMS' + set :refinerycms_force_ssl, false + set :refinerycms_dragonfly_custom_backend_class, '' + set :refinerycms_dragonfly_custom_backend_opts, [] + set :refinerycms_base_cache_key, -> { ActiveSupport::Inflector::parameterize(fetch(:refinerycms_site_name), '_') } + set :refinerycms_google_analytics_page_code, 'UA-xxxxxx-x' + set :refinerycms_authenticity_token_on_frontend, true + set :refinerycms_dragonfly_secret, -> { SecureRandom.hex(24) } + set :refinerycms_wymeditor_whitelist_tags, [] + set :refinerycms_extra_javascript, '' + set :refinerycms_extra_stylesheet, '' + set :refinerycms_backend_route, '/refinery' + + # Settings affecting the gem operation + set :refinerycms_template_path, -> { File.join('config', 'deploy', 'templates') } + + end + +end + + +namespace :deploy do + namespace :refinerycms do + + desc 'Initialize refinery config for new deployments.' + task :configure do + output_file = File.join(shared_path, "config", "initializers", "refinery", "core.rb") + on roles(:app) do + unless test "[ -f #{output_file} ]" + core = refinerycms_template('config_initializers_refinery_core.rb.erb') + upload!(core, output_file) + end + end + end + + desc 'Seed the database' + task :seed do + on roles(:db) do + within release_path do + execute :rake, 'db:seed', "RAILS_ENV=#{fetch(:rails_env)}" + end + end + end + + end + + before 'deploy:check:linked_files', 'deploy:refinerycms:configure' + after 'deploy:migrate', 'deploy:refinerycms:seed' +end |