gem_readme 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,22 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
22
+ *.gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 jugyo
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,15 @@
1
+ = gem_readme
2
+
3
+ The 'gem readme' command that open gem's README.
4
+
5
+ == Synopsis
6
+
7
+ gem readme GEMNAME
8
+
9
+ == See Also
10
+
11
+ * http://github.com/lmarlow/gemedit
12
+
13
+ == Copyright
14
+
15
+ Copyright (c) 2010 jugyo. See LICENSE for details.
@@ -0,0 +1,19 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "gem_readme"
8
+ gem.summary = %Q{gem readme}
9
+ gem.description = %Q{The 'gem readme' command open REAME file of specified gem.}
10
+ gem.email = "jugyo.org@gmail.com"
11
+ gem.homepage = "http://github.com/jugyo/gem_readme"
12
+ gem.authors = ["jugyo"]
13
+ gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
14
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
+ end
16
+ Jeweler::GemcutterTasks.new
17
+ rescue LoadError
18
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,61 @@
1
+ require 'rubygems/command'
2
+ require 'rubygems/version_option'
3
+
4
+ class Gem::Commands::ReadmeCommand < Gem::Command
5
+
6
+ OPTIONS = {
7
+ :version => Gem::Requirement.default,
8
+ :editor => 'less'
9
+ }
10
+
11
+ include Gem::VersionOption
12
+
13
+ def initialize
14
+ super 'readme', 'Open a README of an installed gem', OPTIONS
15
+
16
+ add_version_option
17
+
18
+ add_option('-e', '--editor EDITOR', String,
19
+ 'The editor to use to open the gems',
20
+ "Default: #{OPTIONS[:editor]}") do |editor, options|
21
+ options[:editor] = editor
22
+ end
23
+ end
24
+
25
+ def arguments # :nodoc:
26
+ "GEMNAME name of gem to open README"
27
+ end
28
+
29
+ def defaults_str # :nodoc:
30
+ "--version '#{OPTIONS[:version]}' --editor #{OPTIONS[:editor]}"
31
+ end
32
+
33
+ def usage # :nodoc:
34
+ "#{program_name} [options] GEMNAME [GEMNAME ...]"
35
+ end
36
+
37
+ def execute
38
+ version = options[:version] || OPTIONS[:version]
39
+
40
+ gem_specs = get_all_gem_names.map { |gem_name| Gem.source_index.find_name(gem_name, version).last }.compact
41
+
42
+ if gem_specs.size > 0
43
+ paths = gem_specs.map { |spec| spec.full_gem_path }
44
+
45
+ readmes = paths.inject([]) do |result, path|
46
+ result + Dir[File.join(path, '*')].select{ |i| File.basename(i) =~ /^readme/i }
47
+ end
48
+
49
+ if readmes.empty?
50
+ say "README not found!"
51
+ exit!
52
+ end
53
+
54
+ cmd = "#{options[:editor]} #{readmes.join(' ')}"
55
+ exec cmd unless options[:dryrun]
56
+ else
57
+ say "No gems found for #{get_all_gem_names.join(', ')}"
58
+ raise Gem::SystemExitException, 1
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,4 @@
1
+ require 'rubygems/command_manager'
2
+
3
+ require 'gem_readme/readme_command'
4
+ Gem::CommandManager.instance.register_command :readme
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gem_readme
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - jugyo
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-07-16 00:00:00 +09:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: thoughtbot-shoulda
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :development
31
+ version_requirements: *id001
32
+ description: The 'gem readme' command open REAME file of specified gem.
33
+ email: jugyo.org@gmail.com
34
+ executables: []
35
+
36
+ extensions: []
37
+
38
+ extra_rdoc_files:
39
+ - LICENSE
40
+ - README.rdoc
41
+ files:
42
+ - .document
43
+ - .gitignore
44
+ - LICENSE
45
+ - README.rdoc
46
+ - Rakefile
47
+ - VERSION
48
+ - lib/gem_readme/readme_command.rb
49
+ - lib/rubygems_plugin.rb
50
+ has_rdoc: true
51
+ homepage: http://github.com/jugyo/gem_readme
52
+ licenses: []
53
+
54
+ post_install_message:
55
+ rdoc_options:
56
+ - --charset=UTF-8
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ segments:
64
+ - 0
65
+ version: "0"
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ segments:
71
+ - 0
72
+ version: "0"
73
+ requirements: []
74
+
75
+ rubyforge_project:
76
+ rubygems_version: 1.3.6
77
+ signing_key:
78
+ specification_version: 3
79
+ summary: gem readme
80
+ test_files: []
81
+