Class: Envirobly::Config
Constant Summary collapse
- DIR =
".envirobly"
- PATH =
"#{DIR}/project.yml"
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #compile(environment = nil) ⇒ Object
- #dig(*args) ⇒ Object
-
#initialize(commit) ⇒ Config
constructor
A new instance of Config.
- #to_deployment_params ⇒ Object
- #validate ⇒ Object
Constructor Details
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
9 10 11 |
# File 'lib/envirobly/config.rb', line 9 def errors @errors end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
9 10 11 |
# File 'lib/envirobly/config.rb', line 9 def raw @raw end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
9 10 11 |
# File 'lib/envirobly/config.rb', line 9 def result @result end |
Instance Method Details
#compile(environment = nil) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/envirobly/config.rb', line 33 def compile(environment = nil) return unless @project @environment = environment @result = @project.slice(:services) set_project_url merge_environment_overrides! unless @environment.nil? end |
#dig(*args) ⇒ Object
20 21 22 23 24 |
# File 'lib/envirobly/config.rb', line 20 def dig(*args) @project.dig(*args) rescue NoMethodError nil end |
#to_deployment_params ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/envirobly/config.rb', line 42 def to_deployment_params { environ: { name: @environment, project_url: @project_url }, commit: { ref: @commit.ref, time: @commit.time, message: @commit. }, config: @result, raw_config: @raw } end |
#validate ⇒ Object
26 27 28 29 30 31 |
# File 'lib/envirobly/config.rb', line 26 def validate return unless @project validate_top_level_keys validate_services @project.fetch(:services) validate_environments end |