Module: Helper
- Defined in:
- lib/console-launcher.rb
Constant Summary collapse
- CONFIG_FILE =
File.join(ENV['HOME'], '.console-launcher.rc.yaml')
- OPTIONS =
{ print: false, dryrun: false, host: nil, user: "admin@internal", pass: nil }
Instance Method Summary collapse
-
#get_password(prompt = "RHEV-M Password: ") ⇒ Object
queries the User for a password.
- #load_options ⇒ Object
-
#strip_url(url) ⇒ Object
Remove any leading http or https from the host.
Instance Method Details
#get_password(prompt = "RHEV-M Password: ") ⇒ Object
queries the User for a password
181 182 183 |
# File 'lib/console-launcher.rb', line 181 def get_password(prompt="RHEV-M Password: ") ask(prompt) { |q| q.echo = "*" } end |
#load_options ⇒ Object
166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/console-launcher.rb', line 166 def if File.exists? CONFIG_FILE = YAML.load_file(CONFIG_FILE) OPTIONS.merge!() unless .has_key?(:viewer) File.open(CONFIG_FILE, 'w') { |file| YAML::dump(OPTIONS, file) } end else File.open(CONFIG_FILE, 'w') { |file| YAML::dump(OPTIONS, file) } STDERR.puts "Initialized configuration file in #{CONFIG_FILE}" end end |
#strip_url(url) ⇒ Object
Remove any leading http or https from the host
186 187 188 189 |
# File 'lib/console-launcher.rb', line 186 def strip_url(url) url = url.split("://")[1] if url.include? "://" return url end |