class EY::Serverside::Callbacks::Distributor::Remote

Attributes

hook[R]
runner[R]

Public Class Methods

distribute(runner, hook) click to toggle source
# File lib/engineyard-serverside/callbacks/distributor/remote.rb, line 9
def self.distribute(runner, hook)
  new(runner, hook).distribute
end
new(runner, hook) click to toggle source
# File lib/engineyard-serverside/callbacks/distributor/remote.rb, line 13
def initialize(runner, hook)
  @runner = runner
  @hook = hook
end

Public Instance Methods

distribute() click to toggle source
# File lib/engineyard-serverside/callbacks/distributor/remote.rb, line 18
def distribute
  shell.status "Running deploy hook: #{hook}"

  runner.run escaped_command(hook) do |server, cmd|
    instance_args = [
      '--current-roles', server.roles.to_a.join(' ')
    ]

    if server.name
      instance_args.push('--current-name')
      instance_args.push(server.name.to_s)
    end

    instance_args.push('--config')
    instance_args.push(config.to_json)

    cmd << " " << Escape.shell_command(instance_args)
  end
end

Private Instance Methods

command_for(hook_name) click to toggle source
# File lib/engineyard-serverside/callbacks/distributor/remote.rb, line 55
def command_for(hook_name)
  cmd = [
    About.binary,
    'hook', hook_name.to_s,
    '--app', config.app,
    '--environment-name', config.environment_name,
    '--account-name', config.account_name,
    '--release-path', paths.active_release.to_s,
    '--framework-env', config.framework_env.to_s
  ]

  cmd.push('--verbose') if config.verbose

  cmd
end
config() click to toggle source
# File lib/engineyard-serverside/callbacks/distributor/remote.rb, line 39
def config
  runner.config
end
escaped_command(hook) click to toggle source
# File lib/engineyard-serverside/callbacks/distributor/remote.rb, line 51
def escaped_command(hook)
  Escape.shell_command(command_for(hook))
end
paths() click to toggle source
# File lib/engineyard-serverside/callbacks/distributor/remote.rb, line 47
def paths
  runner.paths
end
shell() click to toggle source
# File lib/engineyard-serverside/callbacks/distributor/remote.rb, line 43
def shell
  runner.shell
end