diff options
author | Kazuhiro NISHIYAMA <zn@mbf.nifty.com> | 2020-05-25 20:06:49 +0900 |
---|---|---|
committer | Kazuhiro NISHIYAMA <zn@mbf.nifty.com> | 2020-05-25 20:08:30 +0900 |
commit | fcc8be0198a16cc5fa7d4827be0c781209b70f98 (patch) | |
tree | 38646ab761122fc9ac960cc89ddc5759ec245a8a /spec/bundler | |
parent | 67d2a715ca35090fbb3ab13df5b7348b1807dd47 (diff) | |
download | ruby-fcc8be0198a16cc5fa7d4827be0c781209b70f98.tar.gz |
Fix a failure in bundle version with version outputs the version with build metadata
```
1) bundle version with version outputs the version with build metadata
Failure/Error: expect(out).to match(/\ABundler version #{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit #{COMMIT_HASH}\)\z/)
expected "Bundler version 2.2.0.dev (2020-05-25 commit )" to match /\ABundler version 2\.2\.0\.dev \(\d{4}-\d{2}-\d{2} commit (?-mix:unknown|[a-fA-F0-9]{7,})\)\z/
Diff:
@@ -1,2 +1,2 @@
-/\ABundler version 2\.2\.0\.dev \(\d{4}-\d{2}-\d{2} commit (?-mix:unknown|[a-fA-F0-9]{7,})\)\z/
+"Bundler version 2.2.0.dev (2020-05-25 commit )"
Commands:
$ /home/user/snapshot-master/ruby -I/home/user/snapshot-master/spec/bundler -r/home/user/snapshot-master/spec/bundler/support/artifice/fail.rb -r/home/user/snapshot-master/spec/bundler/support/hax.rb /home/user/snapshot-master/tmp/1/gems/system/bin/bundle version
Bundler version 2.2.0.dev (2020-05-25 commit )
# $? => 0
```
Diffstat (limited to 'spec/bundler')
-rw-r--r-- | spec/bundler/support/helpers.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb index 731a2d9664..586603fbd7 100644 --- a/spec/bundler/support/helpers.rb +++ b/spec/bundler/support/helpers.rb @@ -329,9 +329,10 @@ module Spec replace_version_file(version, dir: build_path) # rubocop:disable Style/HashSyntax + sys_exec("git rev-parse --short HEAD", :dir => source_root) build_metadata = { :built_at => loaded_gemspec.date.utc.strftime("%Y-%m-%d"), - :git_commit_sha => sys_exec("git rev-parse --short HEAD", :dir => source_root).strip, + :git_commit_sha => exitstatus.zero? ? out.strip : "unknown", } replace_build_metadata(build_metadata, dir: build_path) # rubocop:disable Style/HashSyntax |