gems-status 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gems_status_metadata.rb +1 -1
- data/lib/lockfile_gems.rb +4 -1
- data/lib/ruby_gems_gems_gem_simple.rb +3 -9
- data/lib/utils.rb +14 -0
- data/lib/view_results.rb +37 -8
- metadata +5 -5
data/lib/gems_status_metadata.rb
CHANGED
data/lib/lockfile_gems.rb
CHANGED
@@ -10,11 +10,12 @@ require "utils"
|
|
10
10
|
|
11
11
|
class LockfileGems < GemsCommand
|
12
12
|
def initialize(conf)
|
13
|
-
Utils::check_parameters('LockfileGems', conf, ["id", "filenames", "gems_url"])
|
13
|
+
Utils::check_parameters('LockfileGems', conf, ["id", "filenames", "gems_url", "upstream_url"])
|
14
14
|
@filenames = conf['filenames']
|
15
15
|
@gems_url = conf['gems_url']
|
16
16
|
@result = {}
|
17
17
|
@ident = conf['id']
|
18
|
+
@upstream_url = conf['upstream_url']
|
18
19
|
end
|
19
20
|
|
20
21
|
def get_data(dirname, filename)
|
@@ -75,6 +76,8 @@ class LockfileGems < GemsCommand
|
|
75
76
|
@result[name] = [] if !@result[name]
|
76
77
|
@result[name] << RubyGemsGems_GemSimple.new(name, version , '', filename,
|
77
78
|
gems_url, dependencies)
|
79
|
+
@result[name] << RubyGemsGems_GemSimple.new(name, version , '', @upstream_url,
|
80
|
+
@upstream_url, dependencies)
|
78
81
|
end
|
79
82
|
update_dependencies
|
80
83
|
end
|
@@ -17,19 +17,13 @@ class RubyGemsGems_GemSimple < GemSimple
|
|
17
17
|
uri_debug = gem_uri.clone
|
18
18
|
uri_debug.password = "********" if uri_debug.password
|
19
19
|
Utils::log_debug "download and md5 for #{@name} from #{uri_debug}"
|
20
|
+
@md5 = nil
|
20
21
|
begin
|
21
|
-
|
22
|
-
source = open(gem_uri.scheme + "://" + gem_uri.host + "/" + gem_uri.path,
|
23
|
-
:http_basic_authentication=>[gem_uri.user, gem_uri.password])
|
24
|
-
else
|
25
|
-
source = open(gem_uri)
|
26
|
-
end
|
27
|
-
@md5 = Digest::MD5.hexdigest(source.read)
|
28
|
-
return @md5
|
22
|
+
@md5 = Utils::download_md5(gem_uri)
|
29
23
|
rescue
|
30
24
|
Utils::log_error(@name, "There was a problem opening #{gem_uri}")
|
31
25
|
end
|
32
|
-
return
|
26
|
+
return @md5
|
33
27
|
end
|
34
28
|
|
35
29
|
def from_git?
|
data/lib/utils.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
class Utils
|
2
2
|
attr_accessor :errors
|
3
3
|
@@errors = {}
|
4
|
+
@@md5_sums = {}
|
4
5
|
|
5
6
|
def Utils.errors
|
6
7
|
return @@errors
|
@@ -30,4 +31,17 @@ class Utils
|
|
30
31
|
$stderr.puts "DEBUG: #{msg}"
|
31
32
|
end
|
32
33
|
|
34
|
+
def Utils.download_md5(gem_uri)
|
35
|
+
return @@md5_sums[gem_uri] if @@md5_sums[gem_uri]
|
36
|
+
if gem_uri.user && gem_uri.password
|
37
|
+
source = open(gem_uri.scheme + "://" + gem_uri.host + "/" + gem_uri.path,
|
38
|
+
:http_basic_authentication=>[gem_uri.user, gem_uri.password])
|
39
|
+
else
|
40
|
+
source = open(gem_uri)
|
41
|
+
end
|
42
|
+
md5 = Digest::MD5.hexdigest(source.read)
|
43
|
+
@@md5_sums[gem_uri] = md5
|
44
|
+
return md5
|
45
|
+
end
|
46
|
+
|
33
47
|
end
|
data/lib/view_results.rb
CHANGED
@@ -3,6 +3,9 @@ require 'gems_status_metadata'
|
|
3
3
|
require 'utils'
|
4
4
|
|
5
5
|
class ViewResults
|
6
|
+
@@patched = 0
|
7
|
+
@@outdated = 0
|
8
|
+
@@up_to_date = 0
|
6
9
|
|
7
10
|
def ViewResults.print_description(ids)
|
8
11
|
puts "
|
@@ -49,6 +52,16 @@ class ViewResults
|
|
49
52
|
"
|
50
53
|
end
|
51
54
|
|
55
|
+
def ViewResults.update_summary(name_color)
|
56
|
+
if name_color == "alert"
|
57
|
+
@@patched += 1
|
58
|
+
elsif name_color == "warning"
|
59
|
+
@@outdated += 1
|
60
|
+
else
|
61
|
+
@@up_to_date += 1
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
52
65
|
def ViewResults.print_results(k, results, target, checker_results, comments)
|
53
66
|
puts "<p>"
|
54
67
|
puts "<table width='100%' class='table_results'>"
|
@@ -105,16 +118,25 @@ class ViewResults
|
|
105
118
|
end
|
106
119
|
puts "<tr><td width='50%'><span class='#{name_color}'>#{k.upcase}</span></td><td width='10%'>version</td><td width='40%'>md5</td></tr>"
|
107
120
|
puts html_string
|
121
|
+
update_summary(name_color)
|
108
122
|
puts "</table>"
|
109
123
|
puts "</p>"
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
124
|
+
if checker_results
|
125
|
+
puts "<p> <span class='check'>checks:"
|
126
|
+
puts "<br/>#{checker_results}</span>"
|
127
|
+
puts "</p>"
|
128
|
+
end
|
129
|
+
if Utils::errors[k]
|
130
|
+
puts "<p><span class='errors'>errors: "
|
131
|
+
puts "<br/>#{Utils::errors[k]}</span>"
|
132
|
+
Utils.errors.delete(k)
|
133
|
+
puts "</p>"
|
134
|
+
end
|
135
|
+
if comments
|
136
|
+
puts "<p><span class='comment'>comments: "
|
137
|
+
puts "<br/>#{comments}</span>"
|
138
|
+
puts "</p>"
|
139
|
+
end
|
118
140
|
end
|
119
141
|
|
120
142
|
def ViewResults.print_head
|
@@ -189,16 +211,23 @@ class ViewResults
|
|
189
211
|
end
|
190
212
|
|
191
213
|
def ViewResults.print_hash(desc, data, style)
|
214
|
+
return if !data or data.length == 0
|
192
215
|
puts "<p>"
|
193
216
|
puts "<h2>#{desc}: #{data.length}</h2>"
|
194
217
|
data.each {|k,v| puts "<span class='#{style}'>#{k.upcase} : #{v}</span><br/>"}
|
195
218
|
puts "</p>"
|
196
219
|
end
|
197
220
|
|
221
|
+
def ViewResults.print_summary
|
222
|
+
puts "<h2>summary</h2>"
|
223
|
+
puts "patched/errored: #{@@patched} outdated: #{@@outdated} up-to-date: #{@@up_to_date}"
|
224
|
+
end
|
225
|
+
|
198
226
|
def ViewResults.print_tail(checker_results, comments)
|
199
227
|
self.print_hash("checks", checker_results, "check")
|
200
228
|
self.print_hash("comments", comments, "comment")
|
201
229
|
self.print_hash("errors", Utils::errors, "errors")
|
230
|
+
self.print_summary
|
202
231
|
date = Time.now.strftime('%a %b %d %H:%M:%S %Z %Y')
|
203
232
|
puts "<p class='footer'>run by <a href=\"https://github.com/jordimassaguerpla/gems-status\">gems-status</a> - #{date} - version: #{GemsStatusMetadata::VERSION}</p>
|
204
233
|
</body>
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gems-status
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 5
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.5.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jordi Massaguer Pla
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-04-
|
18
|
+
date: 2012-04-13 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: xml-simple
|
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
110
|
requirements: []
|
111
111
|
|
112
112
|
rubyforge_project:
|
113
|
-
rubygems_version: 1.8.
|
113
|
+
rubygems_version: 1.8.11
|
114
114
|
signing_key:
|
115
115
|
specification_version: 3
|
116
116
|
summary: compares rubygems from different sources
|