Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fi 2116 inferno version cli #441

Merged
merged 2 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/inferno/apps/cli/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require_relative 'suite'
require_relative 'suites'
require_relative 'new'
require_relative '../../version'

module Inferno
module CLI
Expand Down Expand Up @@ -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 Core v#{Inferno::VERSION}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My one question here is do we care to be specific that this may or may not be the version of inferno_core of what is installed in the directory / test kit you are in? Often inferno as a CLI is called within a test kit, which could have a different version of inferno_core installed. Do we care? I don't think so, but figured I'd check. Curious how rails CLI command works, for example.

Copy link
Contributor Author

@Shaumik-Ashraf Shaumik-Ashraf Jan 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this difference would come up if you run bundle exec or not.

  1. bundle exec inferno version -> runs inferno_core from Gemfile

  2. inferno version -> runs inferno_core from last gem install inferno_core and ruby install

On machine if I do a fresh clone of inferno-template I get:
image

If people start using inferno new instead of git clone this issue will be somewhat allevaited, the versions will at least match until a new inferno version is published and either gem update --system or bundle update is executed but not both.

Rails loads bundler in its boot.rb, but I think Inferno can't do that because we need foreman, and foreman can't be added to the gemspec. Same reason we have to run bundle exec inferno services and then inferno start without bundle. So I guess one solution would be replacing or in-housing foreman functionality, and then forcing bin/inferno to load bundler.

Without that though only thing I can think of is adding this version command and help devs figure out any version mismatch.

end
end
end
end
12 changes: 12 additions & 0 deletions lib/inferno/apps/cli/main_spec.rb
Original file line number Diff line number Diff line change
@@ -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
Loading