diff options
Diffstat (limited to 'spec/quality_spec.rb')
-rw-r--r-- | spec/quality_spec.rb | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb index f8aec009ef..e85d0bfa97 100644 --- a/spec/quality_spec.rb +++ b/spec/quality_spec.rb @@ -108,7 +108,8 @@ RSpec.describe "The library itself" do exempt = /\.gitmodules|\.marshal|fixtures|vendor|ssl_certs|LICENSE|vcr_cassettes/ error_messages = [] Dir.chdir(root) do - `git ls-files -z`.split("\x0").each do |filename| + lib_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb spec/bundler` : `git ls-files -z -- lib` + lib_files.split("\x0").each do |filename| next if filename =~ exempt error_messages << check_for_tab_characters(filename) error_messages << check_for_extra_spaces(filename) @@ -121,7 +122,8 @@ RSpec.describe "The library itself" do exempt = %r{quality_spec.rb|support/helpers|vcr_cassettes|\.md|\.ronn} error_messages = [] Dir.chdir(root) do - `git ls-files -z`.split("\x0").each do |filename| + lib_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb spec/bundler` : `git ls-files -z -- lib` + lib_files.split("\x0").each do |filename| next if filename =~ exempt error_messages << check_for_debugging_mechanisms(filename) end @@ -133,7 +135,8 @@ RSpec.describe "The library itself" do error_messages = [] exempt = %r{lock/lockfile_(bundler_1_)?spec|quality_spec|vcr_cassettes|\.ronn|lockfile_parser\.rb} Dir.chdir(root) do - `git ls-files -z`.split("\x0").each do |filename| + lib_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb spec/bundler` : `git ls-files -z -- lib` + lib_files.split("\x0").each do |filename| next if filename =~ exempt error_messages << check_for_git_merge_conflicts(filename) end @@ -158,7 +161,8 @@ RSpec.describe "The library itself" do error_messages = [] exempt = /vendor/ Dir.chdir(root) do - `git ls-files -z -- lib`.split("\x0").each do |filename| + lib_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib` + lib_files.split("\x0").each do |filename| next if filename =~ exempt error_messages << check_for_expendable_words(filename) error_messages << check_for_specific_pronouns(filename) @@ -191,7 +195,8 @@ RSpec.describe "The library itself" do Dir.chdir(root) do key_pattern = /([a-z\._-]+)/i - `git ls-files -z -- lib`.split("\x0").each do |filename| + lib_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib` + lib_files.split("\x0").each do |filename| File.readlines(filename).each_with_index do |line, number| line.scan(/Bundler\.settings\[:#{key_pattern}\]/).flatten.each {|s| all_settings[s] << "referenced at `#{filename}:#{number.succ}`" } end @@ -219,7 +224,7 @@ RSpec.describe "The library itself" do it "can still be built" do Dir.chdir(root) do begin - gem_command! :build, "bundler.gemspec" + gem_command! :build, gemspec if Bundler.rubygems.provides?(">= 2.4") # there's no way around this warning last_command.stderr.sub!(/^YAML safe loading.*/, "") @@ -230,7 +235,8 @@ RSpec.describe "The library itself" do end ensure # clean up the .gem generated - FileUtils.rm("bundler-#{Bundler::VERSION}.gem") + path_prefix = ruby_core? ? "lib/" : "./" + FileUtils.rm("#{path_prefix}bundler-#{Bundler::VERSION}.gem") end end end @@ -244,7 +250,8 @@ RSpec.describe "The library itself" do lib/bundler/vlad.rb lib/bundler/templates/gems.rb ] - lib_files = `git ls-files -z -- lib`.split("\x0").grep(/\.rb$/) - exclusions + lib_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib` + lib_files = lib_files.split("\x0").grep(/\.rb$/) - exclusions lib_files.reject! {|f| f.start_with?("lib/bundler/vendor") } lib_files.map! {|f| f.chomp(".rb") } sys_exec!("ruby -w -Ilib") do |input, _, _| |