Class: Drunker::Config
- Inherits:
-
Object
- Object
- Drunker::Config
- Defined in:
- lib/drunker/config.rb
Defined Under Namespace
Classes: InvalidConfigException
Instance Attribute Summary collapse
-
#aggregator ⇒ Object
readonly
Returns the value of attribute aggregator.
-
#buildspec ⇒ Object
readonly
Returns the value of attribute buildspec.
-
#commands ⇒ Object
readonly
Returns the value of attribute commands.
-
#compute_type ⇒ Object
readonly
Returns the value of attribute compute_type.
-
#concurrency ⇒ Object
readonly
Returns the value of attribute concurrency.
-
#environment_variables ⇒ Object
readonly
Returns the value of attribute environment_variables.
-
#file_pattern ⇒ Object
readonly
Returns the value of attribute file_pattern.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
Instance Method Summary collapse
- #aws_client_options ⇒ Object
- #debug? ⇒ Boolean
-
#initialize(image:, commands:, config:, concurrency:, compute_type:, timeout:, env:, buildspec:, file_pattern:, aggregator:, access_key:, secret_key:, region:, profile_name:, debug:, logger:) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(image:, commands:, config:, concurrency:, compute_type:, timeout:, env:, buildspec:, file_pattern:, aggregator:, access_key:, secret_key:, region:, profile_name:, debug:, logger:) ⇒ Config
Returns a new instance of Config.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/drunker/config.rb', line 15 def initialize(image:, commands:, config:, concurrency:, compute_type:, timeout:, env:, buildspec:, file_pattern:, aggregator:, access_key:, secret_key:, region:, profile_name:, debug:, logger:) @logger = logger yaml = load!(config) @image = image @commands = commands @concurrency = yaml["concurrency"] || concurrency @compute_type = compute_name[ yaml["compute_type"] || compute_type ] @timeout = yaml["timeout"] || timeout @environment_variables = codebuild_environments_format(yaml["environment_variables"] || env) @buildspec = buildspec_body!(yaml["buildspec"] || buildspec) @file_pattern = yaml["file_pattern"] || file_pattern @aggregator = aggregator_gem!(yaml["aggregator"] || aggregator) @credentials = aws_credentials(profile_name: yaml.dig("aws_credentials", "profile_name") || profile_name, access_key: yaml.dig("aws_credentials", "access_key") || access_key, secret_key: yaml.dig("aws_credentials", "secret_key") || secret_key) @region = yaml.dig("aws_credentials", "region") || region @debug = debug validate! end |
Instance Attribute Details
#aggregator ⇒ Object (readonly)
Returns the value of attribute aggregator.
11 12 13 |
# File 'lib/drunker/config.rb', line 11 def aggregator @aggregator end |
#buildspec ⇒ Object (readonly)
Returns the value of attribute buildspec.
9 10 11 |
# File 'lib/drunker/config.rb', line 9 def buildspec @buildspec end |
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
4 5 6 |
# File 'lib/drunker/config.rb', line 4 def commands @commands end |
#compute_type ⇒ Object (readonly)
Returns the value of attribute compute_type.
6 7 8 |
# File 'lib/drunker/config.rb', line 6 def compute_type @compute_type end |
#concurrency ⇒ Object (readonly)
Returns the value of attribute concurrency.
5 6 7 |
# File 'lib/drunker/config.rb', line 5 def concurrency @concurrency end |
#environment_variables ⇒ Object (readonly)
Returns the value of attribute environment_variables.
8 9 10 |
# File 'lib/drunker/config.rb', line 8 def environment_variables @environment_variables end |
#file_pattern ⇒ Object (readonly)
Returns the value of attribute file_pattern.
10 11 12 |
# File 'lib/drunker/config.rb', line 10 def file_pattern @file_pattern end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
3 4 5 |
# File 'lib/drunker/config.rb', line 3 def image @image end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
7 8 9 |
# File 'lib/drunker/config.rb', line 7 def timeout @timeout end |
Instance Method Details
#aws_client_options ⇒ Object
56 57 58 |
# File 'lib/drunker/config.rb', line 56 def { credentials: credentials, region: region }.delete_if { |_k, v| v.nil? } end |
#debug? ⇒ Boolean
52 53 54 |
# File 'lib/drunker/config.rb', line 52 def debug? debug end |