Class: PortalModule::Command::Config::Add
- Inherits:
-
Thor
- Object
- Thor
- PortalModule::Command::Config::Add
- Defined in:
- lib/portal_module/command/config.rb
Overview
Add commands
Instance Method Summary collapse
- #credentials(envname, username, pass) ⇒ Object
- #env(envname, url) ⇒ Object
- #org(orgname, orgid) ⇒ Object
Instance Method Details
#credentials(envname, username, pass) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/portal_module/command/config.rb', line 41 def credentials(envname, username, pass) with_loaded_config do if PortalModule.configuration.base_urls.key? envname.to_sym unless PortalModule.configuration.credentials.key? envname.to_sym PortalModule.configuration.credentials[envname.to_sym] = [username, pass] else say "credentials already exist for environment '#{envname}'", :red end else say "environment '#{envname}' doesn't exist", :red say "create environment before adding credentials" end end end |
#env(envname, url) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/portal_module/command/config.rb', line 19 def env(envname, url) with_loaded_config do unless PortalModule.configuration.base_urls.key? envname.to_sym PortalModule.configuration.base_urls[envname.to_sym] = url else say "environment '#{envname}' already exists", :red end end end |
#org(orgname, orgid) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/portal_module/command/config.rb', line 30 def org(orgname, orgid) with_loaded_config do unless PortalModule.configuration.orgs.key? orgname PortalModule.configuration.orgs[orgname] = orgid else say "org unit '#{orgname}' already exists", :red end end end |