From c4dc9817c9e7607f736e1207018dd09a1c5ec347 Mon Sep 17 00:00:00 2001 From: Daniel Insley Date: Wed, 1 Nov 2023 17:49:51 -0700 Subject: [PATCH] removes old deprecated newrelic_cmd bin and associated code, and renames bin/newrelic -> bin/newrelic_rpm --- bin/newrelic | 11 ++--------- bin/newrelic_cmd | 7 ------- bin/newrelic_rpm | 15 +++++++++++++++ lib/new_relic/cli/command.rb | 10 ++++++---- newrelic_rpm.gemspec | 4 ++-- test/new_relic/healthy_urls_test.rb | 2 +- 6 files changed, 26 insertions(+), 23 deletions(-) delete mode 100755 bin/newrelic_cmd create mode 100755 bin/newrelic_rpm diff --git a/bin/newrelic b/bin/newrelic index 78fc6850c0..1c4c103c0f 100755 --- a/bin/newrelic +++ b/bin/newrelic @@ -1,15 +1,8 @@ #!/usr/bin/env ruby # frozen_string_literal: true +# This command has been renamed "newrelic_rpm" # executes one of the commands in the new_relic/commands directory # pass the name of the command as an argument -$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')) -require 'new_relic/cli/command' -begin - NewRelic::Cli::Command.run -rescue NewRelic::Cli::Command::CommandFailure => failure - STDERR.puts failure.message - STDERR.puts failure.options if failure.options - exit(1) -end +load File.dirname(__FILE__) + '/newrelic_rpm' diff --git a/bin/newrelic_cmd b/bin/newrelic_cmd deleted file mode 100755 index 5434cc3dfa..0000000000 --- a/bin/newrelic_cmd +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# This command has been renamed "newrelic" -# executes one of the commands in the new_relic/commands directory -# pass the name of the command as an argument -load File.dirname(__FILE__) + '/newrelic' diff --git a/bin/newrelic_rpm b/bin/newrelic_rpm new file mode 100755 index 0000000000..78fc6850c0 --- /dev/null +++ b/bin/newrelic_rpm @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# executes one of the commands in the new_relic/commands directory +# pass the name of the command as an argument + +$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')) +require 'new_relic/cli/command' +begin + NewRelic::Cli::Command.run +rescue NewRelic::Cli::Command::CommandFailure => failure + STDERR.puts failure.message + STDERR.puts failure.options if failure.options + exit(1) +end diff --git a/lib/new_relic/cli/command.rb b/lib/new_relic/cli/command.rb index 5574459550..3898564f93 100644 --- a/lib/new_relic/cli/command.rb +++ b/lib/new_relic/cli/command.rb @@ -60,11 +60,13 @@ def self.run extra = [] options = ARGV.options do |opts| script_name = File.basename($0) - # TODO: MAJOR VERSION - remove newrelic_cmd, deprecated since version 2.13 - if /newrelic_cmd$/.match?(script_name) - $stdout.puts "warning: the 'newrelic_cmd' script has been renamed 'newrelic'" - script_name = 'newrelic' + + # TODO: MAJOR VERSION - remove newrelic, deprecated since version x.xx + if /newrelic$/.match?(script_name) + $stdout.puts "warning: the 'newrelic' script has been renamed 'newrelic_rpm'" + script_name = 'newrelic_rpm' end + opts.banner = "Usage: #{script_name} [ #{@command_names.join(' | ')} ] [options]" opts.separator("use '#{script_name} -h' to see detailed command options") opts diff --git a/newrelic_rpm.gemspec b/newrelic_rpm.gemspec index 0d4dcfdf9a..a6f9fe8e15 100644 --- a/newrelic_rpm.gemspec +++ b/newrelic_rpm.gemspec @@ -21,8 +21,8 @@ Gem::Specification.new do |s| https://github.com/newrelic/newrelic-ruby-agent/ EOS s.email = 'support@newrelic.com' - # TODO: MAJOR VERSION - remove newrelic_cmd, deprecated since version 2.13 - s.executables = %w[newrelic_cmd newrelic nrdebug] + # TODO: MAJOR VERSION - remove newrelic, deprecated since version xxx. + s.executables = %w[newrelic_rpm newrelic nrdebug] s.extra_rdoc_files = [ 'CHANGELOG.md', 'LICENSE', diff --git a/test/new_relic/healthy_urls_test.rb b/test/new_relic/healthy_urls_test.rb index 0c51f6610b..a444e9c3e9 100644 --- a/test/new_relic/healthy_urls_test.rb +++ b/test/new_relic/healthy_urls_test.rb @@ -36,7 +36,7 @@ class HealthyUrlsTest < Minitest::Test LICENSE mega-runner newrelic - newrelic_cmd + newrelic_rpm nrdebug Rakefile run_tests