Class: Nrcmd::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/nrcmd/cli.rb

Constant Summary collapse

URL =
'https://api.newrelic.com/v2'

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ CLI

Returns a new instance of CLI.



29
30
31
32
33
# File 'lib/nrcmd/cli.rb', line 29

def initialize(*args)
  super
  Nrcmd.conf = Nrcmd::Config.load(!!options["config"] ? options["config"] : "#{Dir.home}/.nrcmd_config.rb")
  Nrcmd.log_level = (!!options["verbose"] ? "DEBUG" : "INFO")
end

Instance Method Details

#configureObject



36
37
38
39
40
41
# File 'lib/nrcmd/cli.rb', line 36

def configure
  your_api_key = ask("Your NewRelic Api Key: ", :echo => false)
  conf = eval File.read "#{Dir.pwd}/nrcmd_config.rb"
  conf.merge! Hash[ :nr_api_key => your_api_key ]
  File.write("#{Dir.home}/.nrcmd_config.rb", PP.pp(conf, ''))
end