2018-11-02 19:07:56 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
RSpec.describe "bundle help" do
|
|
|
|
it "uses mann when available" do
|
|
|
|
with_fake_man do
|
|
|
|
bundle "help gemfile"
|
|
|
|
end
|
|
|
|
expect(out).to eq(%(["#{root}/man/gemfile.5"]))
|
|
|
|
end
|
|
|
|
|
|
|
|
it "prefixes bundle commands with bundle- when finding the groff files" do
|
|
|
|
with_fake_man do
|
|
|
|
bundle "help install"
|
|
|
|
end
|
|
|
|
expect(out).to eq(%(["#{root}/man/bundle-install.1"]))
|
|
|
|
end
|
|
|
|
|
|
|
|
it "simply outputs the txt file when there is no man on the path" do
|
|
|
|
with_path_as("") do
|
|
|
|
bundle "help install"
|
|
|
|
end
|
|
|
|
expect(out).to match(/BUNDLE-INSTALL/)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "still outputs the old help for commands that do not have man pages yet" do
|
|
|
|
bundle "help version"
|
|
|
|
expect(out).to include("Prints the bundler's version information")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "looks for a binary and executes it with --help option if it's named bundler-<task>" do
|
2020-06-14 13:42:31 -04:00
|
|
|
skip "Could not find command testtasks, probably because not a windows friendly executable" if Gem.win_platform?
|
2020-05-08 01:19:04 -04:00
|
|
|
|
2018-11-02 19:07:56 -04:00
|
|
|
File.open(tmp("bundler-testtasks"), "w", 0o755) do |f|
|
|
|
|
f.puts "#!/usr/bin/env ruby\nputs ARGV.join(' ')\n"
|
|
|
|
end
|
|
|
|
|
|
|
|
with_path_added(tmp) do
|
|
|
|
bundle "help testtasks"
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(out).to eq("--help")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "is called when the --help flag is used after the command" do
|
|
|
|
with_fake_man do
|
|
|
|
bundle "install --help"
|
|
|
|
end
|
|
|
|
expect(out).to eq(%(["#{root}/man/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"]))
|
|
|
|
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"]))
|
|
|
|
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"]))
|
|
|
|
end
|
|
|
|
|
|
|
|
it "has helpful output when using --help flag for a non-existent command" do
|
|
|
|
with_fake_man do
|
2020-06-03 12:43:17 -04:00
|
|
|
bundle "instill -h", :raise_on_error => false
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
2019-04-14 02:01:35 -04:00
|
|
|
expect(err).to include('Could not find command "instill".')
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it "is called when only using the --help flag" do
|
|
|
|
with_fake_man do
|
|
|
|
bundle "--help"
|
|
|
|
end
|
|
|
|
expect(out).to eq(%(["#{root}/man/bundle.1"]))
|
|
|
|
|
|
|
|
with_fake_man do
|
|
|
|
bundle "-h"
|
|
|
|
end
|
|
|
|
expect(out).to eq(%(["#{root}/man/bundle.1"]))
|
|
|
|
end
|
|
|
|
end
|