class Shipper::Run

Constants

COMMANDS

Attributes

config[R]
env[R]
options[R]

Public Class Methods

new(options) click to toggle source
# 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

Public Instance Methods

perform() click to toggle source
# 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

Private Instance Methods

pop_env!(options) click to toggle source
# File lib/shipper/run.rb, line 29
def pop_env!(options)
  if options.empty? || COMMANDS.include?(options[0])
    @env = 'production'
  else
    @env = options.delete_at(0)
  end
end
restart?() click to toggle source
# File lib/shipper/run.rb, line 25
def restart?
  options&.size == 1 && options[0] == 'restart'
end