Class: Shippy::Commander

Inherits:
Object
  • Object
show all
Defined in:
lib/shippy/commander.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_file: nil, verbosity: :info) ⇒ Commander

Returns a new instance of Commander.



6
7
8
# File 'lib/shippy/commander.rb', line 6

def initialize(config_file: nil, verbosity: :info)
  @config_file, @verbosity = config_file, verbosity
end

Instance Attribute Details

#appObject

Returns the value of attribute app.



3
4
5
# File 'lib/shippy/commander.rb', line 3

def app
  @app
end

#config_fileObject

Returns the value of attribute config_file.



3
4
5
# File 'lib/shippy/commander.rb', line 3

def config_file
  @config_file
end

#repoObject

Returns the value of attribute repo.



3
4
5
# File 'lib/shippy/commander.rb', line 3

def repo
  @repo
end

#verbosityObject

Returns the value of attribute verbosity.



3
4
5
# File 'lib/shippy/commander.rb', line 3

def verbosity
  @verbosity
end

Instance Method Details

#compileObject



28
29
30
# File 'lib/shippy/commander.rb', line 28

def compile
  Shippy::Compiler.new(app, config: config).compile
end

#configObject



10
11
12
13
14
# File 'lib/shippy/commander.rb', line 10

def config
  @config ||= Shippy::Config
    .new(config_file)
    .tap { |config| configure_sshkit_with(config) }
end

#current_app_pathObject



32
33
34
# File 'lib/shippy/commander.rb', line 32

def current_app_path
  deploy_path.join("apps", app.name)
end

#with_verbosity(level) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/shippy/commander.rb', line 16

def with_verbosity(level)
  old_level = verbosity

  self.verbosity = level
  SSHKit.config.output_verbosity = level

  yield
ensure
  self.verbosity = old_level
  SSHKit.config.output_verbosity = old_level
end