diff options
author | Homu <homu@barosl.com> | 2016-11-06 13:24:14 +0900 |
---|---|---|
committer | Homu <homu@barosl.com> | 2016-11-06 13:24:14 +0900 |
commit | 688f1446c4de87ba6beeeb0216acbcb68249adab (patch) | |
tree | 547d4066d7f9b3ab3bc6e89841aba59598aa1403 /lib/bundler/cli.rb | |
parent | d5c34d5de9569c3ea9d773eb1b6e568603efeeda (diff) | |
parent | 8f6970c5465d9aa6d002d2f2b7f03ba82ddde9b5 (diff) | |
download | bundler-688f1446c4de87ba6beeeb0216acbcb68249adab.tar.gz |
Auto merge of #5139 - bitboxer:move-man-pages-to-man-folder, r=indirect
Move man pages to man folder
The [gem-man](https://github.com/defunkt/gem-man) gem searches for the man pages in the man folder. Sadly bundler right now uses `lib/bundler/man` for the man pages.
This pr fixes this and also creates correct names for the man pages. A man page always needs the section number in the filename.
After this is merged, I will create a PR that changes the [bundler-site](https://github.com/bundler/bundler-site) repo to search in this new folder for the documentation.
Diffstat (limited to 'lib/bundler/cli.rb')
-rw-r--r-- | lib/bundler/cli.rb | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index f618f5cb..ba6a58db 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -61,30 +61,21 @@ module Bundler def help(cli = nil) case cli - when "gemfile" then command = "gemfile.5" + when "gemfile" then command = "gemfile" when nil then command = "bundle" else command = "bundle-#{cli}" end - manpages = %w( - bundle - bundle-config - bundle-exec - bundle-gem - bundle-install - bundle-package - bundle-update - bundle-platform - gemfile.5 - ) - - if manpages.include?(command) - root = File.expand_path("../man", __FILE__) - - if Bundler.which("man") && root !~ %r{^file:/.+!/META-INF/jruby.home/.+} - Kernel.exec "man #{root}/#{command}" + man_path = File.expand_path("../../../man", __FILE__) + man_pages = Hash[Dir.glob(File.join(man_path, "*")).grep(/.*\.\d*\Z/).collect do |f| + [File.basename(f, ".*"), f] + end] + + if man_pages.include?(command) + if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+} + Kernel.exec "man #{man_pages[command]}" else - puts File.read("#{root}/#{command}.txt") + puts File.read("#{man_path}/#{File.basename(man_pages[command])}.txt") end elsif command_path = Bundler.which("bundler-#{cli}") Kernel.exec(command_path, "--help") |