Class: Config
- Inherits:
-
Object
- Object
- Config
- Defined in:
- lib/core/config.rb
Constant Summary collapse
- CONFIG_FILE_LOCATIION =
".controlplane/controlplane.yml"
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#app_dir ⇒ Object
readonly
Returns the value of attribute app_dir.
-
#apps ⇒ Object
readonly
Returns the value of attribute apps.
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#current ⇒ Object
readonly
Returns the value of attribute current.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#org ⇒ Object
readonly
Returns the value of attribute org.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #app_cpln_dir ⇒ Object
-
#initialize(args, options) ⇒ Config
constructor
A new instance of Config.
- #script_path ⇒ Object
Constructor Details
#initialize(args, options) ⇒ Config
Returns a new instance of Config.
11 12 13 14 15 16 17 18 19 |
# File 'lib/core/config.rb', line 11 def initialize(args, ) @args = args = @org = [:org] @app = [:app] load_app_config load_apps end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
4 5 6 |
# File 'lib/core/config.rb', line 4 def app @app end |
#app_dir ⇒ Object (readonly)
Returns the value of attribute app_dir.
4 5 6 |
# File 'lib/core/config.rb', line 4 def app_dir @app_dir end |
#apps ⇒ Object (readonly)
Returns the value of attribute apps.
4 5 6 |
# File 'lib/core/config.rb', line 4 def apps @apps end |
#args ⇒ Object (readonly)
Returns the value of attribute args.
4 5 6 |
# File 'lib/core/config.rb', line 4 def args @args end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
4 5 6 |
# File 'lib/core/config.rb', line 4 def config @config end |
#current ⇒ Object (readonly)
Returns the value of attribute current.
4 5 6 |
# File 'lib/core/config.rb', line 4 def current @current end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/core/config.rb', line 4 def end |
#org ⇒ Object (readonly)
Returns the value of attribute org.
4 5 6 |
# File 'lib/core/config.rb', line 4 def org @org end |
Instance Method Details
#[](key) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/core/config.rb', line 21 def [](key) ensure_current_config! raise "Can't find option '#{key}' for app '#{app}' in 'controlplane.yml'." unless current.key?(key) current.fetch(key) end |
#app_cpln_dir ⇒ Object
33 34 35 |
# File 'lib/core/config.rb', line 33 def app_cpln_dir "#{app_dir}/.controlplane" end |
#script_path ⇒ Object
29 30 31 |
# File 'lib/core/config.rb', line 29 def script_path Pathname.new(__dir__).parent.parent end |