diff options
author | Andre Arko <andre@arko.net> | 2013-08-04 15:40:08 -0700 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2013-08-04 15:40:08 -0700 |
commit | 0f97614799350b380380792494c59b898ea059a9 (patch) | |
tree | f73e6690e5b978fd80f270ff37cd4b16bdbc0ce2 | |
parent | 07d8b0ae2583a776672ed0375911932886031949 (diff) | |
parent | 61bce97dbf63841f1a71574ae3bbfb2c05a8632d (diff) | |
download | bundler-0f97614799350b380380792494c59b898ea059a9.tar.gz |
Merge pull request #2579 from simi/no-cli-groff
Use man instead of groff with specs.
-rw-r--r-- | lib/bundler/cli.rb | 13 | ||||
-rw-r--r-- | spec/other/help_spec.rb | 12 | ||||
-rw-r--r-- | spec/support/helpers.rb | 8 |
3 files changed, 12 insertions, 21 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 5953f5a025..fedad21d09 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -44,11 +44,8 @@ module Bundler if manpages.include?(command) root = File.expand_path("../man", __FILE__) - if Bundler.which("groff") && root !~ %r{^file:/.+!/META-INF/jruby.home/.+} - groff = "groff -Wall -mtty-char -mandoc -Tascii" - pager = pager_system - - Kernel.exec "#{groff} #{root}/#{command} | #{pager}" + if Bundler.which("man") && root !~ %r{^file:/.+!/META-INF/jruby.home/.+} + Kernel.exec "man #{root}/#{command}" else puts File.read("#{root}/#{command}.txt") end @@ -876,12 +873,6 @@ module Bundler message end - def pager_system - pager = ENV['PAGER'] || ENV['MANPAGER'] - pager ||= 'less -R' if Bundler.which("less") - pager ||= 'more' if Bundler.which("more") - pager ||= 'cat' - end def without_groups_message groups = Bundler.settings.without diff --git a/spec/other/help_spec.rb b/spec/other/help_spec.rb index 73203f227b..739f62224e 100644 --- a/spec/other/help_spec.rb +++ b/spec/other/help_spec.rb @@ -11,21 +11,21 @@ describe "bundle help" do expect(err).to include("running `gem cleanup bundler`.") end - it "uses groff when available" do - fake_groff! + it "uses mann when available" do + fake_man! bundle "help gemfile" - expect(out).to eq(%|["-Wall", "-mtty-char", "-mandoc", "-Tascii", "#{root}/lib/bundler/man/gemfile.5"]|) + expect(out).to eq(%|["#{root}/lib/bundler/man/gemfile.5"]|) end it "prefixes bundle commands with bundle- when finding the groff files" do - fake_groff! + fake_man! bundle "help install" - expect(out).to eq(%|["-Wall", "-mtty-char", "-mandoc", "-Tascii", "#{root}/lib/bundler/man/bundle-install"]|) + expect(out).to eq(%|["#{root}/lib/bundler/man/bundle-install"]|) end - it "simply outputs the txt file when there is no groff on the path" do + it "simply outputs the txt file when there is no man on the path" do kill_path! bundle "help install", :expect_err => true diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index 27654b7650..ec9cf27e60 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -222,13 +222,13 @@ module Spec ENV["PATH"] = "#{tmp("broken_path")}:#{ENV["PATH"]}" end - def fake_groff! - FileUtils.mkdir_p(tmp("fake_groff")) - File.open(tmp("fake_groff/groff"), "w", 0755) do |f| + def fake_man! + FileUtils.mkdir_p(tmp("fake_man")) + File.open(tmp("fake_man/man"), "w", 0755) do |f| f.puts "#!/usr/bin/env ruby\nputs ARGV.inspect\n" end - ENV["PATH"] = "#{tmp("fake_groff")}:#{ENV["PATH"]}" + ENV["PATH"] = "#{tmp("fake_man")}:#{ENV["PATH"]}" end def kill_path! |