gems-status 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/gems_composite_command.rb +1 -1
- data/lib/gems_status.rb +1 -1
- data/lib/gems_status_metadata.rb +1 -1
- data/lib/lockfile_gems.rb +2 -2
- data/lib/not_native_gem_checker.rb +1 -1
- data/lib/not_rails_checker.rb +1 -1
- data/lib/obs_gems.rb +14 -8
- data/lib/ruby_gems_gems.rb +1 -1
- data/lib/ruby_gems_gems_gem_simple.rb +2 -2
- data/lib/utils.rb +13 -0
- data/lib/view_results.rb +14 -4
- data/test/Gemfile +2 -1
- data/test/Gemfile.lock +61 -6
- data/test/Gemfile.lock.test +4 -0
- data/test/test-lockfile_gems.rb +5 -0
- metadata +4 -4
@@ -92,7 +92,7 @@ class GemsCompositeCommand < GemsCommand
|
|
92
92
|
end
|
93
93
|
@results[@target].each do |k,v|
|
94
94
|
if !common_key?(k) then
|
95
|
-
|
95
|
+
Utils.log_error "ERROR: #{k} in #{@target} but not found in all the sources!"
|
96
96
|
next
|
97
97
|
end
|
98
98
|
if equal_gems?(k) then
|
data/lib/gems_status.rb
CHANGED
data/lib/gems_status_metadata.rb
CHANGED
data/lib/lockfile_gems.rb
CHANGED
@@ -24,13 +24,13 @@ class LockfileGems < GemsCommand
|
|
24
24
|
begin
|
25
25
|
data = File.open(@filename).read
|
26
26
|
rescue
|
27
|
-
|
27
|
+
Utils.log_error "ERROR: There was a problem opening file #{filename} "
|
28
28
|
end
|
29
29
|
return data
|
30
30
|
end
|
31
31
|
|
32
32
|
def execute
|
33
|
-
|
33
|
+
Utils.log_error "DEBUG: reading #{@filename}"
|
34
34
|
file_data = get_data
|
35
35
|
if file_data.empty?
|
36
36
|
return
|
@@ -17,7 +17,7 @@ class NotNativeGemChecker < GemChecker
|
|
17
17
|
#io.close if io && !io.closed?
|
18
18
|
#or is a bug on rubygems???
|
19
19
|
rescue => e
|
20
|
-
|
20
|
+
Utils.log_error "ERROR: There was a problem opening #{gem_uri} #{e.class} #{e.message}"
|
21
21
|
end
|
22
22
|
return false unless result
|
23
23
|
return result.spec.extensions.empty?
|
data/lib/not_rails_checker.rb
CHANGED
@@ -17,7 +17,7 @@ class NotRailsChecker < GemChecker
|
|
17
17
|
#io.close if io && !io.closed?
|
18
18
|
#or is a bug on rubygems???
|
19
19
|
rescue => e
|
20
|
-
|
20
|
+
Utils.log_error "ERROR: There was a problem opening #{gem_uri} #{e.class} #{e.message}"
|
21
21
|
end
|
22
22
|
return false unless result
|
23
23
|
result.spec.dependencies.each do |gem|
|
data/lib/obs_gems.rb
CHANGED
@@ -20,25 +20,25 @@ class OBSGems < GemsCommand
|
|
20
20
|
|
21
21
|
def parse_link(linkinfo)
|
22
22
|
if linkinfo.length > 1 then
|
23
|
-
|
23
|
+
Utils.log_error "ERROR: There is more than one linkinfo element"
|
24
24
|
return
|
25
25
|
end
|
26
26
|
if !linkinfo[0]["project"] then
|
27
|
-
|
27
|
+
Utils.log_error "ERROR: Project element does not exists in linkinfo"
|
28
28
|
return
|
29
29
|
end
|
30
30
|
if !linkinfo[0]["package"] then
|
31
|
-
|
31
|
+
Utils.log_error "ERROR: Package element does not exists in linkinfo"
|
32
32
|
return
|
33
33
|
end
|
34
34
|
repo = linkinfo[0]["project"]
|
35
35
|
package = linkinfo[0]["package"]
|
36
36
|
if linkinfo[0]["rev"] then
|
37
37
|
rev = linkinfo[0]["rev"]
|
38
|
-
|
38
|
+
Utils.log_error "DEBUG: Revision in link: #{rev}."
|
39
39
|
package = package + "?rev=" + rev
|
40
40
|
end
|
41
|
-
|
41
|
+
Utils.log_error "DEBUG: follow link to project: #{repo} package: #{package}"
|
42
42
|
parse_rpm_data(repo, package)
|
43
43
|
end
|
44
44
|
|
@@ -47,7 +47,7 @@ class OBSGems < GemsCommand
|
|
47
47
|
begin
|
48
48
|
data = open(url, :http_basic_authentication => [@username, @password]).read
|
49
49
|
rescue
|
50
|
-
|
50
|
+
Utils.log_error "ERROR: There was a problem opening #{url} "
|
51
51
|
end
|
52
52
|
return data
|
53
53
|
end
|
@@ -61,15 +61,21 @@ class OBSGems < GemsCommand
|
|
61
61
|
end
|
62
62
|
data = XmlSimple.xml_in(response)
|
63
63
|
if data["linkinfo"] then
|
64
|
-
|
64
|
+
Utils.log_error "DEBUG: #{data["name"]} is a link."
|
65
|
+
if data["entry"].length != 1
|
66
|
+
Utils.log_error "ERROR: when parsing the link for #{project} : #{package}. There are more entries than expected. That may be a patched link and the result may not be correct"
|
67
|
+
end
|
65
68
|
parse_link(data["linkinfo"])
|
66
69
|
return
|
67
70
|
end
|
68
71
|
if !data["entry"] then
|
69
|
-
|
72
|
+
Utils.log_error "ERROR: something went wrong retrieving info from #{project} : #{package}"
|
70
73
|
return
|
71
74
|
end
|
72
75
|
data["entry"].each do |entry|
|
76
|
+
if !(entry["name"] =~ /\w\.(gem|spec|changes|rpmlintrc)/)
|
77
|
+
Utils.log_error "ERROR: when parsing data for #{project} : #{package}. Entry not expected. That may be a patched rpm and the result may not be correct. #{entry["name"]}"
|
78
|
+
end
|
73
79
|
if entry["name"].end_with?(".gem") then
|
74
80
|
name = gem_name(entry['name'])
|
75
81
|
version = Gem::Version.new(gem_version(entry['name']))
|
data/lib/ruby_gems_gems.rb
CHANGED
@@ -26,7 +26,7 @@ class RubyGemsGems < GemsCommand
|
|
26
26
|
gz = Zlib::GzipReader.new(source)
|
27
27
|
return gz.read
|
28
28
|
rescue
|
29
|
-
|
29
|
+
Utils.log_error "ERROR: There was a problem opening #{specs_url} "
|
30
30
|
end
|
31
31
|
return ""
|
32
32
|
end
|
@@ -11,13 +11,13 @@ class RubyGemsGems_GemSimple < GemSimple
|
|
11
11
|
return @md5
|
12
12
|
end
|
13
13
|
gem_uri = "#{@gems_url}/#{@name}-#{@version}.gem"
|
14
|
-
|
14
|
+
Utils.log_error "DEBUG: download and md5 for #{@name} from #{gem_uri}"
|
15
15
|
begin
|
16
16
|
source = open(gem_uri)
|
17
17
|
@md5 = Digest::MD5.hexdigest(source.read)
|
18
18
|
return @md5
|
19
19
|
rescue
|
20
|
-
|
20
|
+
Utils.log_error "ERROR: There was a problem opening #{gem_uri}"
|
21
21
|
end
|
22
22
|
return nil
|
23
23
|
end
|
data/lib/utils.rb
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
class Utils
|
2
|
+
attr_accessor :errors
|
3
|
+
@@errors = []
|
4
|
+
|
5
|
+
def Utils.errors
|
6
|
+
return @@errors
|
7
|
+
end
|
8
|
+
|
2
9
|
def Utils.check_parameters(classname, conf, parameters)
|
3
10
|
if !conf['classname'] then
|
4
11
|
raise "ERROR: trying to initialize #{classname} when parameter classname does not exists"
|
@@ -12,4 +19,10 @@ class Utils
|
|
12
19
|
end
|
13
20
|
end
|
14
21
|
end
|
22
|
+
|
23
|
+
def Utils.log_error(msg)
|
24
|
+
@@errors << msg
|
25
|
+
$stderr.puts msg
|
26
|
+
end
|
27
|
+
|
15
28
|
end
|
data/lib/view_results.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'gems_status_metadata'
|
3
|
+
require 'utils'
|
3
4
|
|
4
5
|
class ViewResults
|
5
6
|
|
@@ -32,16 +33,18 @@ class ViewResults
|
|
32
33
|
<ol>
|
33
34
|
<li> Maintain those gems that have been patched but are not outdated
|
34
35
|
</li>
|
35
|
-
<li> Update
|
36
|
+
<li> Update those gems that have been patched and are outdated
|
36
37
|
</li>
|
37
|
-
<li> Update
|
38
|
+
<li> Update those gems that are outdated
|
38
39
|
</li>
|
39
40
|
</ol>
|
40
41
|
<p>
|
41
42
|
After the comparison there are some checks that have been performed. Those checks imply also there is some kind of work to do
|
42
43
|
</p>
|
44
|
+
<p> At the end there are the errors. Look them carefully.
|
45
|
+
</p>
|
43
46
|
<p>
|
44
|
-
You should run gems-status periodically until the lists of patched, outdated and checks are gone.
|
47
|
+
You should run gems-status periodically until the lists of errors, patched, outdated and checks are gone.
|
45
48
|
</p>
|
46
49
|
"
|
47
50
|
end
|
@@ -88,7 +91,7 @@ class ViewResults
|
|
88
91
|
version = result[k].version
|
89
92
|
md5 = result[k].md5
|
90
93
|
end
|
91
|
-
puts "<tr><td><span class='#{name_color}'>#{k}</span></td></tr>"
|
94
|
+
puts "<tr><td width='50%'><span class='#{name_color}'>#{k}</span></td><td width='10%'>version</td><td width='40%'>md5</td></tr>"
|
92
95
|
puts html_string
|
93
96
|
puts "</table>"
|
94
97
|
puts "</p>"
|
@@ -111,6 +114,11 @@ class ViewResults
|
|
111
114
|
font-size: 110%;
|
112
115
|
font-weight: bold;
|
113
116
|
}
|
117
|
+
h2
|
118
|
+
{
|
119
|
+
font-size: 100%;
|
120
|
+
font-weight: bold;
|
121
|
+
}
|
114
122
|
.gem_name
|
115
123
|
{
|
116
124
|
color: #000000;
|
@@ -153,6 +161,8 @@ class ViewResults
|
|
153
161
|
end
|
154
162
|
|
155
163
|
def ViewResults.print_tail
|
164
|
+
puts "<h2>errors:</h2>"
|
165
|
+
Utils.errors.each {|e| puts "<br/><span class='alert'>#{e}</span>"}
|
156
166
|
date = Time.now.strftime('%F0')
|
157
167
|
puts "<p class='footer'>run by <a href=\"https://github.com/jordimassaguerpla/gems-status\">gems-status</a> - #{date} - version: #{GemsStatusMetadata::VERSION}</p>
|
158
168
|
</body>
|
data/test/Gemfile
CHANGED
data/test/Gemfile.lock
CHANGED
@@ -1,15 +1,70 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
actionpack (3.2.1)
|
5
|
+
activemodel (= 3.2.1)
|
6
|
+
activesupport (= 3.2.1)
|
7
|
+
builder (~> 3.0.0)
|
8
|
+
erubis (~> 2.7.0)
|
9
|
+
journey (~> 1.0.1)
|
10
|
+
rack (~> 1.4.0)
|
11
|
+
rack-cache (~> 1.1)
|
12
|
+
rack-test (~> 0.6.1)
|
13
|
+
sprockets (~> 2.1.2)
|
14
|
+
activemodel (3.2.1)
|
15
|
+
activesupport (= 3.2.1)
|
16
|
+
builder (~> 3.0.0)
|
17
|
+
activesupport (3.2.1)
|
18
|
+
i18n (~> 0.6)
|
19
|
+
multi_json (~> 1.0)
|
20
|
+
builder (3.0.0)
|
21
|
+
curb (0.8.0)
|
22
|
+
erubis (2.7.0)
|
23
|
+
factory_girl (2.5.1)
|
24
|
+
activesupport
|
25
|
+
factory_girl_rails (1.6.0)
|
26
|
+
factory_girl (~> 2.5.0)
|
27
|
+
railties (>= 3.0.0)
|
10
28
|
fakefs (0.4.0)
|
29
|
+
gem2rpm (0.7.1)
|
30
|
+
hike (1.2.1)
|
31
|
+
i18n (0.6.0)
|
32
|
+
journey (1.0.1)
|
33
|
+
json (1.6.5)
|
34
|
+
multi_json (1.0.4)
|
35
|
+
rack (1.4.1)
|
36
|
+
rack-cache (1.1)
|
37
|
+
rack (>= 0.4)
|
38
|
+
rack-ssl (1.3.2)
|
39
|
+
rack
|
40
|
+
rack-test (0.6.1)
|
41
|
+
rack (>= 1.0)
|
42
|
+
railties (3.2.1)
|
43
|
+
actionpack (= 3.2.1)
|
44
|
+
activesupport (= 3.2.1)
|
45
|
+
rack-ssl (~> 1.3.2)
|
46
|
+
rake (>= 0.8.7)
|
47
|
+
rdoc (~> 3.4)
|
48
|
+
thor (~> 0.14.6)
|
49
|
+
rake (0.9.2.2)
|
50
|
+
rdoc (3.12)
|
51
|
+
json (~> 1.4)
|
52
|
+
sprockets (2.1.2)
|
53
|
+
hike (~> 1.2)
|
54
|
+
rack (~> 1.0)
|
55
|
+
tilt (~> 1.1, != 1.3.0)
|
56
|
+
system_timer (1.2.4)
|
57
|
+
thor (0.14.6)
|
58
|
+
tilt (1.3.3)
|
59
|
+
xml-simple (1.1.1)
|
11
60
|
|
12
61
|
PLATFORMS
|
13
62
|
ruby
|
14
63
|
|
15
64
|
DEPENDENCIES
|
65
|
+
curb
|
66
|
+
factory_girl_rails
|
67
|
+
fakefs
|
68
|
+
gem2rpm
|
69
|
+
system_timer
|
70
|
+
xml-simple
|
data/test/Gemfile.lock.test
CHANGED
data/test/test-lockfile_gems.rb
CHANGED
@@ -16,10 +16,15 @@ class TestLockfileGems < Test::Unit::TestCase
|
|
16
16
|
def test_get_rubygems_data
|
17
17
|
lockfilegems = LockfileGemsTest.new
|
18
18
|
lockfilegems.execute
|
19
|
+
assert(lockfilegems.result.length == 2)
|
19
20
|
result = lockfilegems.result["test"].name
|
20
21
|
assert_equal("test",result)
|
21
22
|
result = lockfilegems.result["test"].version
|
22
23
|
assert_equal(Gem::Version.new("0.8.6"), result)
|
24
|
+
result = lockfilegems.result["test2"].name
|
25
|
+
assert_equal("test2",result)
|
26
|
+
result = lockfilegems.result["test2"].version
|
27
|
+
assert_equal(Gem::Version.new("1.2.3"), result)
|
23
28
|
end
|
24
29
|
end
|
25
30
|
|
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: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
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-02-
|
18
|
+
date: 2012-02-05 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: xml-simple
|