Sha256: 29201033c33da43c4fd8b22030c945eba228de68f13ebe09c0a97d91c220d8d8

Contents?: true

Size: 1.33 KB

Versions: 34

Compression:

Stored size: 1.33 KB

Contents

require 'fileutils'
module CapistranoMulticonfigParallel
  # class used to find application dependencies
  class StandardDeploy
    extend FileUtils

    def self.setup_command_line_standard(options)
      opts = ''
      options.each do |key, value|
        opts << "#{key}=#{value}" if value.present?
      end
      opts
    end

    def self.execute_standard_deploy(options)
      app = options.fetch(:app, '')
      stage = options.fetch(:env, 'development')
      action_name = options.fetch(:action, 'deploy')
      action = "#{action_name}[#{options.fetch(:task_arguments, []).join(',')}]"
      arguments = setup_command_line_standard(options.fetch(:env_options, {}))

      command = "bundle exec cap #{app}:#{stage} #{action}  #{arguments}"
      puts("\n\n\n Executing '#{command}' \n\n\n .")
      sh("#{command}")
    rescue => ex
      CapistranoMulticonfigParallel.log_message(ex)
      if @name == 'deploy'
        begin
          action = "deploy:rollback[#{options.fetch(:task_arguments, []).join(',')}]"
          command = "bundle exec cap #{app}:#{stage} #{action} #{arguments}"
          puts("\n\n\n Executing #{command} \n\n\n .")
          sh("#{command}")
        rescue => exception
          CapistranoMulticonfigParallel.log_message(exception)
          # nothing to do if rollback fails
        end
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
capistrano_multiconfig_parallel-0.6.2 lib/capistrano_multiconfig_parallel/helpers/standard_deploy.rb
capistrano_multiconfig_parallel-0.6.1 lib/capistrano_multiconfig_parallel/helpers/standard_deploy.rb
capistrano_multiconfig_parallel-0.5.0 lib/capistrano_multiconfig_parallel/helpers/standard_deploy.rb
capistrano_multiconfig_parallel-0.4.0 lib/capistrano_multiconfig_parallel/helpers/standard_deploy.rb
capistrano_multiconfig_parallel-0.2.1 lib/capistrano_multiconfig_parallel/helpers/standard_deploy.rb
capistrano_multiconfig_parallel-0.2.0 lib/capistrano_multiconfig_parallel/helpers/standard_deploy.rb
capistrano_multiconfig_parallel-0.1.4 lib/capistrano_multiconfig_parallel/helpers/standard_deploy.rb
capistrano_multiconfig_parallel-0.1.3 lib/capistrano_multiconfig_parallel/helpers/standard_deploy.rb
capistrano_multiconfig_parallel-0.1.2 lib/capistrano_multiconfig_parallel/helpers/standard_deploy.rb
capistrano_multiconfig_parallel-0.1.1 lib/capistrano_multiconfig_parallel/helpers/standard_deploy.rb
capistrano_multiconfig_parallel-0.1.0 lib/capistrano_multiconfig_parallel/helpers/standard_deploy.rb
capistrano_multiconfig_parallel-0.0.3 lib/capistrano_multiconfig_parallel/helpers/standard_deploy.rb
capistrano_multiconfig_parallel-0.0.2 lib/capistrano_multiconfig_parallel/helpers/standard_deploy.rb
capistrano_multiconfig_parallel-0.0.1 lib/capistrano_multiconfig_parallel/helpers/standard_deploy.rb