Sha256: 6cadb4da25ec9fd373527c368558b2ad999c1895e16dba9b7c04d2fb77ce841b

Contents?: true

Size: 875 Bytes

Versions: 1

Compression:

Stored size: 875 Bytes

Contents

require 'pry'
module Capistrano
  module Env
    module Plugin
      def use
        config = Capistrano::Env::Config.new
        yield(config)
        add config
        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

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-env-0.0.5 lib/capistrano/env/plugin.rb