aboutsummaryrefslogblamecommitdiffstats
path: root/lib/capistrano/tasks/refinery_setup.rake
blob: 81921303ea92b2ba6ba5b95e5648d6502106ef70 (plain) (tree)



















                                                                                            
                                                             
   
# :mode=ruby:
require 'securerandom'
require 'active_support/inflector'

namespace :deploy do
  namespace :refinery do
    desc 'Initialize refinery config for new deployments.'
    task :setup do
      output_file = File.join(shared_path, "config", "initializers", "refinery", "core.rb")
      on roles(:app) do
        unless test "[ -f #{output_file} ]"
          template = IO.read(File.join("config", "initializers", "refinery", "core.rb.erb"))
          core = ERB.new(template)
          site_name = fetch(:site_name, "Beta")
          upload!(StringIO.new(core.result(binding)), output_file)
        end
      end
    end
  end

  before 'deploy:check:linked_files', 'deploy:refinery:setup'
end