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')
execute :mkdir, '-p', File.dirname(output_file)
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