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
190 191 192 |
# File 'lib/console-launcher.rb', line 190 def get_password(prompt="RHEV-M Password: ") ask(prompt) { |q| q.echo = "*" } end |
#load_options ⇒ Object
175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/console-launcher.rb', line 175 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
195 196 197 198 |
# File 'lib/console-launcher.rb', line 195 def strip_url(url) url = url.split("://")[1] if url.include? "://" return url end |