gem-changelog 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: c3fba2a4c284b390225c93b92268324a90f8ad29
4
+ data.tar.gz: a2aaee8b1c55494685cb666cacf1f21338e48723
5
+ SHA512:
6
+ metadata.gz: 94403484c121e3ee0cebe301e73e614f2b3e9f305debe7ce6a2f2b981c616de265c826564c0d6bb07d1478b8c7608aa5571f92625bb8d334a587f96c60bd8f4b
7
+ data.tar.gz: ae20eda012e2f7cd254c26c170277129cb969e9246405ea7ad7d5e9cdaef3efd091a1e6ba6114e3992f9aa1f98709a88f1616d58f265df70aef1ba15d00f3ce9
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/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## 1.0.0 (2013-03-05)
2
+
3
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ source 'https://rubygems.org'
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 OZAWA Sakuro
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,39 @@
1
+ # Gem::Changelog
2
+
3
+ This gem add "changelog" subcommand to the rubygems system.
4
+
5
+ "changelog" subcommand displays the changelog of given gem, which must be
6
+ locally installed, on the terminal.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ gem 'gem-changelog'
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install gem-changelog
21
+
22
+ ## Usage
23
+
24
+ Say you want to read the changelog of bundler gem, run:
25
+
26
+ $ gem changelog bundler
27
+
28
+ If you want to examine any specific version, run with -v:
29
+
30
+ $ gem changelog bundler -v 1.3.0
31
+
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,3 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ require 'bundler/gem_tasks'
@@ -0,0 +1,23 @@
1
+ # -*- encoding: UTF-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'gem-changelog/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "gem-changelog"
8
+ spec.version = Gem::Changelog::VERSION
9
+ spec.authors = ["OZAWA Sakuro"]
10
+ spec.email = ["sakuro@2238club.org"]
11
+ spec.description = %q{This gem plugin add changelog subcommand to te gem system.}
12
+ spec.summary = %q{Show the changelog of given gem}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -0,0 +1,7 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ module Gem
4
+ module Changelog
5
+ VERSION = '1.0.0'
6
+ end
7
+ end
@@ -0,0 +1,75 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ require 'rubygems/command'
4
+
5
+ class Gem::Commands::ChangelogCommand < Gem::Command
6
+
7
+ def initialize
8
+ super 'changelog', 'Show the changelog of given gem'
9
+
10
+ add_option '-f CHANGELOG_NAME', 'Specify name of the changelog file' do |v|
11
+ options[:changelog_name] = v
12
+ end
13
+ add_option '-v VERSION', 'Specify version' do |v|
14
+ options[:version_requirement] = v
15
+ end
16
+ end
17
+
18
+ def execute
19
+ p options
20
+ args = options[:args]
21
+
22
+ gem_name = args.first
23
+ unless gem_name
24
+ show_help
25
+ terminate_interaction 1
26
+ end
27
+ version_requirement = options[:version_requirement]
28
+
29
+ begin
30
+ spec = Gem::Specification.find_by_name(gem_name, version_requirement)
31
+ rescue Gem::LoadError => e
32
+ say e.message
33
+ terminate_interaction 1
34
+ end
35
+
36
+ changelog_file = options[:changelog_name] || find_changelog_file(spec)
37
+ unless changelog_file
38
+ if files(spec.gem_dir).empty?
39
+ say('Changelog file could not be found.')
40
+ else
41
+ say('Changelog file could not be found. Try -f option with one of following file(s).')
42
+ files.each do |file|
43
+ say('- %s' % file)
44
+ end
45
+ end
46
+ terminate_interaction 1
47
+ end
48
+
49
+ system(pager, File.join(spec.gem_dir, changelog_file))
50
+ end
51
+
52
+ def usage
53
+ "#{program_name} GEM_NAME"
54
+ end
55
+
56
+ def arguments
57
+ 'GEM_NAME name of the gem to show'
58
+ end
59
+
60
+ private
61
+
62
+ CHANGELOG_RE = Regexp.union(/\ACHANGELOG\b/i, /\ACHANGES\b/i)
63
+
64
+ def files(dir)
65
+ Dir.entries(dir).select {|e| FileTest.file?(File.join(dir, e)) }
66
+ end
67
+
68
+ def find_changelog_file(spec)
69
+ files(spec.gem_dir).sort.find {|file| CHANGELOG_RE === file }
70
+ end
71
+
72
+ def pager
73
+ ENV['PAGER'] || 'more'
74
+ end
75
+ end
@@ -0,0 +1,4 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ require 'rubygems/command_manager'
4
+ Gem::CommandManager.instance.register_command :changelog
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gem-changelog
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - OZAWA Sakuro
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-03-04 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: This gem plugin add changelog subcommand to te gem system.
42
+ email:
43
+ - sakuro@2238club.org
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - CHANGELOG.md
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - gem-changelog.gemspec
55
+ - lib/gem-changelog/version.rb
56
+ - lib/rubygems/commands/changelog_command.rb
57
+ - lib/rubygems_plugin.rb
58
+ homepage: ''
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.0.0
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: Show the changelog of given gem
82
+ test_files: []