appraiser 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.rspec +1 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +20 -0
- data/README.md +39 -0
- data/Rakefile +2 -0
- data/appraiser.gemspec +25 -0
- data/bin/appraiser +13 -0
- data/lib/appraiser.rb +79 -0
- data/lib/appraiser/version.rb +14 -0
- data/spec/appraiser_spec.rb +7 -0
- data/spec/spec_helper.rb +12 -0
- metadata +112 -0
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Junya Ogura
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
Appraiser = a simple command line utility for gem paranoia
|
2
|
+
==========================================================
|
3
|
+
|
4
|
+
`appraiser` displays gem information from `./Gemfile`.
|
5
|
+
|
6
|
+
Like this:
|
7
|
+
|
8
|
+
![Screenshot](http://farm6.static.flickr.com/5026/5643970264_2b995ed4b1.jpg)
|
9
|
+
|
10
|
+
|
11
|
+
Install
|
12
|
+
-------
|
13
|
+
|
14
|
+
$ gem install appraiser
|
15
|
+
|
16
|
+
|
17
|
+
Usage
|
18
|
+
-----
|
19
|
+
|
20
|
+
Appraiser normally displays runtime dependencies.
|
21
|
+
|
22
|
+
$ cd /path/to/project_with_Gemfile/
|
23
|
+
$ appraiser
|
24
|
+
|
25
|
+
or, displays other dependencies with `-g GROUP`.
|
26
|
+
|
27
|
+
$ appraiser -g development
|
28
|
+
|
29
|
+
|
30
|
+
Contributing
|
31
|
+
------------
|
32
|
+
|
33
|
+
Once you've made your great commits: Fork, fix, then send me a pull request.
|
34
|
+
|
35
|
+
|
36
|
+
Copyright
|
37
|
+
---------
|
38
|
+
|
39
|
+
Copyright (c) 2011 Junya Ogura. See LICENSE.txt for further details.
|
data/Rakefile
ADDED
data/appraiser.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "appraiser/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "appraiser"
|
7
|
+
s.version = Appraiser::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Junya Ogura"]
|
10
|
+
s.email = ["junyaogura@gmail.com"]
|
11
|
+
s.homepage = "https://github.com/juno/appraiser"
|
12
|
+
s.summary = %q{`appraiser` is a simple command line utility for gem paranoia.}
|
13
|
+
s.description = %q{`appraiser` is a command line utility which displays gem information in `./Gemfile`.}
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
|
20
|
+
s.add_dependency('bundler', ['~> 1.0'])
|
21
|
+
s.add_dependency('colored', ['~> 1.2'])
|
22
|
+
s.add_dependency('slop', ['~> 1.5'])
|
23
|
+
|
24
|
+
s.add_development_dependency('rspec', ['~> 2.3'])
|
25
|
+
end
|
data/bin/appraiser
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# = appraiser(1)
|
4
|
+
#
|
5
|
+
# == USAGE
|
6
|
+
# appraiser # with ./Gemfile
|
7
|
+
#
|
8
|
+
# == INSTALL
|
9
|
+
# gem install appraiser
|
10
|
+
|
11
|
+
$:.unshift(File.expand_path('../../lib', __FILE__)) if $0 == __FILE__
|
12
|
+
require 'appraiser'
|
13
|
+
Appraiser.execute(*ARGV)
|
data/lib/appraiser.rb
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'bundler'
|
4
|
+
require 'colored'
|
5
|
+
require 'json'
|
6
|
+
require 'open-uri'
|
7
|
+
require 'slop'
|
8
|
+
|
9
|
+
require 'appraiser/version'
|
10
|
+
|
11
|
+
module Appraiser
|
12
|
+
extend self
|
13
|
+
|
14
|
+
RUBY_GEMS_URL = 'http://rubygems.org/api/v1/gems/%s.json'
|
15
|
+
LINE = '-' * 60
|
16
|
+
|
17
|
+
def execute(*args)
|
18
|
+
opts = Slop.parse do
|
19
|
+
on :g, :group, 'Group', true
|
20
|
+
end
|
21
|
+
|
22
|
+
group = opts.group? ? opts[:group].to_sym : :default
|
23
|
+
|
24
|
+
dependencies_for(group).each do |dependency|
|
25
|
+
json = load_json(dependency.name)
|
26
|
+
|
27
|
+
if json.empty?
|
28
|
+
puts dependency.name.green
|
29
|
+
puts "Source : #{dependency.source.to_s.cyan.underline}"
|
30
|
+
else
|
31
|
+
name = json['name']
|
32
|
+
authors = json['authors']
|
33
|
+
downloads = number_with_delimiter(json['downloads'])
|
34
|
+
project_uri = json['project_uri']
|
35
|
+
doc_uri = json['documentation_uri']
|
36
|
+
src_uri = json['source_code_uri']
|
37
|
+
info = json['info'].split("\n").first.strip
|
38
|
+
|
39
|
+
puts "#{name.green} (by #{authors})"
|
40
|
+
puts "Downloads: #{downloads.blue}"
|
41
|
+
puts "Project : #{project_uri.cyan.underline}" if project_uri
|
42
|
+
puts "Document : #{doc_uri.cyan.underline}" if doc_uri
|
43
|
+
puts "Source : #{src_uri.cyan.underline}" if src_uri
|
44
|
+
puts info
|
45
|
+
end
|
46
|
+
|
47
|
+
puts LINE
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
# @param [String] gem_name
|
54
|
+
# @return [Hash]
|
55
|
+
def load_json(gem_name)
|
56
|
+
JSON.parse(open(RUBY_GEMS_URL % gem_name).read)
|
57
|
+
rescue OpenURI::HTTPError => e
|
58
|
+
{}
|
59
|
+
end
|
60
|
+
|
61
|
+
# @param [Symbol] group
|
62
|
+
# @return [Array<Bundler::Dependency>]
|
63
|
+
def dependencies_for(group)
|
64
|
+
Bundler.definition.dependencies.select{ |i| i.groups.include? group }
|
65
|
+
end
|
66
|
+
|
67
|
+
# @param [Integer] number
|
68
|
+
# @param [String] delimiter
|
69
|
+
# @param [String] separator
|
70
|
+
# @return [String]
|
71
|
+
def number_with_delimiter(number, delimiter = ',', separator = '.')
|
72
|
+
parts = number.to_s.split('.')
|
73
|
+
parts[0].gsub!(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{delimiter}")
|
74
|
+
parts.join separator
|
75
|
+
rescue
|
76
|
+
number.to_s
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
|
+
|
6
|
+
require 'rspec'
|
7
|
+
require 'appraiser'
|
8
|
+
|
9
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: appraiser
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.2
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Junya Ogura
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-04-23 00:00:00 +09:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: bundler
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "1.0"
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: colored
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ~>
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: "1.2"
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: slop
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "1.5"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rspec
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ~>
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: "2.3"
|
58
|
+
type: :development
|
59
|
+
version_requirements: *id004
|
60
|
+
description: `appraiser` is a command line utility which displays gem information in `./Gemfile`.
|
61
|
+
email:
|
62
|
+
- junyaogura@gmail.com
|
63
|
+
executables:
|
64
|
+
- appraiser
|
65
|
+
extensions: []
|
66
|
+
|
67
|
+
extra_rdoc_files: []
|
68
|
+
|
69
|
+
files:
|
70
|
+
- .gitignore
|
71
|
+
- .rspec
|
72
|
+
- Gemfile
|
73
|
+
- LICENSE.txt
|
74
|
+
- README.md
|
75
|
+
- Rakefile
|
76
|
+
- appraiser.gemspec
|
77
|
+
- bin/appraiser
|
78
|
+
- lib/appraiser.rb
|
79
|
+
- lib/appraiser/version.rb
|
80
|
+
- spec/appraiser_spec.rb
|
81
|
+
- spec/spec_helper.rb
|
82
|
+
has_rdoc: true
|
83
|
+
homepage: https://github.com/juno/appraiser
|
84
|
+
licenses: []
|
85
|
+
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: "0"
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: "0"
|
103
|
+
requirements: []
|
104
|
+
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 1.6.2
|
107
|
+
signing_key:
|
108
|
+
specification_version: 3
|
109
|
+
summary: `appraiser` is a simple command line utility for gem paranoia.
|
110
|
+
test_files:
|
111
|
+
- spec/appraiser_spec.rb
|
112
|
+
- spec/spec_helper.rb
|