Class: Gem::Commands::ManpagesCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::ManpagesCommand
- Includes:
- VersionOption
- Defined in:
- lib/rubygems/commands/manpages_command.rb
Instance Method Summary collapse
- #add_update_all_option ⇒ Object
- #execute ⇒ Object
-
#initialize ⇒ ManpagesCommand
constructor
A new instance of ManpagesCommand.
- #update_all ⇒ Object
- #usage ⇒ Object
Constructor Details
#initialize ⇒ ManpagesCommand
Returns a new instance of ManpagesCommand.
4 5 6 7 8 9 10 11 12 |
# File 'lib/rubygems/commands/manpages_command.rb', line 4 def initialize super "manpages", "Handling manpages in gems", command: nil, version: Gem::Requirement.default, latest: false, all: false add_update_all_option end |
Instance Method Details
#add_update_all_option ⇒ Object
18 19 20 21 22 23 |
# File 'lib/rubygems/commands/manpages_command.rb', line 18 def add_update_all_option add_option("-u", "--update-all", "Search for manpages in all installed gems and expose them to man") do |_, | [:update_all] = true end end |
#execute ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/rubygems/commands/manpages_command.rb', line 25 def execute if [:update_all] update_all else show_help end end |
#update_all ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/rubygems/commands/manpages_command.rb', line 33 def update_all specs = Gem::Specification.respond_to?(:each) ? Gem::Specification : Gem.source_index.gems specs.each do |*name_and_spec| spec = name_and_spec.pop next unless Manpages::ManFiles.new(spec.gem_dir).manpages_present? && Manpages::GemVersion.new(spec).latest? say "Installing man pages for #{spec.name} #{spec.version}" target_dir = File.("#{Gem.bindir}/../share/man") Manpages::Install.new(spec, spec.gem_dir, target_dir).install_manpages end end |
#usage ⇒ Object
14 15 16 |
# File 'lib/rubygems/commands/manpages_command.rb', line 14 def usage "gem manpages" end |