Skip to content

Instantly share code, notes, and snippets.

@zackbraksa
Forked from lenart/deploy.rb
Last active August 29, 2015 14:06

Revisions

  1. @lenart lenart created this gist Sep 25, 2013.
    25 changes: 25 additions & 0 deletions deploy.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    namespace :figaro do
    desc "SCP transfer figaro configuration to the shared folder"
    task :setup do
    transfer :up, "config/application.yml", "#{shared_path}/application.yml", via: :scp
    end

    desc "Symlink application.yml to the release path"
    task :symlink do
    run "ln -sf #{shared_path}/application.yml #{latest_release}/config/application.yml"
    end

    desc "Check if figaro configuration file exists on the server"
    task :check do
    begin
    run "test -f #{shared_path}/application.yml"
    rescue Capistrano::CommandError
    unless fetch(:force, false)
    logger.important 'application.yml file does not exist on the server "shared/application.yml"'
    exit
    end
    end
    end
    end
    after "deploy:setup", "figaro:setup"
    after "deploy:create_symlink", "figaro:symlink"