Sha256: 5cd8cd0882c3915d70dc61522c44e546f813101e0c63bc4bc0793e9cc1b21463

Contents?: true

Size: 1020 Bytes

Versions: 40

Compression:

Stored size: 1020 Bytes

Contents

require 'optparse'

# Run the command given by the first argument.  Right
# now all we have is deployments. We hope to have other
# kinds of events here later.

libdir = File.expand_path(File.join(File.dirname(__FILE__), '..','..'))
command_list = Dir[File.join(libdir,'new_relic','commands','*.rb')].map{|command| command =~ /.*\/(.*)\.rb/ && $1}
command_list.delete 'new_relic_commands'
extra = []
options = ARGV.options do |opts|
  script_name = File.basename($0)
  opts.banner = "Usage: #{__FILE__} #{ command_list.join(" | ")} [options]"
  opts.separator "use -h to see detailed command options"
  opts
end
extra = options.order!
command = extra.shift
if !command_list.include?(command)
  STDERR.puts options
else
  require File.join(libdir, 'new_relic','commands', command + ".rb")
  command_class = NewRelic::Commands.const_get(command.capitalize) 
  begin
    command_class.new(extra).run
  rescue NewRelic::Commands::CommandFailure => failure
    STDERR.puts failure.message
    exit failure.exit_code
  end
end

Version data entries

40 entries across 40 versions & 4 rubygems

Version Path
onyx_newrelic_rpm-2.12.5 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.12.3 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.12.2 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.12.2.beta2 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.12.2.beta lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.12.1 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.12.1.alpha lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.12.0 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.11.3 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.11.2 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.11.2.beta2 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.11.2.beta lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.11.1 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.11.0.beta2 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.11.0.beta lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.10.8 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.10.6 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.10.5 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.10.4 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.10.3 lib/new_relic/commands/new_relic_commands.rb