Class: Rebi::Config
Instance Method Summary collapse
- #app_description ⇒ Object
- #app_name ⇒ Object
- #config_file ⇒ Object
- #config_file=(path) ⇒ Object
- #env_by_name(name) ⇒ Object
- #environment(stg_name, env_name) ⇒ Object
- #reload! ⇒ Object
- #stage(stage) ⇒ Object
- #stages ⇒ Object
- #timeout ⇒ Object
Instance Method Details
#app_description ⇒ Object
22 23 24 |
# File 'lib/rebi/config.rb', line 22 def app_description data[:app_description] || "Created via rebi" end |
#app_name ⇒ Object
18 19 20 |
# File 'lib/rebi/config.rb', line 18 def app_name data[:app_name] end |
#config_file ⇒ Object
5 6 7 |
# File 'lib/rebi/config.rb', line 5 def config_file @config_file ||= "#{Rebi.root}/config/rebi.yml" end |
#config_file=(path) ⇒ Object
9 10 11 |
# File 'lib/rebi/config.rb', line 9 def config_file=path @config_file = Pathname.new(path).realpath.to_s end |
#env_by_name(name) ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rebi/config.rb', line 40 def env_by_name name data[:stages].each do |stg_name, stg_conf| stg = stage stg_name stg_conf.keys.each do |env_name| env_conf = Rebi::ConfigEnvironment.new(stg_name, env_name, stg[env_name] || {}) return env_conf if env_conf.name == name end end return nil end |
#environment(stg_name, env_name) ⇒ Object
34 35 36 37 38 |
# File 'lib/rebi/config.rb', line 34 def environment stg_name, env_name stg = stage stg_name raise(Rebi::Error::ConfigNotFound.new("Environment config: #{env_name}")) unless stg.key?(env_name) return Rebi::ConfigEnvironment.new(stg_name, env_name, stg[env_name] || {}) end |
#reload! ⇒ Object
13 14 15 16 |
# File 'lib/rebi/config.rb', line 13 def reload! @data = nil return data end |
#stage(stage) ⇒ Object
26 27 28 |
# File 'lib/rebi/config.rb', line 26 def stage stage data[:stages][stage] || raise(Rebi::Error::ConfigNotFound.new("Stage: #{stage}")) end |
#stages ⇒ Object
51 52 53 |
# File 'lib/rebi/config.rb', line 51 def stages data[:stages].keys end |
#timeout ⇒ Object
30 31 32 |
# File 'lib/rebi/config.rb', line 30 def timeout (data[:timeout] || 60*10).second end |