Class: Broadside::Configuration
- Inherits:
-
Object
- Object
- Broadside::Configuration
- Includes:
- ActiveModel::Model, InvalidConfiguration
- Defined in:
- lib/broadside/configuration/configuration.rb
Instance Attribute Summary collapse
-
#application ⇒ Object
Returns the value of attribute application.
-
#aws ⇒ Object
readonly
Returns the value of attribute aws.
-
#config_file ⇒ Object
Returns the value of attribute config_file.
-
#default_docker_image ⇒ Object
Returns the value of attribute default_docker_image.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#posthook ⇒ Object
Returns the value of attribute posthook.
-
#prehook ⇒ Object
Returns the value of attribute prehook.
-
#ssh ⇒ Object
Returns the value of attribute ssh.
-
#targets ⇒ Object
Returns the value of attribute targets.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
- #get_target_by_name!(name) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #ssh_cmd(ip, options = {}) ⇒ Object
Methods included from InvalidConfiguration
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
34 35 36 37 38 39 40 41 |
# File 'lib/broadside/configuration/configuration.rb', line 34 def initialize @aws = AwsConfiguration.new @logger = ::Logger.new(STDOUT) @logger.level = ::Logger::INFO @logger.datetime_format = '%Y-%m-%d_%H:%M:%S' @ssh = {} @timeout = 600 end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Broadside::InvalidConfiguration
Instance Attribute Details
#application ⇒ Object
Returns the value of attribute application.
12 13 14 |
# File 'lib/broadside/configuration/configuration.rb', line 12 def application @application end |
#aws ⇒ Object (readonly)
Returns the value of attribute aws.
8 9 10 |
# File 'lib/broadside/configuration/configuration.rb', line 8 def aws @aws end |
#config_file ⇒ Object
Returns the value of attribute config_file.
12 13 14 |
# File 'lib/broadside/configuration/configuration.rb', line 12 def config_file @config_file end |
#default_docker_image ⇒ Object
Returns the value of attribute default_docker_image.
12 13 14 |
# File 'lib/broadside/configuration/configuration.rb', line 12 def default_docker_image @default_docker_image end |
#logger ⇒ Object
Returns the value of attribute logger.
12 13 14 |
# File 'lib/broadside/configuration/configuration.rb', line 12 def logger @logger end |
#posthook ⇒ Object
Returns the value of attribute posthook.
12 13 14 |
# File 'lib/broadside/configuration/configuration.rb', line 12 def posthook @posthook end |
#prehook ⇒ Object
Returns the value of attribute prehook.
12 13 14 |
# File 'lib/broadside/configuration/configuration.rb', line 12 def prehook @prehook end |
#ssh ⇒ Object
Returns the value of attribute ssh.
12 13 14 |
# File 'lib/broadside/configuration/configuration.rb', line 12 def ssh @ssh end |
#targets ⇒ Object
Returns the value of attribute targets.
8 9 10 |
# File 'lib/broadside/configuration/configuration.rb', line 8 def targets @targets end |
#timeout ⇒ Object
Returns the value of attribute timeout.
12 13 14 |
# File 'lib/broadside/configuration/configuration.rb', line 12 def timeout @timeout end |
Instance Method Details
#get_target_by_name!(name) ⇒ Object
52 53 54 |
# File 'lib/broadside/configuration/configuration.rb', line 52 def get_target_by_name!(name) @targets.fetch(name) { raise ArgumentError, "Deploy target '#{name}' does not exist!" } end |
#ssh_cmd(ip, options = {}) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/broadside/configuration/configuration.rb', line 56 def ssh_cmd(ip, = {}) cmd = 'ssh -o StrictHostKeyChecking=no' cmd << ' -t -t' if [:tty] cmd << " -i #{@ssh[:keyfile]}" if @ssh[:keyfile] if (proxy = @ssh[:proxy]) cmd << ' -o ProxyCommand="ssh -q' cmd << " -i #{proxy[:keyfile]}" if proxy[:keyfile] cmd << ' ' cmd << "#{proxy[:user]}@" if proxy[:user] cmd << "#{proxy[:host]} nc #{ip} #{proxy[:port]}\"" end cmd << ' ' cmd << "#{@ssh[:user]}@" if @ssh[:user] cmd << ip.to_s cmd end |