From 5d196e367830266f926961964607e2d107b8bda9 Mon Sep 17 00:00:00 2001 From: Mauro Otonelli Date: Tue, 12 Oct 2021 21:45:54 -0300 Subject: [PATCH] Let -v respond with gem version instead of 'unknown' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is what was printed before: ``` ➜ dead_end git:(main) ✗ dead_end --version dead_end: version unknown ``` Now we get the actual gem version in the output. --- CHANGELOG.md | 2 ++ exe/dead_end | 2 ++ spec/integration/exe_cli_spec.rb | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index deae614..9df9727 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## HEAD (unreleased) +- Let -v respond with gem version instead of 'unknown' (https://github.com/zombocom/dead_end/pull/82) + ## 2.0.0 - Support "endless" oneline method definitions for Ruby 3+ (https://github.com/zombocom/dead_end/pull/80) diff --git a/exe/dead_end b/exe/dead_end index f7bb12e..d546ccd 100755 --- a/exe/dead_end +++ b/exe/dead_end @@ -35,6 +35,8 @@ parser = OptionParser.new do |opts| Options: EOM + opts.version = DeadEnd::VERSION + opts.on("--help", "Help - displays this message") do |v| puts opts exit diff --git a/spec/integration/exe_cli_spec.rb b/spec/integration/exe_cli_spec.rb index 779b2f9..8ec8ddf 100644 --- a/spec/integration/exe_cli_spec.rb +++ b/spec/integration/exe_cli_spec.rb @@ -62,5 +62,10 @@ def exe(cmd) expect(tmp_dir).to_not be_empty end end + + it "prints the version" do + out = exe("-v") + expect(out.strip).to include(DeadEnd::VERSION) + end end end