manpages 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/manpages/man_files.rb +5 -1
- data/lib/manpages/version.rb +1 -1
- data/lib/rubygems/commands/manpages_command.rb +45 -0
- data/lib/rubygems_plugin.rb +5 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 993a04a4792e621d1c00d192b2b8af5ed93cfdf1
|
4
|
+
data.tar.gz: 0afc07b419e79ae2273995388af0043412f6cfa8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7508f26fe98586c18289633e2c7fd5a3f8d63d109285c30a29e3ae59c5598dcc85decf935be20474f89f0d9bf7bf457f04ce5f31a8c4c491c5040a866b170d5e
|
7
|
+
data.tar.gz: 60e656f4a2f643fec5aa1bc91758cb03d5c062fe36816dd9e5732e363ff76b3ce08e28b4cac96bf8afcc80e8759242670e43287954472eeb2eaf7d8c61d1b780
|
data/Gemfile.lock
CHANGED
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
|
data/lib/manpages/man_files.rb
CHANGED
@@ -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
|
|
data/lib/manpages/version.rb
CHANGED
@@ -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
|
data/lib/rubygems_plugin.rb
CHANGED
@@ -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.
|
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
|