summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/cli.rb7
-rw-r--r--lib/bundler/man/bundle-add.1 (renamed from man/bundle-add.1)0
-rw-r--r--lib/bundler/man/bundle-binstubs.1 (renamed from man/bundle-binstubs.1)0
-rw-r--r--lib/bundler/man/bundle-cache.1 (renamed from man/bundle-cache.1)0
-rw-r--r--lib/bundler/man/bundle-check.1 (renamed from man/bundle-check.1)0
-rw-r--r--lib/bundler/man/bundle-clean.1 (renamed from man/bundle-clean.1)0
-rw-r--r--lib/bundler/man/bundle-config.1 (renamed from man/bundle-config.1)0
-rw-r--r--lib/bundler/man/bundle-doctor.1 (renamed from man/bundle-doctor.1)0
-rw-r--r--lib/bundler/man/bundle-exec.1 (renamed from man/bundle-exec.1)0
-rw-r--r--lib/bundler/man/bundle-gem.1 (renamed from man/bundle-gem.1)0
-rw-r--r--lib/bundler/man/bundle-info.1 (renamed from man/bundle-info.1)0
-rw-r--r--lib/bundler/man/bundle-init.1 (renamed from man/bundle-init.1)0
-rw-r--r--lib/bundler/man/bundle-inject.1 (renamed from man/bundle-inject.1)0
-rw-r--r--lib/bundler/man/bundle-install.1 (renamed from man/bundle-install.1)0
-rw-r--r--lib/bundler/man/bundle-list.1 (renamed from man/bundle-list.1)0
-rw-r--r--lib/bundler/man/bundle-lock.1 (renamed from man/bundle-lock.1)0
-rw-r--r--lib/bundler/man/bundle-open.1 (renamed from man/bundle-open.1)0
-rw-r--r--lib/bundler/man/bundle-outdated.1 (renamed from man/bundle-outdated.1)0
-rw-r--r--lib/bundler/man/bundle-platform.1 (renamed from man/bundle-platform.1)0
-rw-r--r--lib/bundler/man/bundle-pristine.1 (renamed from man/bundle-pristine.1)0
-rw-r--r--lib/bundler/man/bundle-remove.1 (renamed from man/bundle-remove.1)0
-rw-r--r--lib/bundler/man/bundle-show.1 (renamed from man/bundle-show.1)0
-rw-r--r--lib/bundler/man/bundle-update.1 (renamed from man/bundle-update.1)0
-rw-r--r--lib/bundler/man/bundle-viz.1 (renamed from man/bundle-viz.1)0
-rw-r--r--lib/bundler/man/bundle.1 (renamed from man/bundle.1)0
-rw-r--r--lib/bundler/man/gemfile.5 (renamed from man/gemfile.5)0
-rw-r--r--lib/bundler/man/index.txt25
-rw-r--r--lib/bundler/source/git/git_proxy.rb67
-rw-r--r--lib/bundler/version.rb2
-rw-r--r--spec/bundler/bundler/source/git/git_proxy_spec.rb16
-rw-r--r--spec/bundler/commands/exec_spec.rb10
-rw-r--r--spec/bundler/commands/help_spec.rb16
-rw-r--r--spec/bundler/quality_spec.rb2
-rw-r--r--spec/bundler/support/path.rb6
34 files changed, 82 insertions, 69 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 2f495d427d..249f5b2027 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -122,9 +122,7 @@ module Bundler
else command = "bundle-#{cli}"
end
- man_path = File.expand_path("../../../man", __FILE__)
- # man files are located under ruby's mandir with the default gems of bundler
- man_path = RbConfig::CONFIG["mandir"] unless File.directory?(man_path)
+ man_path = File.expand_path("man", __dir__)
man_pages = Hash[Dir.glob(File.join(man_path, "**", "*")).grep(/.*\.\d*\Z/).collect do |f|
[File.basename(f, ".*"), f]
end]
@@ -134,8 +132,7 @@ module Bundler
if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+}
Kernel.exec "man #{man_page}"
else
- fallback_man_path = File.expand_path("../man", __FILE__)
- puts File.read("#{fallback_man_path}/#{File.basename(man_page)}.ronn")
+ puts File.read("#{man_path}/#{File.basename(man_page)}.ronn")
end
elsif command_path = Bundler.which("bundler-#{cli}")
Kernel.exec(command_path, "--help")
diff --git a/man/bundle-add.1 b/lib/bundler/man/bundle-add.1
index 985d3be8b1..985d3be8b1 100644
--- a/man/bundle-add.1
+++ b/lib/bundler/man/bundle-add.1
diff --git a/man/bundle-binstubs.1 b/lib/bundler/man/bundle-binstubs.1
index 75d6b98c96..75d6b98c96 100644
--- a/man/bundle-binstubs.1
+++ b/lib/bundler/man/bundle-binstubs.1
diff --git a/man/bundle-cache.1 b/lib/bundler/man/bundle-cache.1
index 313359d78f..313359d78f 100644
--- a/man/bundle-cache.1
+++ b/lib/bundler/man/bundle-cache.1
diff --git a/man/bundle-check.1 b/lib/bundler/man/bundle-check.1
index 3f1a4bc329..3f1a4bc329 100644
--- a/man/bundle-check.1
+++ b/lib/bundler/man/bundle-check.1
diff --git a/man/bundle-clean.1 b/lib/bundler/man/bundle-clean.1
index 1c111ae906..1c111ae906 100644
--- a/man/bundle-clean.1
+++ b/lib/bundler/man/bundle-clean.1
diff --git a/man/bundle-config.1 b/lib/bundler/man/bundle-config.1
index 39b32e7496..39b32e7496 100644
--- a/man/bundle-config.1
+++ b/lib/bundler/man/bundle-config.1
diff --git a/man/bundle-doctor.1 b/lib/bundler/man/bundle-doctor.1
index 39841c8032..39841c8032 100644
--- a/man/bundle-doctor.1
+++ b/lib/bundler/man/bundle-doctor.1
diff --git a/man/bundle-exec.1 b/lib/bundler/man/bundle-exec.1
index b8c1b308c3..b8c1b308c3 100644
--- a/man/bundle-exec.1
+++ b/lib/bundler/man/bundle-exec.1
diff --git a/man/bundle-gem.1 b/lib/bundler/man/bundle-gem.1
index 65c35615c5..65c35615c5 100644
--- a/man/bundle-gem.1
+++ b/lib/bundler/man/bundle-gem.1
diff --git a/man/bundle-info.1 b/lib/bundler/man/bundle-info.1
index b20396d273..b20396d273 100644
--- a/man/bundle-info.1
+++ b/lib/bundler/man/bundle-info.1
diff --git a/man/bundle-init.1 b/lib/bundler/man/bundle-init.1
index b6714730c4..b6714730c4 100644
--- a/man/bundle-init.1
+++ b/lib/bundler/man/bundle-init.1
diff --git a/man/bundle-inject.1 b/lib/bundler/man/bundle-inject.1
index 9704eba89b..9704eba89b 100644
--- a/man/bundle-inject.1
+++ b/lib/bundler/man/bundle-inject.1
diff --git a/man/bundle-install.1 b/lib/bundler/man/bundle-install.1
index 7c34f37cdd..7c34f37cdd 100644
--- a/man/bundle-install.1
+++ b/lib/bundler/man/bundle-install.1
diff --git a/man/bundle-list.1 b/lib/bundler/man/bundle-list.1
index d758e61a49..d758e61a49 100644
--- a/man/bundle-list.1
+++ b/lib/bundler/man/bundle-list.1
diff --git a/man/bundle-lock.1 b/lib/bundler/man/bundle-lock.1
index a70043df00..a70043df00 100644
--- a/man/bundle-lock.1
+++ b/lib/bundler/man/bundle-lock.1
diff --git a/man/bundle-open.1 b/lib/bundler/man/bundle-open.1
index 631280c969..631280c969 100644
--- a/man/bundle-open.1
+++ b/lib/bundler/man/bundle-open.1
diff --git a/man/bundle-outdated.1 b/lib/bundler/man/bundle-outdated.1
index 66cfe1a5f7..66cfe1a5f7 100644
--- a/man/bundle-outdated.1
+++ b/lib/bundler/man/bundle-outdated.1
diff --git a/man/bundle-platform.1 b/lib/bundler/man/bundle-platform.1
index 9fda7cb92c..9fda7cb92c 100644
--- a/man/bundle-platform.1
+++ b/lib/bundler/man/bundle-platform.1
diff --git a/man/bundle-pristine.1 b/lib/bundler/man/bundle-pristine.1
index 4561081746..4561081746 100644
--- a/man/bundle-pristine.1
+++ b/lib/bundler/man/bundle-pristine.1
diff --git a/man/bundle-remove.1 b/lib/bundler/man/bundle-remove.1
index b649f62673..b649f62673 100644
--- a/man/bundle-remove.1
+++ b/lib/bundler/man/bundle-remove.1
diff --git a/man/bundle-show.1 b/lib/bundler/man/bundle-show.1
index 1b0608f75a..1b0608f75a 100644
--- a/man/bundle-show.1
+++ b/lib/bundler/man/bundle-show.1
diff --git a/man/bundle-update.1 b/lib/bundler/man/bundle-update.1
index f9922f6618..f9922f6618 100644
--- a/man/bundle-update.1
+++ b/lib/bundler/man/bundle-update.1
diff --git a/man/bundle-viz.1 b/lib/bundler/man/bundle-viz.1
index 2f68f644bf..2f68f644bf 100644
--- a/man/bundle-viz.1
+++ b/lib/bundler/man/bundle-viz.1
diff --git a/man/bundle.1 b/lib/bundler/man/bundle.1
index 232752e914..232752e914 100644
--- a/man/bundle.1
+++ b/lib/bundler/man/bundle.1
diff --git a/man/gemfile.5 b/lib/bundler/man/gemfile.5
index f501db2b66..f501db2b66 100644
--- a/man/gemfile.5
+++ b/lib/bundler/man/gemfile.5
diff --git a/lib/bundler/man/index.txt b/lib/bundler/man/index.txt
new file mode 100644
index 0000000000..ef2956b2f9
--- /dev/null
+++ b/lib/bundler/man/index.txt
@@ -0,0 +1,25 @@
+Gemfile(5) gemfile.5
+bundle(1) bundle.1
+bundle-add(1) bundle-add.1
+bundle-binstubs(1) bundle-binstubs.1
+bundle-cache(1) bundle-cache.1
+bundle-check(1) bundle-check.1
+bundle-clean(1) bundle-clean.1
+bundle-config(1) bundle-config.1
+bundle-doctor(1) bundle-doctor.1
+bundle-exec(1) bundle-exec.1
+bundle-gem(1) bundle-gem.1
+bundle-info(1) bundle-info.1
+bundle-init(1) bundle-init.1
+bundle-inject(1) bundle-inject.1
+bundle-install(1) bundle-install.1
+bundle-list(1) bundle-list.1
+bundle-lock(1) bundle-lock.1
+bundle-open(1) bundle-open.1
+bundle-outdated(1) bundle-outdated.1
+bundle-platform(1) bundle-platform.1
+bundle-pristine(1) bundle-pristine.1
+bundle-remove(1) bundle-remove.1
+bundle-show(1) bundle-show.1
+bundle-update(1) bundle-update.1
+bundle-viz(1) bundle-viz.1
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb
index 7ac47044b3..dd65c674d8 100644
--- a/lib/bundler/source/git/git_proxy.rb
+++ b/lib/bundler/source/git/git_proxy.rb
@@ -67,13 +67,13 @@ module Bundler
def branch
@branch ||= allowed_with_path do
- git("rev-parse --abbrev-ref HEAD", :dir => path).strip
+ git("rev-parse", "--abbrev-ref", "HEAD", :dir => path).strip
end
end
def contains?(commit)
allowed_with_path do
- result, status = git_null("branch --contains #{commit}", :dir => path)
+ result, status = git_null("branch", "--contains", commit, :dir => path)
status.success? && result =~ /^\* (.*)$/
end
end
@@ -88,20 +88,22 @@ module Bundler
def checkout
return if path.exist? && has_revision_cached?
- extra_ref = "#{Shellwords.shellescape(ref)}:#{Shellwords.shellescape(ref)}" if ref && ref.start_with?("refs/")
+ extra_ref = "#{ref}:#{ref}" if ref && ref.start_with?("refs/")
Bundler.ui.info "Fetching #{URICredentialsFilter.credential_filtered_uri(uri)}"
+ configured_uri = configured_uri_for(uri).to_s
+
unless path.exist?
SharedHelpers.filesystem_access(path.dirname) do |p|
FileUtils.mkdir_p(p)
end
- git_retry %(clone #{uri_escaped_with_configured_credentials} "#{path}" --bare --no-hardlinks --quiet)
+ git_retry "clone", configured_uri, path.to_s, "--bare", "--no-hardlinks", "--quiet"
return unless extra_ref
end
with_path do
- git_retry %(fetch --force --quiet --tags #{uri_escaped_with_configured_credentials} "refs/heads/*:refs/heads/*" #{extra_ref}), :dir => path
+ git_retry(*["fetch", "--force", "--quiet", "--tags", configured_uri, "refs/heads/*:refs/heads/*", extra_ref].compact, :dir => path)
end
end
@@ -115,7 +117,7 @@ module Bundler
SharedHelpers.filesystem_access(destination) do |p|
FileUtils.rm_rf(p)
end
- git_retry %(clone --no-checkout --quiet "#{path}" "#{destination}")
+ git_retry "clone", "--no-checkout", "--quiet", path.to_s, destination.to_s
File.chmod(((File.stat(destination).mode | 0o777) & ~File.umask), destination)
rescue Errno::EEXIST => e
file_path = e.message[%r{.*?((?:[a-zA-Z]:)?/.*)}, 1]
@@ -125,46 +127,45 @@ module Bundler
end
end
# method 2
- git_retry %(fetch --force --quiet --tags "#{path}"), :dir => destination
+ git_retry "fetch", "--force", "--quiet", "--tags", path.to_s, :dir => destination
begin
- git "reset --hard #{@revision}", :dir => destination
+ git "reset", "--hard", @revision, :dir => destination
rescue GitCommandError => e
raise MissingGitRevisionError.new(e.command, path, destination, @revision, URICredentialsFilter.credential_filtered_uri(uri))
end
if submodules
- git_retry "submodule update --init --recursive", :dir => destination
+ git_retry "submodule", "update", "--init", "--recursive", :dir => destination
elsif Gem::Version.create(version) >= Gem::Version.create("2.9.0")
inner_command = "git -C $toplevel submodule deinit --force $sm_path"
- inner_command = inner_command.gsub("$") { '\$' } unless Bundler::WINDOWS
- git_retry "submodule foreach --quiet \"#{inner_command}\"", :dir => destination
+ git_retry "submodule", "foreach", "--quiet", inner_command, :dir => destination
end
end
private
- def git_null(command, dir: SharedHelpers.pwd)
+ def git_null(*command, dir: SharedHelpers.pwd)
check_allowed(command)
out, status = SharedHelpers.with_clean_git_env do
- capture_and_ignore_stderr("git #{command}", :chdir => dir.to_s)
+ capture_and_ignore_stderr("git", "-C", dir.to_s, *command)
end
[URICredentialsFilter.credential_filtered_string(out, uri), status]
end
- def git_retry(command, dir: SharedHelpers.pwd)
- Bundler::Retry.new("`git #{URICredentialsFilter.credential_filtered_string(command, uri)}`", GitNotAllowedError).attempts do
- git(command, :dir => dir)
+ def git_retry(*command, dir: SharedHelpers.pwd)
+ Bundler::Retry.new("`git -C #{dir} #{URICredentialsFilter.credential_filtered_string(command.shelljoin, uri)}`", GitNotAllowedError).attempts do
+ git(*command, :dir => dir)
end
end
- def git(command, dir: SharedHelpers.pwd)
+ def git(*command, dir: SharedHelpers.pwd)
command_with_no_credentials = check_allowed(command)
out, status = SharedHelpers.with_clean_git_env do
- capture_and_filter_stderr(uri, "git #{command}", :chdir => dir.to_s)
+ capture_and_filter_stderr("git", "-C", dir.to_s, *command)
end
raise GitCommandError.new(command_with_no_credentials, path, dir) unless status.success?
@@ -174,7 +175,7 @@ module Bundler
def has_revision_cached?
return unless @revision
- with_path { git("cat-file -e #{@revision}", :dir => path) }
+ with_path { git("cat-file", "-e", @revision, :dir => path) }
true
rescue GitError
false
@@ -186,26 +187,12 @@ module Bundler
def find_local_revision
allowed_with_path do
- git("rev-parse --verify #{Shellwords.shellescape(ref)}", :dir => path).strip
+ git("rev-parse", "--verify", ref, :dir => path).strip
end
rescue GitCommandError => e
raise MissingGitRevisionError.new(e.command, path, path, ref, URICredentialsFilter.credential_filtered_uri(uri))
end
- # Escape the URI for git commands
- def uri_escaped_with_configured_credentials
- remote = configured_uri_for(uri)
- if Bundler::WINDOWS
- # Windows quoting requires double quotes only, with double quotes
- # inside the string escaped by being doubled.
- '"' + remote.gsub('"') { '""' } + '"'
- else
- # Bash requires single quoted strings, with the single quotes escaped
- # by ending the string, escaping the quote, and restarting the string.
- "'" + remote.gsub("'") { "'\\''" } + "'"
- end
- end
-
# Adds credentials to the URI as Fetcher#configured_uri_for does
def configured_uri_for(uri)
if /https?:/ =~ uri
@@ -233,21 +220,21 @@ module Bundler
end
def check_allowed(command)
- command_with_no_credentials = URICredentialsFilter.credential_filtered_string(command, uri)
+ command_with_no_credentials = URICredentialsFilter.credential_filtered_string(command.shelljoin, uri)
raise GitNotAllowedError.new(command_with_no_credentials) unless allow?
command_with_no_credentials
end
- def capture_and_filter_stderr(uri, cmd, chdir: SharedHelpers.pwd)
+ def capture_and_filter_stderr(*cmd)
require "open3"
- return_value, captured_err, status = Open3.capture3(cmd, :chdir => chdir)
- Bundler.ui.warn URICredentialsFilter.credential_filtered_string(captured_err, uri) if uri && !captured_err.empty?
+ return_value, captured_err, status = Open3.capture3(*cmd)
+ Bundler.ui.warn URICredentialsFilter.credential_filtered_string(captured_err, uri) unless captured_err.empty?
[return_value, status]
end
- def capture_and_ignore_stderr(cmd, chdir: SharedHelpers.pwd)
+ def capture_and_ignore_stderr(*cmd)
require "open3"
- return_value, _, status = Open3.capture3(cmd, :chdir => chdir)
+ return_value, _, status = Open3.capture3(*cmd)
[return_value, status]
end
end
diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb
index 8db404377c..531a21988a 100644
--- a/lib/bundler/version.rb
+++ b/lib/bundler/version.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: false
module Bundler
- VERSION = "2.2.3".freeze
+ VERSION = "2.2.4".freeze
def self.bundler_major_version
@bundler_major_version ||= VERSION.split(".").first.to_i
diff --git a/spec/bundler/bundler/source/git/git_proxy_spec.rb b/spec/bundler/bundler/source/git/git_proxy_spec.rb
index 4744e0cd4c..35702d7763 100644
--- a/spec/bundler/bundler/source/git/git_proxy_spec.rb
+++ b/spec/bundler/bundler/source/git/git_proxy_spec.rb
@@ -11,21 +11,21 @@ RSpec.describe Bundler::Source::Git::GitProxy do
context "with configured credentials" do
it "adds username and password to URI" do
Bundler.settings.temporary(uri => "u:p") do
- expect(subject).to receive(:git_retry).with(match("https://u:p@github.com/rubygems/rubygems.git"))
+ expect(subject).to receive(:git_retry).with("clone", "https://u:p@github.com/rubygems/rubygems.git", any_args)
subject.checkout
end
end
it "adds username and password to URI for host" do
Bundler.settings.temporary("github.com" => "u:p") do
- expect(subject).to receive(:git_retry).with(match("https://u:p@github.com/rubygems/rubygems.git"))
+ expect(subject).to receive(:git_retry).with("clone", "https://u:p@github.com/rubygems/rubygems.git", any_args)
subject.checkout
end
end
it "does not add username and password to mismatched URI" do
Bundler.settings.temporary("https://u:p@github.com/rubygems/rubygems-mismatch.git" => "u:p") do
- expect(subject).to receive(:git_retry).with(match(uri))
+ expect(subject).to receive(:git_retry).with("clone", uri, any_args)
subject.checkout
end
end
@@ -34,7 +34,7 @@ RSpec.describe Bundler::Source::Git::GitProxy do
Bundler.settings.temporary("github.com" => "u:p") do
original = "https://orig:info@github.com/rubygems/rubygems.git"
subject = described_class.new(Pathname("path"), original, "HEAD")
- expect(subject).to receive(:git_retry).with(match(original))
+ expect(subject).to receive(:git_retry).with("clone", original, any_args)
subject.checkout
end
end
@@ -129,12 +129,12 @@ RSpec.describe Bundler::Source::Git::GitProxy do
context "when given a SHA as a revision" do
let(:revision) { "abcd" * 10 }
- let(:command) { "reset --hard #{revision}" }
+ let(:command) { ["reset", "--hard", revision] }
it "fails gracefully when resetting to the revision fails" do
- expect(subject).to receive(:git_retry).with(start_with("clone ")) { destination.mkpath }
- expect(subject).to receive(:git_retry).with(start_with("fetch "), :dir => destination)
- expect(subject).to receive(:git).with(command, :dir => destination).and_raise(Bundler::Source::Git::GitCommandError.new(command, cache, destination))
+ expect(subject).to receive(:git_retry).with("clone", any_args) { destination.mkpath }
+ expect(subject).to receive(:git_retry).with("fetch", any_args, :dir => destination)
+ expect(subject).to receive(:git).with(*command, :dir => destination).and_raise(Bundler::Source::Git::GitCommandError.new(command, cache, destination))
expect(subject).not_to receive(:git)
expect { subject.copy_to(destination, submodules) }.
diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb
index 1449bb642e..5d43586116 100644
--- a/spec/bundler/commands/exec_spec.rb
+++ b/spec/bundler/commands/exec_spec.rb
@@ -448,35 +448,35 @@ RSpec.describe "bundle exec" do
with_fake_man do
bundle "#{exec} --help cat"
end
- expect(out).to include(%(["#{root}/man/bundle-exec.1"]))
+ expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end
it "shows bundle-exec's man page when --help is before exec" do
with_fake_man do
bundle "--help #{exec}"
end
- expect(out).to include(%(["#{root}/man/bundle-exec.1"]))
+ expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end
it "shows bundle-exec's man page when -h is before exec" do
with_fake_man do
bundle "-h #{exec}"
end
- expect(out).to include(%(["#{root}/man/bundle-exec.1"]))
+ expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end
it "shows bundle-exec's man page when --help is after exec" do
with_fake_man do
bundle "#{exec} --help"
end
- expect(out).to include(%(["#{root}/man/bundle-exec.1"]))
+ expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end
it "shows bundle-exec's man page when -h is after exec" do
with_fake_man do
bundle "#{exec} -h"
end
- expect(out).to include(%(["#{root}/man/bundle-exec.1"]))
+ expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end
end
end
diff --git a/spec/bundler/commands/help_spec.rb b/spec/bundler/commands/help_spec.rb
index 03d34ef692..f72763900e 100644
--- a/spec/bundler/commands/help_spec.rb
+++ b/spec/bundler/commands/help_spec.rb
@@ -5,14 +5,14 @@ RSpec.describe "bundle help" do
with_fake_man do
bundle "help gemfile"
end
- expect(out).to eq(%(["#{root}/man/gemfile.5"]))
+ expect(out).to eq(%(["#{man_dir}/gemfile.5"]))
end
it "prefixes bundle commands with bundle- when finding the man files" do
with_fake_man do
bundle "help install"
end
- expect(out).to eq(%(["#{root}/man/bundle-install.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
end
it "simply outputs the human readable file when there is no man on the path" do
@@ -45,28 +45,28 @@ RSpec.describe "bundle help" do
with_fake_man do
bundle "install --help"
end
- expect(out).to eq(%(["#{root}/man/bundle-install.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
end
it "is called when the --help flag is used before the command" do
with_fake_man do
bundle "--help install"
end
- expect(out).to eq(%(["#{root}/man/bundle-install.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
end
it "is called when the -h flag is used before the command" do
with_fake_man do
bundle "-h install"
end
- expect(out).to eq(%(["#{root}/man/bundle-install.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
end
it "is called when the -h flag is used after the command" do
with_fake_man do
bundle "install -h"
end
- expect(out).to eq(%(["#{root}/man/bundle-install.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
end
it "has helpful output when using --help flag for a non-existent command" do
@@ -80,11 +80,11 @@ RSpec.describe "bundle help" do
with_fake_man do
bundle "--help"
end
- expect(out).to eq(%(["#{root}/man/bundle.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle.1"]))
with_fake_man do
bundle "-h"
end
- expect(out).to eq(%(["#{root}/man/bundle.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle.1"]))
end
end
diff --git a/spec/bundler/quality_spec.rb b/spec/bundler/quality_spec.rb
index 808f0502a4..405c786842 100644
--- a/spec/bundler/quality_spec.rb
+++ b/spec/bundler/quality_spec.rb
@@ -249,7 +249,7 @@ RSpec.describe "The library itself" do
end
it "does not use require internally, but require_relative" do
- exempt = %r{templates/|man/|vendor/}
+ exempt = %r{templates/|\.5|\.1|vendor/}
all_bad_requires = []
lib_tracked_files.each do |filename|
next if filename =~ exempt
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
index 305ea0a876..56d3c71f3c 100644
--- a/spec/bundler/support/path.rb
+++ b/spec/bundler/support/path.rb
@@ -63,6 +63,10 @@ module Spec
@spec_dir ||= source_root.join(ruby_core? ? "spec/bundler" : "spec")
end
+ def man_dir
+ @man_dir ||= lib_dir.join("bundler/man")
+ end
+
def tracked_files
@tracked_files ||= git_ls_files(tracked_files_glob)
end
@@ -236,7 +240,7 @@ module Spec
end
def man_tracked_files_glob
- ruby_core? ? "man/bundle* man/gemfile*" : "man"
+ ruby_core? ? "man/bundle* man/gemfile*" : "lib/bundler/man/bundle*.1 lib/bundler/man/gemfile*.5"
end
def git_root