Sha256: b84b6a518d79b1d8dde641e0fde76d621a9b6ecf8183bc6ca073d0311248b8a4

Contents?: true

Size: 929 Bytes

Versions: 2

Compression:

Stored size: 929 Bytes

Contents

require 'capistrano'

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

      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
        after 'deploy:finalize_update', 'deploy:capenv:copy:release'
        before 'deploy:restart', 'deploy:capenv:copy:current'
      end
    end
  end
end

Capistrano.plugin :capenv, Capistrano::Env::Plugin if Capistrano.respond_to?(:plugin)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capistrano-env-0.3.1 lib/capistrano/env/v2/plugin.rb
capistrano-env-0.3.0 lib/capistrano/env/v2/plugin.rb