manpages 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88713453a394e93be00536e4ea25d068aed8e407
4
- data.tar.gz: a5543a28271ab62d36ecfd9ab110849ab5e74228
3
+ metadata.gz: 993a04a4792e621d1c00d192b2b8af5ed93cfdf1
4
+ data.tar.gz: 0afc07b419e79ae2273995388af0043412f6cfa8
5
5
  SHA512:
6
- metadata.gz: 5d9efae3bd6c9b240ccf0be50478bcef825328781ac92d5263a82e424299f3d5d8d1d5c47993d70915128b8598aaa31f1ad442449b7ffa5e9e6778ac85db3e48
7
- data.tar.gz: bb69e48ef80123442e11d6ff2cbe3cfc4e545b44a4b60d88b31ba031a8895d4fa881686f5c96fe9439d5f99212d1fcdc98dabfbdc6858eefae570a0b279c04c5
6
+ metadata.gz: 7508f26fe98586c18289633e2c7fd5a3f8d63d109285c30a29e3ae59c5598dcc85decf935be20474f89f0d9bf7bf457f04ce5f31a8c4c491c5040a866b170d5e
7
+ data.tar.gz: 60e656f4a2f643fec5aa1bc91758cb03d5c062fe36816dd9e5732e363ff76b3ce08e28b4cac96bf8afcc80e8759242670e43287954472eeb2eaf7d8c61d1b780
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- manpages (0.4.0)
4
+ manpages (0.5.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -14,7 +14,7 @@ the ruby version currently used.
14
14
 
15
15
  # Installation
16
16
 
17
- `gem install manpages`
17
+ `gem install manpages && gem manpages --update-all`
18
18
 
19
19
  This plugin automatically hooks into the ruby gems system. Every gem
20
20
  installed afterwards is checked for manpages. If this gem finds them, it
@@ -4,11 +4,15 @@ module Manpages
4
4
  class ManFiles
5
5
  attr_reader :man_dir
6
6
 
7
- def initialize(gem_dir, target_dir)
7
+ def initialize(gem_dir, target_dir = "")
8
8
  @target_dir = Pathname(target_dir)
9
9
  @man_dir = Pathname(File.join(gem_dir, "man"))
10
10
  end
11
11
 
12
+ def manpages_present?
13
+ !manpages.empty?
14
+ end
15
+
12
16
  def manpages
13
17
  return [] unless man_dir.directory?
14
18
 
@@ -1,3 +1,3 @@
1
1
  module Manpages
2
- VERSION = "0.5.0".freeze
2
+ VERSION = "0.5.1".freeze
3
3
  end
@@ -0,0 +1,45 @@
1
+ class Gem::Commands::ManpagesCommand < Gem::Command
2
+ include Gem::VersionOption
3
+
4
+ def initialize
5
+ super "manpages", "Handling manpages in gems",
6
+ command: nil,
7
+ version: Gem::Requirement.default,
8
+ latest: false,
9
+ all: false
10
+
11
+ add_update_all_option
12
+ end
13
+
14
+ def usage
15
+ "gem manpages"
16
+ end
17
+
18
+ def add_update_all_option
19
+ add_option("-u", "--update-all",
20
+ "Search for manpages in all installed gems and expose them to man") do |_, options|
21
+ options[:update_all] = true
22
+ end
23
+ end
24
+
25
+ def execute
26
+ if options[:update_all]
27
+ update_all
28
+ else
29
+ show_help
30
+ end
31
+ end
32
+
33
+ def update_all
34
+ specs = Gem::Specification.respond_to?(:each) ? Gem::Specification : Gem.source_index.gems
35
+ specs.each do |*name_and_spec|
36
+ spec = name_and_spec.pop
37
+ next unless Manpages::ManFiles.new(spec.gem_dir).manpages_present? &&
38
+ Manpages::GemVersion.new(spec).latest?
39
+
40
+ say "Installing man pages for #{spec.name} #{spec.version}"
41
+ target_dir = File.expand_path("#{Gem.bindir}/../share/man")
42
+ Manpages::Install.new(spec, spec.gem_dir, target_dir).install_manpages
43
+ end
44
+ end
45
+ end
@@ -1,4 +1,9 @@
1
1
  require "manpages"
2
+ require "rubygems/command_manager"
3
+ require "rubygems/version_option"
4
+ require "rubygems/gem/specification"
5
+
6
+ Gem::CommandManager.instance.register_command :manpages
2
7
 
3
8
  Gem.post_install do |installer|
4
9
  source_dir = installer.spec.gem_dir
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manpages
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bodo Tasche
@@ -105,6 +105,7 @@ files:
105
105
  - lib/manpages/man_files.rb
106
106
  - lib/manpages/uninstall.rb
107
107
  - lib/manpages/version.rb
108
+ - lib/rubygems/commands/manpages_command.rb
108
109
  - lib/rubygems_plugin.rb
109
110
  - manpages.gemspec
110
111
  - rbenv/hooks/install-man.bash