# Recipes for installing RefineryCMS using Capistrano 3.x # Copyright (C) 2015 Harald Eilertsen # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . 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