From 1cf66b01dfc5cf0a10ef4c07ae04edebba604de6 Mon Sep 17 00:00:00 2001 From: Shaumik-Ashraf Date: Thu, 25 Jan 2024 14:59:20 -0500 Subject: [PATCH 1/2] add version command and rspec --- lib/inferno/apps/cli/main.rb | 6 ++++++ lib/inferno/apps/cli/main_spec.rb | 12 ++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 lib/inferno/apps/cli/main_spec.rb diff --git a/lib/inferno/apps/cli/main.rb b/lib/inferno/apps/cli/main.rb index ff2a45aea..2ebd24160 100644 --- a/lib/inferno/apps/cli/main.rb +++ b/lib/inferno/apps/cli/main.rb @@ -4,6 +4,7 @@ require_relative 'suite' require_relative 'suites' require_relative 'new' +require_relative '../../version' module Inferno module CLI @@ -52,6 +53,11 @@ def suites subcommand 'suite', Suite register(New, 'new', 'new TEST_KIT_NAME', 'Run `inferno new --help` for full help') + + desc 'version', "Output Inferno core version (#{Inferno::VERSION})" + def version + puts Inferno::VERSION + end end end end diff --git a/lib/inferno/apps/cli/main_spec.rb b/lib/inferno/apps/cli/main_spec.rb new file mode 100644 index 000000000..234d49f51 --- /dev/null +++ b/lib/inferno/apps/cli/main_spec.rb @@ -0,0 +1,12 @@ +require 'rspec' +require 'thor' +require 'inferno/apps/cli/main' +require 'inferno/version' + +RSpec.describe Inferno::CLI::Main do # rubocop:disable RSpec/FilePath + context 'with version command' do + it 'outputs current Inferno version' do + expect { described_class.new.version }.to output("#{Inferno::VERSION}\n").to_stdout + end + end +end From 00bad1fd3e69690a99db165aa599f6683985f1b4 Mon Sep 17 00:00:00 2001 From: Shaumik-Ashraf Date: Thu, 25 Jan 2024 15:08:54 -0500 Subject: [PATCH 2/2] make version explicit as Inferno core --- lib/inferno/apps/cli/main.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/inferno/apps/cli/main.rb b/lib/inferno/apps/cli/main.rb index 2ebd24160..a09477309 100644 --- a/lib/inferno/apps/cli/main.rb +++ b/lib/inferno/apps/cli/main.rb @@ -56,7 +56,7 @@ def suites desc 'version', "Output Inferno core version (#{Inferno::VERSION})" def version - puts Inferno::VERSION + puts "Inferno Core v#{Inferno::VERSION}" end end end