gem-readme 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2495001a3130eec6372d5200c1efb03d46a67c89
4
+ data.tar.gz: bf2a4ad1fd309dd4df137c3076ceb658a52476d7
5
+ SHA512:
6
+ metadata.gz: e8053aa7f21b6cba8c0c1bd978a8ee4d3c6c0781b0a786228e9333e7af0f3f4c2217268f4d202af7915af11f087b39965c4586f03ebca53653ffb47a129f9f1a
7
+ data.tar.gz: eb65d87ad217b26a922da1589abb82b4aaa9e268ce8e2c163e0000dca8edc83d0c3b40bd7863b761ae0bf036f9b1d99eb04048b9de01bb0e05ebc5322fc2b084
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in gem-readme.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Brian Thomas Storti
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,22 @@
1
+ # gem-readme
2
+
3
+ Your gems' README, right in your terminal, 'cuz life is too short to be wasted in a browser.
4
+
5
+ ## Installation
6
+
7
+ As simples as it can be: `gem install gem-readme`
8
+
9
+ ## Usage
10
+
11
+ Just type `gem readme [GEMNAME]` in your terminal. If you have multiple versions of this gem installed, you can choose the specific version.
12
+ Your `$README_EDITOR`, `$EDITOR` or `less` will be opened with the desired README file.
13
+
14
+ ## License
15
+
16
+ Copyright (c) 2013 Brian Thomas Storti
17
+
18
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "gem-readme"
7
+ spec.version = "1.0.0"
8
+ spec.authors = ["Brian Thomas Storti"]
9
+ spec.email = ["btstorti@gmail.com"]
10
+ spec.description = %q{Read a gem's README file directlty in your terminal}
11
+ spec.summary = %q{Read a gem's README file directlty in your terminal}
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.3"
21
+ spec.add_development_dependency "rake"
22
+ end
@@ -0,0 +1,42 @@
1
+ class Gem::Commands::ReadmeCommand < Gem::Command
2
+ def initialize
3
+ super("readme",
4
+ "Open the README file of a given gem",
5
+ editor: ENV["README_EDITOR"] || ENV["EDITOR"] || "less")
6
+ end
7
+
8
+ def execute
9
+ gem_specification = get_gem_specification
10
+
11
+ if gem_specification.nil?
12
+ say "Gem not found."
13
+ raise Gem::SystemExitException, 1
14
+ end
15
+
16
+ gem_path = gem_specification.full_gem_path
17
+ system "#{options[:editor]} $(find #{gem_path} -type f -iname 'readme.*')"
18
+ end
19
+
20
+ def get_gem_specification
21
+ gem_name, _ = options[:args]
22
+ specifications = Gem::Specification.each.select { |spec| spec.name == gem_name }
23
+
24
+ return if specifications.empty?
25
+ return specifications.first if specifications.size == 1
26
+
27
+ ask_for_specific_version(specifications)
28
+ end
29
+ private :get_gem_specification
30
+
31
+ def ask_for_specific_version(gem_specifications)
32
+ say("Choose a version:")
33
+ gem_specifications.each_with_index do |gem_specification, index|
34
+ say("[#{index}] #{gem_specification.version}")
35
+ end
36
+
37
+ print ">> "
38
+ index = STDIN.getc.to_i
39
+ gem_specifications[index]
40
+ end
41
+ private :ask_for_specific_version
42
+ end
@@ -0,0 +1,6 @@
1
+ require "rubygems/version"
2
+ require 'rubygems/command_manager'
3
+ require 'rubygems/version_option'
4
+ require 'rubygems/gem/specification'
5
+
6
+ Gem::CommandManager.instance.register_command :readme
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gem-readme
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Brian Thomas Storti
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-18 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.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Read a gem's README file directlty in your terminal
42
+ email:
43
+ - btstorti@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - gem-readme.gemspec
54
+ - lib/rubygems/commands/readme_command.rb
55
+ - lib/rubygems_plugin.rb
56
+ homepage: ''
57
+ licenses:
58
+ - MIT
59
+ metadata: {}
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project:
76
+ rubygems_version: 2.0.3
77
+ signing_key:
78
+ specification_version: 4
79
+ summary: Read a gem's README file directlty in your terminal
80
+ test_files: []