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
factorylabs-newrelic_rpm-2.10.2.2 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.9.9 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.9.8 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.9.6 lib/new_relic/commands/new_relic_commands.rb
genki-newrelic_rpm-2.10.1 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.9.5 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.9.2 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.9.3 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.9.4 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.8.1 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.8.5 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.8.6 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.8.7 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.8.10 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.8.4 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.8.3 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.8.2 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.8.11 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.8.9 lib/new_relic/commands/new_relic_commands.rb
newrelic_rpm-2.8.8 lib/new_relic/commands/new_relic_commands.rb