Module: RailsDeployer::Bring::Rake

Extended by:
RailsDeployer::Bring, Rake::DSL
Defined in:
lib/rails_deployer/bring/rake.rb

Constant Summary

Constants included from Common

Common::BUNDLE, Common::RAKE, Common::RBENV

Class Method Summary collapse

Methods included from RailsDeployer::Bring

change_branch, deploy, make_env

Methods included from Common

#cd_to_local, #checkout, #get_name, #install_bundle, #migrate, #precompile_assets, #restart, #restart_queue, #restart_websocket, #say, #seed, #set_env, #set_precompile_relative_url, #set_proxy, #update_crontab, #upload

Class Method Details

.define_tasks(app_name) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rails_deployer/bring/rake.rb', line 5

def self.define_tasks(app_name)
  namespace :deploy do
    [:qa, :production].each do |app_env|

      desc "deploy to #{app_env} with optional arguments [branch=branchname] and [seed=true] to load data from seeds.rb"
      task(app_env) { deploy(app_name, app_env.to_s) }

      namespace app_env do
        desc 'Initialize the server environment'
        task :initialize do
          env = make_env(app_name, app_env.to_s)
          Net::SSH.start(env[:host], env[:user]) do |ssh|
            puts 'Create app directory'
            ssh.exec("mkdir -p #{env[:remote_path]}")
            puts 'Initialize the GIT repo'
            ssh.exec("cd #{env[:remote_path]} && git init && git config receive.denyCurrentBranch=ignore")
          end
        end
      end
    end
  end
end