Top Level Namespace
Defined Under Namespace
Modules: Sunrise
Constant Summary collapse
- CONFIG_FNAME =
"#{ENV['HOME']}/.sunrisehq"
- DEVCONFIG_FNAME =
"#{ENV['HOME']}/.sunrisehq-dev"
Instance Method Summary collapse
-
#settings(options = nil) ⇒ Object
Load settings from the config and developer config files, and apply current overrides from options.
-
#setup_sunrise_client(options = nil) ⇒ Object
Get a properly configured sunrise::Client.
Instance Method Details
#settings(options = nil) ⇒ Object
Load settings from the config and developer config files, and apply current overrides from options
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'bin/sunrise', line 14 def settings( = nil) if File.exists?(CONFIG_FNAME) settings = YAML.load( File.read(CONFIG_FNAME) ) else settings = {} end if # Override default settings with command-line options settings.merge!({ 'login' => ['login'] }) if ['login'] settings.merge!({ 'password' => ['password'] }) if ['password'] settings.merge!({ 'default_team' => ['team'] }) if ['team'] end if File.exists?(DEVCONFIG_FNAME) # Merge in developer settings as well settings.merge!( YAML.load( File.read(DEVCONFIG_FNAME) ) ) else # Set default (production) host/port settings.merge!({ 'host' => 'sunrisehq.com', 'port' => 80 }) end settings end |