Sha256: fec4c105881416642afc0b36d572ebafffedb674d042ceb7a89cf012de23b648

Contents?: true

Size: 921 Bytes

Versions: 4

Compression:

Stored size: 921 Bytes

Contents

require 'pry'
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

4 entries across 4 versions & 1 rubygems

Version Path
capistrano-env-0.1.1 lib/capistrano/env/plugin.rb
capistrano-env-0.1.0 lib/capistrano/env/plugin.rb
capistrano-env-0.0.7 lib/capistrano/env/plugin.rb
capistrano-env-0.0.6 lib/capistrano/env/plugin.rb