lib/hanami/cli/commands/gem/version.rb in hanami-cli-2.0.0.alpha8.1 vs lib/hanami/cli/commands/gem/version.rb in hanami-cli-2.0.0.beta1

- old
+ new

@@ -6,11 +6,31 @@ module CLI module Commands module Gem class Version < Command def call(*) + version = detect_version + out.puts "v#{version}" + end + + private + + def detect_version + hanami_version || + hanami_cli_version + end + + def hanami_version require "hanami/version" - out.puts "v#{Hanami::VERSION}" + + Hanami::VERSION + rescue LoadError # rubocop:disable Lint/SuppressedException + end + + def hanami_cli_version + require "hanami/cli/version" + + Hanami::CLI::VERSION end end end end end