summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-11-28 16:13:39 +0100
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-11-28 16:13:39 +0100
commit53f7bef15a637bed21dab039366b2502369fcb4e (patch)
tree3bcff97adebb86c8808b0d3a05c72c6c41212ea8
parentc3eae8ea436af06ab2c3f4bdd25bd9dd6e7c9eef (diff)
downloadbundler-53f7bef15a637bed21dab039366b2502369fcb4e.tar.gz
Extract git check logic to a method
-rw-r--r--spec/support/path.rb21
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