lint_report 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/README +23 -0
- data/bin/lint_report +8 -0
- data/lib/lint_report.rb +3 -0
- data/lib/lint_report/app.rb +132 -0
- metadata +134 -0
data/CHANGELOG
ADDED
data/README
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
= LintReport
|
2
|
+
|
3
|
+
Runs the GemLint suite of checks against the latest version of all rubygems
|
4
|
+
available on rubygems.org.
|
5
|
+
|
6
|
+
Operates in a two stage process:
|
7
|
+
|
8
|
+
* stage one downloads the latest version of all gems and generate a machine
|
9
|
+
parsable text file with failure data
|
10
|
+
* stage two parses the output from stage one and generates reports.
|
11
|
+
|
12
|
+
Only stage one is implemented, so second stage analysis is limited to grepping
|
13
|
+
the output log.
|
14
|
+
|
15
|
+
== Usage
|
16
|
+
|
17
|
+
gem install lint_report
|
18
|
+
lint_report --cachedir ~/gems --output data.log
|
19
|
+
lint_website --data data.log --site ~/site
|
20
|
+
|
21
|
+
== Status
|
22
|
+
|
23
|
+
This is still a work in progress, proceed with caution.
|
data/bin/lint_report
ADDED
data/lib/lint_report.rb
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require "singleton"
|
4
|
+
require "open-uri"
|
5
|
+
require "trollop"
|
6
|
+
require "zlib"
|
7
|
+
require "fileutils"
|
8
|
+
require "ostruct"
|
9
|
+
require "thread"
|
10
|
+
require "gem_lint"
|
11
|
+
|
12
|
+
module LintReport
|
13
|
+
class App
|
14
|
+
include Singleton
|
15
|
+
|
16
|
+
def self.run
|
17
|
+
self.instance.run
|
18
|
+
end
|
19
|
+
|
20
|
+
def run
|
21
|
+
verify_options
|
22
|
+
start_workers
|
23
|
+
download_new_gems
|
24
|
+
while download_queue.size > 0
|
25
|
+
sleep 0.5
|
26
|
+
end
|
27
|
+
remove_old_gems
|
28
|
+
analyse_gems
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def verify_options
|
34
|
+
if options[:output].nil?
|
35
|
+
$stderr.puts "--output must be provided"
|
36
|
+
exit 1
|
37
|
+
end
|
38
|
+
if options[:cachedir].nil?
|
39
|
+
$stderr.puts "--cachedir must be provided"
|
40
|
+
exit 1
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def download_queue
|
45
|
+
@download_queue ||= SizedQueue.new(100)
|
46
|
+
end
|
47
|
+
|
48
|
+
def start_workers
|
49
|
+
download_queue
|
50
|
+
|
51
|
+
10.times do
|
52
|
+
Thread.new do
|
53
|
+
while item = download_queue.pop
|
54
|
+
`wget -O #{item.path} #{item.url} > /dev/null 2>&1`
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def download_new_gems
|
61
|
+
FileUtils.mkdir_p(cachedir)
|
62
|
+
urls.each do |filename, url|
|
63
|
+
path = File.join(cachedir, filename)
|
64
|
+
if !File.file?(path) || File.size(path) == 0
|
65
|
+
download_queue.push(OpenStruct.new(:url => url, :path => path))
|
66
|
+
end
|
67
|
+
end
|
68
|
+
10.times do
|
69
|
+
download_queue.push(:finished)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def remove_old_gems
|
74
|
+
FileUtils.mkdir_p(cachedir)
|
75
|
+
Dir.entries(cachedir).each do |basename|
|
76
|
+
if basename[0,1] != "." && !filenames.include?(basename)
|
77
|
+
path = File.join(cachedir, basename)
|
78
|
+
FileUtils.rm(path)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def analyse_gems
|
84
|
+
File.open(output_file, "w") do |f|
|
85
|
+
Dir.entries(cachedir).sort.each do |basename|
|
86
|
+
if basename[0,1] != "."
|
87
|
+
path = File.join(cachedir, basename)
|
88
|
+
f.write(GemLint::Runner.new(path).to_s(:detailed) + "\n")
|
89
|
+
f.flush
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def index
|
96
|
+
data = Zlib::GzipReader.new(open("http://rubygems.org/latest_specs.4.8.gz")).read
|
97
|
+
Marshal.load(data)
|
98
|
+
end
|
99
|
+
|
100
|
+
def filenames
|
101
|
+
@filenames ||= index.map { |row|
|
102
|
+
if row[2] == "ruby"
|
103
|
+
"#{row[0]}-#{row[1]}.gem"
|
104
|
+
else
|
105
|
+
"#{row[0]}-#{row[1]}-#{row[2]}.gem"
|
106
|
+
end
|
107
|
+
}
|
108
|
+
end
|
109
|
+
|
110
|
+
def urls
|
111
|
+
@urls ||= Hash[
|
112
|
+
*filenames.zip(filenames.map { |f| "http://rubygems.org/downloads/#{f}"}).flatten
|
113
|
+
]
|
114
|
+
end
|
115
|
+
|
116
|
+
def cachedir
|
117
|
+
@cachedir ||= File.expand_path(options[:cachedir])
|
118
|
+
end
|
119
|
+
|
120
|
+
def output_file
|
121
|
+
@output_file ||= File.expand_path(options[:output])
|
122
|
+
end
|
123
|
+
|
124
|
+
def options
|
125
|
+
@options ||= opts = Trollop::options do
|
126
|
+
opt :output, "Output filename", :type => :string
|
127
|
+
opt :cachedir, "Directory to cache downloaded gems", :type => :string
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
132
|
+
end
|
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lint_report
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- James Healy
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-12-21 00:00:00 +11:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: gem_lint
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 23
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 0
|
33
|
+
- 4
|
34
|
+
version: 0.0.4
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rake
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
version: "0"
|
49
|
+
type: :development
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: roodi
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
version: "0"
|
63
|
+
type: :development
|
64
|
+
version_requirements: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: rspec
|
67
|
+
prerelease: false
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ~>
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
74
|
+
segments:
|
75
|
+
- 2
|
76
|
+
- 0
|
77
|
+
version: "2.0"
|
78
|
+
type: :development
|
79
|
+
version_requirements: *id004
|
80
|
+
description: collates the output generated by running gem_lint against the most recent version of every public gem.
|
81
|
+
email:
|
82
|
+
- james@yob.id.au
|
83
|
+
executables:
|
84
|
+
- lint_report
|
85
|
+
extensions: []
|
86
|
+
|
87
|
+
extra_rdoc_files: []
|
88
|
+
|
89
|
+
files:
|
90
|
+
- lib/lint_report/app.rb
|
91
|
+
- lib/lint_report.rb
|
92
|
+
- bin/lint_report
|
93
|
+
- README
|
94
|
+
- CHANGELOG
|
95
|
+
has_rdoc: true
|
96
|
+
homepage: http://github.com/yob/lint_report
|
97
|
+
licenses: []
|
98
|
+
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options:
|
101
|
+
- --title
|
102
|
+
- Lint Report
|
103
|
+
- --line-numbers
|
104
|
+
require_paths:
|
105
|
+
- lib
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
hash: 3
|
112
|
+
segments:
|
113
|
+
- 0
|
114
|
+
version: "0"
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
hash: 31
|
121
|
+
segments:
|
122
|
+
- 1
|
123
|
+
- 3
|
124
|
+
- 2
|
125
|
+
version: 1.3.2
|
126
|
+
requirements: []
|
127
|
+
|
128
|
+
rubyforge_project:
|
129
|
+
rubygems_version: 1.3.7
|
130
|
+
signing_key:
|
131
|
+
specification_version: 3
|
132
|
+
summary: Run gem_lint against the complete rubygems archive
|
133
|
+
test_files: []
|
134
|
+
|