From 6a299906b4bebe1c86bc50a565f47348e735cb8e Mon Sep 17 00:00:00 2001 From: David Rodríguez Date: Thu, 15 Aug 2019 16:59:08 +0200 Subject: [bundler/bundler] Extract a `lib_tracked_files` path helper https://github.com/bundler/bundler/commit/028dc46f5a --- spec/bundler/quality_spec.rb | 4 ---- spec/bundler/support/path.rb | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/bundler/quality_spec.rb b/spec/bundler/quality_spec.rb index 922a99480c..85d0084e9a 100644 --- a/spec/bundler/quality_spec.rb +++ b/spec/bundler/quality_spec.rb @@ -170,7 +170,6 @@ RSpec.describe "The library itself" do error_messages = [] exempt = /vendor|vcr_cassettes/ Dir.chdir(root) do - lib_tracked_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib` lib_tracked_files.split("\x0").each do |filename| next if filename =~ exempt error_messages << check_for_expendable_words(filename) @@ -200,7 +199,6 @@ RSpec.describe "The library itself" do Dir.chdir(root) do key_pattern = /([a-z\._-]+)/i - lib_tracked_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib` lib_tracked_files.split("\x0").each do |filename| each_line(filename) do |line, number| line.scan(/Bundler\.settings\[:#{key_pattern}\]/).flatten.each {|s| all_settings[s] << "referenced at `#{filename}:#{number.succ}`" } @@ -267,7 +265,6 @@ RSpec.describe "The library itself" do lib/bundler/vlad.rb lib/bundler/templates/gems.rb ] - lib_tracked_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib` files_to_require = lib_tracked_files.split("\x0").grep(/\.rb$/) - exclusions files_to_require.reject! {|f| f.start_with?("lib/bundler/vendor") } files_to_require.map! {|f| f.chomp(".rb") } @@ -289,7 +286,6 @@ RSpec.describe "The library itself" do Dir.chdir(root) do exempt = %r{templates/|vendor/} all_bad_requires = [] - lib_tracked_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib` lib_tracked_files.split("\x0").each do |filename| next if filename =~ exempt each_line(filename) do |line, number| diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb index 70ce645c0a..3b18cd2da8 100644 --- a/spec/bundler/support/path.rb +++ b/spec/bundler/support/path.rb @@ -29,6 +29,10 @@ module Spec @tracked_files ||= ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb spec/bundler` : `git ls-files -z` end + def lib_tracked_files + @lib_tracked_files ||= ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib` + end + def tmp(*path) root.join("tmp", *path) end -- cgit v1.2.3