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
```
This commit is contained in:
Kazuhiro NISHIYAMA 2020-05-25 20:06:49 +09:00
Родитель 67d2a715ca
Коммит fcc8be0198
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 262ED8DBB4222F7A
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -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