Class: Config
- Inherits:
-
Object
- Object
- Config
- Defined in:
- lib/arkana/models/config.rb
Overview
Model used to hold all the configuration set up by the user (both from CLI arguments and from the config file).
Instance Attribute Summary collapse
-
#current_flavor ⇒ Object
Returns the value of attribute current_flavor.
-
#dotenv_filepath ⇒ Object
Returns the value of attribute dotenv_filepath.
-
#environment_secrets ⇒ Object
readonly
Returns the value of attribute environment_secrets.
-
#environments ⇒ Object
readonly
Returns the value of attribute environments.
-
#flavors ⇒ Object
readonly
Returns the value of attribute flavors.
-
#global_secrets ⇒ Object
readonly
Returns the value of attribute global_secrets.
-
#import_name ⇒ Object
readonly
Returns the value of attribute import_name.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#package_manager ⇒ Object
readonly
Returns the value of attribute package_manager.
-
#pod_name ⇒ Object
readonly
Returns the value of attribute pod_name.
-
#result_path ⇒ Object
readonly
Returns the value of attribute result_path.
-
#should_generate_unit_tests ⇒ Object
readonly
Returns the value of attribute should_generate_unit_tests.
-
#swift_declaration_strategy ⇒ Object
readonly
Returns the value of attribute swift_declaration_strategy.
Instance Method Summary collapse
- #all_keys ⇒ Object
-
#environment_keys ⇒ Object
TODO: Consider renaming this and environment_secrets, cuz they’re confusing.
-
#initialize(yaml) ⇒ Config
constructor
rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity.
Constructor Details
#initialize(yaml) ⇒ Config
rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/arkana/models/config.rb', line 34 def initialize(yaml) @environments = (yaml["environments"] || []).map(&:capitalize) @environment_secrets = yaml["environment_secrets"] || [] @global_secrets = yaml["global_secrets"] || [] default_name = "ArkanaKeys" @namespace = yaml["namespace"] || default_name @import_name = yaml["import_name"] || default_name @pod_name = yaml["pod_name"] || default_name @result_path = yaml["result_path"] || default_name @flavors = yaml["flavors"] || [] @swift_declaration_strategy = yaml["swift_declaration_strategy"] || "let" @should_generate_unit_tests = yaml["should_generate_unit_tests"] @should_generate_unit_tests = true if @should_generate_unit_tests.nil? @package_manager = yaml["package_manager"] || "spm" end |
Instance Attribute Details
#current_flavor ⇒ Object
Returns the value of attribute current_flavor.
29 30 31 |
# File 'lib/arkana/models/config.rb', line 29 def current_flavor @current_flavor end |
#dotenv_filepath ⇒ Object
Returns the value of attribute dotenv_filepath.
31 32 33 |
# File 'lib/arkana/models/config.rb', line 31 def dotenv_filepath @dotenv_filepath end |
#environment_secrets ⇒ Object (readonly)
Returns the value of attribute environment_secrets.
10 11 12 |
# File 'lib/arkana/models/config.rb', line 10 def environment_secrets @environment_secrets end |
#environments ⇒ Object (readonly)
Returns the value of attribute environments.
6 7 8 |
# File 'lib/arkana/models/config.rb', line 6 def environments @environments end |
#flavors ⇒ Object (readonly)
Returns the value of attribute flavors.
20 21 22 |
# File 'lib/arkana/models/config.rb', line 20 def flavors @flavors end |
#global_secrets ⇒ Object (readonly)
Returns the value of attribute global_secrets.
8 9 10 |
# File 'lib/arkana/models/config.rb', line 8 def global_secrets @global_secrets end |
#import_name ⇒ Object (readonly)
Returns the value of attribute import_name.
12 13 14 |
# File 'lib/arkana/models/config.rb', line 12 def import_name @import_name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
14 15 16 |
# File 'lib/arkana/models/config.rb', line 14 def namespace @namespace end |
#package_manager ⇒ Object (readonly)
Returns the value of attribute package_manager.
26 27 28 |
# File 'lib/arkana/models/config.rb', line 26 def package_manager @package_manager end |
#pod_name ⇒ Object (readonly)
Returns the value of attribute pod_name.
16 17 18 |
# File 'lib/arkana/models/config.rb', line 16 def pod_name @pod_name end |
#result_path ⇒ Object (readonly)
Returns the value of attribute result_path.
18 19 20 |
# File 'lib/arkana/models/config.rb', line 18 def result_path @result_path end |
#should_generate_unit_tests ⇒ Object (readonly)
Returns the value of attribute should_generate_unit_tests.
24 25 26 |
# File 'lib/arkana/models/config.rb', line 24 def should_generate_unit_tests @should_generate_unit_tests end |
#swift_declaration_strategy ⇒ Object (readonly)
Returns the value of attribute swift_declaration_strategy.
22 23 24 |
# File 'lib/arkana/models/config.rb', line 22 def swift_declaration_strategy @swift_declaration_strategy end |
Instance Method Details
#all_keys ⇒ Object
59 60 61 |
# File 'lib/arkana/models/config.rb', line 59 def all_keys global_secrets + environment_keys end |
#environment_keys ⇒ Object
TODO: Consider renaming this and environment_secrets, cuz they’re confusing.
52 53 54 55 56 57 |
# File 'lib/arkana/models/config.rb', line 52 def environment_keys result = environment_secrets.map do |k| environments.map { |e| k + e } end result.flatten end |