rubygems-gman 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 752ce505aa9161ab73ffa1828d2656e7d228e563
4
+ data.tar.gz: 6ef2ae0f07e4592fc728e0f3a27ae016449c9d3c
5
+ SHA512:
6
+ metadata.gz: ecd08f03b1f50b0d48b0fe17ae67fb0c4c0f825147ef88269637c217ce26f6b6201756d9f839ed3e7846c77f5a2761db10082e6634d986141c3fc1fd84b0a1a9
7
+ data.tar.gz: c9e0bd148723ea02f859800d1ec3f2387df7745afaaefa296efa31aa615b2d4745cee1b6dbfc412251f9407a393976dc32ea2df5ceeda0fcaf99c0c1a86b1272
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Calle Erlandsson
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ rubygems-gman
2
+ =============
3
+
4
+ Generate and install man pages for installed gems.
5
+
6
+ Installation
7
+ ------------
8
+
9
+ Install the `rubygems-gman` gem using `gem`:
10
+
11
+ $ gem install rubygems-gman
12
+
13
+ Usage
14
+ -----
15
+
16
+ After installing the `rubygems-gman` gem, man pages will automatically be
17
+ generated and installed when installing new gems using `gem install`. The below
18
+ commands can be used to generate or regenerate and install man pages after
19
+ installing a new version of `rubygems-gman`.
20
+
21
+ Generate and install man pages for all currently installed gems:
22
+
23
+ $ gem gman
24
+
25
+ Generate and install man pages for a specific gem:
26
+
27
+ $ gem gman GEM
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,58 @@
1
+ require "rubygems/command"
2
+ require "rdoc"
3
+ require "rdoc/generator/mdoc"
4
+
5
+ class Gem::Commands::GmanCommand < Gem::Command
6
+ def initialize
7
+ super "gman", "Generate and install man pages for gems"
8
+ end
9
+
10
+ def usage
11
+ "gem gman [GEMNAME]"
12
+ end
13
+
14
+ def arguments
15
+ "GEMNAME name of gem to generate man pages for"
16
+ end
17
+
18
+ def execute
19
+ if name = get_one_optional_argument
20
+ document_gem_with_name name
21
+ else
22
+ document_all_gems
23
+ end
24
+ end
25
+
26
+ def document(gem)
27
+ say "Generating man pages for #{gem.full_name}..."
28
+ RDoc::RDoc.new.document [
29
+ "-q",
30
+ "-f", "mdoc",
31
+ "--section", "#{mandb_section(gem)}",
32
+ "-o", "#{output_directory}",
33
+ *Dir.glob(gem.lib_dirs_glob),
34
+ ]
35
+ rescue => exception
36
+ say "Failed to generate man pages for #{gem.full_name} (#{exception})."
37
+ end
38
+
39
+ private
40
+
41
+ def document_gem_with_name(name)
42
+ document Gem::Specification.find_by_name(name)
43
+ rescue Gem::LoadError
44
+ say "Could not find a gem with the name \"#{name}\"."
45
+ end
46
+
47
+ def document_all_gems
48
+ Gem::Specification.each { |gem| document gem }
49
+ end
50
+
51
+ def output_directory
52
+ File.join(Dir.home, ".man")
53
+ end
54
+
55
+ def mandb_section(gem)
56
+ "3-rubygems-#{gem.name}-#{gem.version.to_s.gsub(".", "-")}"
57
+ end
58
+ end
@@ -0,0 +1,8 @@
1
+ require "rubygems/command_manager"
2
+ require "rubygems/commands/gman_command"
3
+
4
+ Gem::CommandManager.instance.register_command :gman
5
+
6
+ Gem.post_install do |installer|
7
+ Gem::Commands::GmanCommand.new.document(installer.spec)
8
+ end
@@ -0,0 +1,19 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = "rubygems-gman"
6
+ spec.version = "0.0.1"
7
+ spec.authors = ["Calle Erlandsson"]
8
+ spec.email = ["calle@thoughtbot.com", "hello@thoughtbot.com"]
9
+ spec.summary = "Generate and install man pages for installed gems."
10
+ spec.homepage = "https://github.com/thoughtbot/rubygems-gman"
11
+ spec.license = "MIT"
12
+ spec.files = `git ls-files -z`.split("\x0")
13
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
14
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
+ spec.require_paths = ["lib"]
16
+ spec.add_development_dependency "bundler", "~> 1.6"
17
+ spec.add_development_dependency "rake", "~> 10.0"
18
+ spec.add_dependency "rdoc-generator-mdoc"
19
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubygems-gman
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Calle Erlandsson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rdoc-generator-mdoc
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description:
56
+ email:
57
+ - calle@thoughtbot.com
58
+ - hello@thoughtbot.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - lib/rubygems/commands/gman_command.rb
69
+ - lib/rubygems_plugin.rb
70
+ - rubygems-gman.gemspec
71
+ homepage: https://github.com/thoughtbot/rubygems-gman
72
+ licenses:
73
+ - MIT
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.2.2
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Generate and install man pages for installed gems.
95
+ test_files: []
96
+ has_rdoc: