gauntlet 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +11 -0
- data/Manifest.txt +1 -0
- data/Rakefile +7 -5
- data/bin/gauntlet +88 -2
- data/lib/gauntlet.rb +30 -15
- data/lib/gauntlet_grep.rb +23 -0
- metadata +33 -7
- metadata.gz.sig +0 -0
data.tar.gz.sig
ADDED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
=== 1.1.0 / 2009-06-23
|
2
|
+
|
3
|
+
* 6 minor enhancements:
|
4
|
+
|
5
|
+
* Added update command
|
6
|
+
* Added example plugin lib/gauntlet_grep.rb
|
7
|
+
* Added subcommands: help list report
|
8
|
+
* Cleaned output
|
9
|
+
* Updated to new hoe capabilities
|
10
|
+
* gauntlet now runs in a unique subdirectory, so multiple can run at once
|
11
|
+
|
1
12
|
=== 1.0.0 / 2008-12-04
|
2
13
|
|
3
14
|
* 1 major enhancement
|
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
@@ -2,11 +2,13 @@
|
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'hoe'
|
5
|
-
require './lib/gauntlet.rb'
|
6
5
|
|
7
|
-
Hoe.
|
8
|
-
|
9
|
-
|
6
|
+
Hoe.plugin :seattlerb
|
7
|
+
|
8
|
+
Hoe.spec 'gauntlet' do
|
9
|
+
developer 'Ryan Davis', 'ryand-ruby@zenspider.com'
|
10
|
+
|
11
|
+
self.rubyforge_name = 'seattlerb'
|
10
12
|
end
|
11
13
|
|
12
|
-
# vim: syntax=
|
14
|
+
# vim: syntax=ruby
|
data/bin/gauntlet
CHANGED
@@ -8,5 +8,91 @@ end
|
|
8
8
|
|
9
9
|
name = ARGV.shift
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
gauntlet_dir = File.expand_path("~/.gauntlet/data")
|
12
|
+
|
13
|
+
case name
|
14
|
+
when "help" then
|
15
|
+
require 'rubygems'
|
16
|
+
|
17
|
+
puts "gauntlet cmd"
|
18
|
+
puts " cmds:"
|
19
|
+
puts " help - show help"
|
20
|
+
puts " list - list known gauntlet data for reports"
|
21
|
+
puts " report <name> - show a report on <name>, requires specific data format"
|
22
|
+
puts " <name> - run the gauntlet for named plugin"
|
23
|
+
Gem.find_files('gauntlet_*.rb').each do |path|
|
24
|
+
name = File.basename(path, ".rb").sub(/gauntlet_/, '')
|
25
|
+
puts " %-13s - a known plugin" % name
|
26
|
+
end
|
27
|
+
when "update" then
|
28
|
+
require 'gauntlet'
|
29
|
+
$u = true
|
30
|
+
Gauntlet.new.update_gem_tarballs
|
31
|
+
when "list" then
|
32
|
+
puts "Gauntlet Data:"
|
33
|
+
puts
|
34
|
+
Dir.chdir gauntlet_dir do
|
35
|
+
puts Dir["*.yml"].map { |s| s.sub(/-data.yml/, '') }.join("\n")
|
36
|
+
end
|
37
|
+
when "report" then
|
38
|
+
require 'yaml'
|
39
|
+
|
40
|
+
name = ARGV.shift
|
41
|
+
abort "need a name to report on" unless name
|
42
|
+
path = File.join gauntlet_dir, "#{name}-data.yml"
|
43
|
+
data = YAML.load File.read(path)
|
44
|
+
|
45
|
+
paths = Hash.new 0
|
46
|
+
names = Hash.new 0
|
47
|
+
good = bad = skip = 0
|
48
|
+
|
49
|
+
data.each do |project, files|
|
50
|
+
if files == true then
|
51
|
+
good += 1
|
52
|
+
next
|
53
|
+
end
|
54
|
+
files.each do |path, result|
|
55
|
+
case result
|
56
|
+
when true then
|
57
|
+
good += 1
|
58
|
+
next
|
59
|
+
when Symbol then
|
60
|
+
skip += 1
|
61
|
+
next
|
62
|
+
when String then
|
63
|
+
bad += 1
|
64
|
+
|
65
|
+
names[File.basename(path)] += 1
|
66
|
+
|
67
|
+
loop do
|
68
|
+
path = File.dirname path
|
69
|
+
break if path.empty? or path == "."
|
70
|
+
paths[path] += 1
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def top_n ary, n = 20
|
77
|
+
ary.sort_by { |k,v| -v }.first(n).each do |path, count|
|
78
|
+
puts "%5d: %s" % [count, path]
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def table name, n, t
|
83
|
+
puts "%6d %5.2f%% %s" % [n, n / t * 100, name]
|
84
|
+
end
|
85
|
+
|
86
|
+
total = good + bad + skip.to_f
|
87
|
+
|
88
|
+
table "good", good, total
|
89
|
+
table "bad", bad, total
|
90
|
+
table "skip", skip, total
|
91
|
+
puts
|
92
|
+
top_n paths
|
93
|
+
puts
|
94
|
+
top_n names
|
95
|
+
else
|
96
|
+
require "rubygems"
|
97
|
+
require "gauntlet_#{name}"
|
98
|
+
end
|
data/lib/gauntlet.rb
CHANGED
@@ -9,7 +9,7 @@ $F ||= false
|
|
9
9
|
Thread.abort_on_exception = true
|
10
10
|
|
11
11
|
class Gauntlet
|
12
|
-
VERSION = '1.
|
12
|
+
VERSION = '1.1.0'
|
13
13
|
|
14
14
|
GEMURL = URI.parse 'http://gems.rubyforge.org'
|
15
15
|
GEMDIR = File.expand_path "~/.gauntlet"
|
@@ -52,13 +52,15 @@ class Gauntlet
|
|
52
52
|
def source_index
|
53
53
|
@index ||= in_gem_dir do
|
54
54
|
dump = if ($u and not $F) or not File.exist? '.source_index' then
|
55
|
+
warn "fetching and caching gem index"
|
55
56
|
url = GEMURL + "Marshal.#{Gem.marshal_version}.Z"
|
56
57
|
dump = Gem::RemoteFetcher.fetcher.fetch_path url
|
57
|
-
require 'zlib'
|
58
|
+
require 'zlib' # HACK for rubygems :(
|
58
59
|
dump = Gem.inflate dump
|
59
60
|
open '.source_index', 'wb' do |io| io.write dump end
|
60
61
|
dump
|
61
62
|
else
|
63
|
+
warn "using cached gem index"
|
62
64
|
open '.source_index', 'rb' do |io| io.read end
|
63
65
|
end
|
64
66
|
|
@@ -116,7 +118,7 @@ class Gauntlet
|
|
116
118
|
|
117
119
|
latest = self.latest_gems
|
118
120
|
|
119
|
-
|
121
|
+
warn "updating mirror"
|
120
122
|
|
121
123
|
in_gem_dir do
|
122
124
|
gems = Dir["*.gem"]
|
@@ -124,7 +126,7 @@ class Gauntlet
|
|
124
126
|
|
125
127
|
old = tgzs - latest.map { |spec| "#{spec.full_name}.tgz" }
|
126
128
|
unless old.empty? then
|
127
|
-
|
129
|
+
warn "deleting #{old.size} tgzs"
|
128
130
|
old.each do |tgz|
|
129
131
|
File.unlink tgz
|
130
132
|
end
|
@@ -135,24 +137,24 @@ class Gauntlet
|
|
135
137
|
latest.reject! { |spec| tgzs.include? "#{spec.full_name}.tgz" }
|
136
138
|
tasks.push(latest.shift) until latest.empty? # LAME
|
137
139
|
|
138
|
-
|
140
|
+
warn "fetching #{tasks.size} gems"
|
139
141
|
|
140
142
|
threads = []
|
141
143
|
10.times do
|
142
144
|
threads << Thread.new do
|
143
145
|
fetcher = Gem::RemoteFetcher.new nil # fuck proxies
|
144
146
|
until tasks.empty? do
|
145
|
-
spec
|
147
|
+
spec = tasks.shift
|
146
148
|
full_name = spec.full_name
|
147
|
-
tgz_name
|
148
|
-
gem_name
|
149
|
+
tgz_name = "#{full_name}.tgz"
|
150
|
+
gem_name = "#{full_name}.gem"
|
149
151
|
|
150
152
|
unless gems.include? gem_name then
|
151
153
|
begin
|
152
|
-
warn "downloading
|
154
|
+
warn "downloading #{full_name}"
|
153
155
|
fetcher.download(spec, GEMURL, Dir.pwd)
|
154
|
-
rescue Gem::RemoteFetcher::FetchError
|
155
|
-
warn " failed"
|
156
|
+
rescue Gem::RemoteFetcher::FetchError => e
|
157
|
+
warn " failed #{full_name}: #{e.message}"
|
156
158
|
next
|
157
159
|
end
|
158
160
|
end
|
@@ -191,13 +193,17 @@ class Gauntlet
|
|
191
193
|
|
192
194
|
def with_gem name
|
193
195
|
in_gem_dir do
|
196
|
+
process_dir = "#{$$}"
|
194
197
|
begin
|
195
|
-
|
196
|
-
Dir.chdir
|
197
|
-
|
198
|
+
Dir.mkdir process_dir
|
199
|
+
Dir.chdir process_dir do
|
200
|
+
system "tar zxmf ../#{name}.tgz 2> /dev/null"
|
201
|
+
Dir.chdir name do
|
202
|
+
yield name
|
203
|
+
end
|
198
204
|
end
|
199
205
|
ensure
|
200
|
-
system "rm -
|
206
|
+
system "rm -rf #{process_dir}"
|
201
207
|
end
|
202
208
|
end
|
203
209
|
end
|
@@ -248,6 +254,14 @@ class Gauntlet
|
|
248
254
|
|
249
255
|
self.data ||= load_yaml data_file
|
250
256
|
|
257
|
+
outdateds = self.data.keys - in_gem_dir do
|
258
|
+
Dir["*.tgz"].map { |tgz| File.basename(tgz, ".tgz") }
|
259
|
+
end
|
260
|
+
|
261
|
+
outdateds.each do |outdated|
|
262
|
+
self.data.delete outdated
|
263
|
+
end
|
264
|
+
|
251
265
|
each_gem filter do |name|
|
252
266
|
next if should_skip? name
|
253
267
|
with_gem name do
|
@@ -270,6 +284,7 @@ end
|
|
270
284
|
|
271
285
|
# bug in RemoteFetcher#download prevents multithreading. Remove after 1.3.2
|
272
286
|
class Gem::RemoteFetcher
|
287
|
+
alias :old_download :download
|
273
288
|
def download(spec, source_uri, install_dir = Gem.dir)
|
274
289
|
if File.writable?(install_dir)
|
275
290
|
cache_dir = File.join install_dir, 'cache'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/ruby -ws
|
2
|
+
|
3
|
+
$v ||= false # HACK
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
require 'gauntlet'
|
7
|
+
|
8
|
+
class GrepGauntlet < Gauntlet
|
9
|
+
attr_accessor :pattern
|
10
|
+
|
11
|
+
def initialize pattern
|
12
|
+
self.pattern = pattern
|
13
|
+
end
|
14
|
+
|
15
|
+
def run name
|
16
|
+
system "find . -type f -print0 | xargs -0 grep #{pattern}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
pattern = ARGV.shift
|
21
|
+
flogger = GrepGauntlet.new pattern
|
22
|
+
flogger.run_the_gauntlet
|
23
|
+
|
metadata
CHANGED
@@ -1,15 +1,36 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gauntlet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDPjCCAiagAwIBAgIBADANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
|
14
|
+
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
15
|
+
GRYDY29tMB4XDTA5MDMwNjE4NTMxNVoXDTEwMDMwNjE4NTMxNVowRTETMBEGA1UE
|
16
|
+
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
17
|
+
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
18
|
+
b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
|
19
|
+
taCPaLmfYIaFcHHCSY4hYDJijRQkLxPeB3xbOfzfLoBDbjvx5JxgJxUjmGa7xhcT
|
20
|
+
oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
|
21
|
+
GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
|
22
|
+
qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
|
23
|
+
gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
24
|
+
HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
|
25
|
+
AQAY59gYvDxqSqgC92nAP9P8dnGgfZgLxP237xS6XxFGJSghdz/nI6pusfCWKM8m
|
26
|
+
vzjjH2wUMSSf3tNudQ3rCGLf2epkcU13/rguI88wO6MrE0wi4ZqLQX+eZQFskJb/
|
27
|
+
w6x9W1ur8eR01s397LSMexySDBrJOh34cm2AlfKr/jokKCTwcM0OvVZnAutaovC0
|
28
|
+
l1SVZ0ecg88bsWHA0Yhh7NFxK1utWoIhtB6AFC/+trM0FQEB/jZkIS8SaNzn96Rl
|
29
|
+
n0sZEf77FLf5peR8TP/PtmIg7Cyqz23sLM4mCOoTGIy5OcZ8TdyiyINUHtb5ej/T
|
30
|
+
FBHgymkyj/AOSqKRIpXPhjC6
|
31
|
+
-----END CERTIFICATE-----
|
11
32
|
|
12
|
-
date:
|
33
|
+
date: 2009-06-23 00:00:00 -07:00
|
13
34
|
default_executable:
|
14
35
|
dependencies:
|
15
36
|
- !ruby/object:Gem::Dependency
|
@@ -20,9 +41,11 @@ dependencies:
|
|
20
41
|
requirements:
|
21
42
|
- - ">="
|
22
43
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
44
|
+
version: 2.3.0
|
24
45
|
version:
|
25
|
-
description:
|
46
|
+
description: |-
|
47
|
+
Gauntlet is a pluggable means of running code against all the latest
|
48
|
+
gems and storing off the data.
|
26
49
|
email:
|
27
50
|
- ryand-ruby@zenspider.com
|
28
51
|
executables:
|
@@ -40,9 +63,12 @@ files:
|
|
40
63
|
- Rakefile
|
41
64
|
- bin/gauntlet
|
42
65
|
- lib/gauntlet.rb
|
66
|
+
- lib/gauntlet_grep.rb
|
43
67
|
- test/test_gauntlet.rb
|
44
68
|
has_rdoc: true
|
45
69
|
homepage: http://rubyforge.org/projects/seattlerb
|
70
|
+
licenses: []
|
71
|
+
|
46
72
|
post_install_message:
|
47
73
|
rdoc_options:
|
48
74
|
- --main
|
@@ -64,9 +90,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
90
|
requirements: []
|
65
91
|
|
66
92
|
rubyforge_project: seattlerb
|
67
|
-
rubygems_version: 1.3.
|
93
|
+
rubygems_version: 1.3.4
|
68
94
|
signing_key:
|
69
|
-
specification_version:
|
95
|
+
specification_version: 3
|
70
96
|
summary: Gauntlet is a pluggable means of running code against all the latest gems and storing off the data.
|
71
97
|
test_files:
|
72
98
|
- test/test_gauntlet.rb
|
metadata.gz.sig
ADDED
Binary file
|