Class: OpsPreflight::Server

Inherits:
Thor
  • Object
show all
Includes:
ExitCode
Defined in:
lib/ops_preflight/server.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

Fixes thor’s banners when used with :default namespace



41
42
43
# File 'lib/ops_preflight/server.rb', line 41

def self.banner(command, namespace = nil, subcommand = false)
  "#{basename} #{command.formatted_usage(self, false, subcommand)}"
end

Instance Method Details

#deploy(stack_name, app_name) ⇒ Object



27
28
29
30
31
# File 'lib/ops_preflight/server.rb', line 27

def deploy(stack_name, app_name)
  require 'ops_preflight/ops_works/deploy.rb'

  OpsWorks::Deploy.new('us-east-1', stack_name, app_name).call(options[:release])
end

#downloadObject



20
21
22
23
# File 'lib/ops_preflight/server.rb', line 20

def download
  require 'ops_preflight/s3_transfer.rb'
  S3Transfer.new(options[:bucket], options[:file]).download
end

#fetch_environment(environment, stack_name, app_name) ⇒ Object



34
35
36
37
38
# File 'lib/ops_preflight/server.rb', line 34

def fetch_environment(environment, stack_name, app_name)
  require 'ops_preflight/ops_works/fetch_environment.rb'

  OpsWorks::FetchEnvironment.new(environment, 'us-east-1', stack_name, app_name).call
end

#uploadObject

Raises:

  • (Thor::Error)


10
11
12
13
14
15
# File 'lib/ops_preflight/server.rb', line 10

def upload
  raise Thor::Error, "Specified file not found: #{options[:file]}" unless File.exists?(options[:file])

  require 'ops_preflight/s3_transfer.rb'
  S3Transfer.new(options[:bucket], options[:file]).upload
end