Class: Shipper::Run

Inherits:
Object
  • Object
show all
Defined in:
lib/shipper/run.rb

Constant Summary collapse

COMMANDS =
%w[restart].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Run

Returns a new instance of Run.



9
10
11
12
13
# File 'lib/shipper/run.rb', line 9

def initialize(options)
  pop_env!(options)
  @config = ::Shipper::Config.new(env: env)
  @options = options.empty? ? nil : options
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



5
6
7
# File 'lib/shipper/run.rb', line 5

def config
  @config
end

#envObject (readonly)

Returns the value of attribute env.



5
6
7
# File 'lib/shipper/run.rb', line 5

def env
  @env
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/shipper/run.rb', line 5

def options
  @options
end

Instance Method Details

#performObject



15
16
17
18
19
20
21
# File 'lib/shipper/run.rb', line 15

def perform
  if restart?
    ::Shipper::Host.new(config.host).restart!
  else
    ::Shipper::Deploy.new(config, options).perform
  end
end