gem_lint 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/README.rdoc +1 -4
- data/lib/gem_lint/runner.rb +15 -1
- data/lib/rubygems/commands/lint_command.rb +29 -0
- metadata +4 -4
data/CHANGELOG
CHANGED
data/README.rdoc
CHANGED
@@ -12,6 +12,7 @@ personally.
|
|
12
12
|
|
13
13
|
gem install gem-lint
|
14
14
|
gem lint somefile-0.0.1.gem
|
15
|
+
gem lint somefile-0.0.1.gem --detailed
|
15
16
|
|
16
17
|
=== API
|
17
18
|
|
@@ -46,10 +47,6 @@ suit (using "rake") green.
|
|
46
47
|
|
47
48
|
Full source is on github at https://github.com/yob/gem-lint
|
48
49
|
|
49
|
-
== Ideas
|
50
|
-
|
51
|
-
* command for users to display extra info on a tag a gem failed
|
52
|
-
|
53
50
|
== Further Reading
|
54
51
|
|
55
52
|
* http://chneukirchen.github.com/rps/
|
data/lib/gem_lint/runner.rb
CHANGED
@@ -3,7 +3,8 @@
|
|
3
3
|
module GemLint
|
4
4
|
class Runner
|
5
5
|
|
6
|
-
attr_reader :tags, :
|
6
|
+
attr_reader :tags, :tags_with_desc, :tags_with_level
|
7
|
+
attr_reader :email, :name, :version
|
7
8
|
|
8
9
|
def initialize(filename)
|
9
10
|
raise ArgumentError, "'#{filename}' does not exist" unless File.file?(filename.to_s)
|
@@ -18,6 +19,7 @@ module GemLint
|
|
18
19
|
unpack_gem
|
19
20
|
@tags = collect_tags
|
20
21
|
@tags_with_level = collect_tags_with_level
|
22
|
+
@tags_with_desc = collect_tags_with_desc
|
21
23
|
@email = spec ? spec.email : nil
|
22
24
|
@name = spec ? spec.name : nil
|
23
25
|
@version = spec ? spec.version.to_s : nil
|
@@ -38,6 +40,18 @@ module GemLint
|
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
43
|
+
def collect_tags_with_desc
|
44
|
+
if unpack_successful?
|
45
|
+
failed_strategies.map { |s|
|
46
|
+
["#{s.level_char}: #{s.tag}", s.description]
|
47
|
+
}.sort_by { |arr|
|
48
|
+
arr.first
|
49
|
+
}
|
50
|
+
else
|
51
|
+
["E: unpack-failed", "There was an error unpacking the gem file"]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
41
55
|
def collect_tags_with_level
|
42
56
|
if unpack_successful?
|
43
57
|
failed_strategies.map { |s|
|
@@ -16,10 +16,39 @@ class Gem::Commands::LintCommand < Gem::Command
|
|
16
16
|
|
17
17
|
def initialize
|
18
18
|
super 'lint', description
|
19
|
+
|
20
|
+
add_option('-d', '--detailed', 'Display detailed output') do |value, opts|
|
21
|
+
options[:detailed] = true
|
22
|
+
end
|
19
23
|
end
|
20
24
|
|
21
25
|
def execute
|
22
26
|
runner = GemLint::Runner.new(get_one_gem_name)
|
27
|
+
|
28
|
+
if options[:detailed]
|
29
|
+
detailed_output(runner)
|
30
|
+
else
|
31
|
+
short_output(runner)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def detailed_output(runner)
|
38
|
+
if runner.tags.empty?
|
39
|
+
puts "No test failures!"
|
40
|
+
puts
|
41
|
+
else
|
42
|
+
runner.tags_with_desc.each do |tag, desc|
|
43
|
+
puts "- #{tag}"
|
44
|
+
puts " #{desc}"
|
45
|
+
end
|
46
|
+
puts
|
47
|
+
exit 1
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def short_output(runner)
|
23
52
|
if runner.tags.empty?
|
24
53
|
puts "No test failures!"
|
25
54
|
puts
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem_lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- James Healy
|
@@ -75,7 +75,7 @@ dependencies:
|
|
75
75
|
version: "2.0"
|
76
76
|
type: :development
|
77
77
|
version_requirements: *id004
|
78
|
-
description: Adds a 'lint' command rubygems that will
|
78
|
+
description: Adds a 'lint' command rubygems that will print a list of possible errors in a gem
|
79
79
|
email:
|
80
80
|
- james@yob.id.au
|
81
81
|
executables: []
|