diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-11-28 16:13:39 +0100 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-11-28 16:13:39 +0100 |
commit | 53f7bef15a637bed21dab039366b2502369fcb4e (patch) | |
tree | 3bcff97adebb86c8808b0d3a05c72c6c41212ea8 /spec/support | |
parent | c3eae8ea436af06ab2c3f4bdd25bd9dd6e7c9eef (diff) | |
download | bundler-53f7bef15a637bed21dab039366b2502369fcb4e.tar.gz |
Extract git check logic to a method
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/path.rb | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/spec/support/path.rb b/spec/support/path.rb index 4b3941b70f..de08847ba9 100644 --- a/spec/support/path.rb +++ b/spec/support/path.rb @@ -30,23 +30,20 @@ module Spec end def tracked_files - if root != `git rev-parse --show-toplevel` - skip "not in git working directory" - end + skip "not in git working directory" unless git_root_dir? + @tracked_files ||= ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb spec/bundler man/bundler*` : `git ls-files -z` end def shipped_files - if root != `git rev-parse --show-toplevel` - skip "not in git working directory" - end + skip "not in git working directory" unless git_root_dir? + @shipped_files ||= ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb man/bundler* libexec/bundle*` : `git ls-files -z -- lib man exe CHANGELOG.md LICENSE.md README.md bundler.gemspec` end def lib_tracked_files - if root != `git rev-parse --show-toplevel` - skip "not in git working directory" - end + skip "not in git working directory" unless git_root_dir? + @lib_tracked_files ||= ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib` end @@ -182,5 +179,11 @@ module Spec end extend self + + private + + def git_root_dir? + root == `git rev-parse --show-toplevel` + end end end |