Module: Capistrano::Env::Plugin

Defined in:
lib/capistrano/env/v2/plugin.rb

Instance Method Summary collapse

Instance Method Details

#add(config) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/capistrano/env/v2/plugin.rb', line 14

def add(config)
  namespace :deploy do
    namespace :capenv do
      namespace :copy do
        [:release, :current].each do |type|
          task type do
            path = fetch "#{type}_path".to_sym
            parent.parent.parent.upload StringIO.new(config.capenv_content), "#{path}/#{config.capenv_file}"
          end
        end
      end
    end
  end
  before 'deploy:finalize_update', 'deploy:capenv:copy:release'
  before 'deploy:restart', 'deploy:capenv:copy:current'
end

#use {|config| ... } ⇒ Object

Yields:

  • (config)


6
7
8
9
10
11
12
# File 'lib/capistrano/env/v2/plugin.rb', line 6

def use
  config = Capistrano::Env::Config.new
  yield(config)
  add config
  set :default_environment, config.envs
  config
end