gems-status 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gems_composite_command.rb +3 -3
- data/lib/gems_status.rb +1 -1
- data/lib/gems_status_metadata.rb +1 -1
- data/lib/lockfile_gems.rb +22 -17
- data/lib/not_native_gem_checker.rb +1 -1
- data/lib/not_rails_checker.rb +1 -1
- data/lib/obs_gems.rb +13 -11
- data/lib/ruby_gems_gems.rb +1 -1
- data/lib/ruby_gems_gems_gem_simple.rb +2 -2
- data/lib/view_results.rb +2 -2
- metadata +4 -4
@@ -90,9 +90,9 @@ class GemsCompositeCommand < GemsCommand
|
|
90
90
|
if !are_there_results?
|
91
91
|
return
|
92
92
|
end
|
93
|
-
@results[@target].each do |k,v|
|
93
|
+
@results[@target].sort.each do |k,v|
|
94
94
|
if !common_key?(k) then
|
95
|
-
Utils
|
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
|
@@ -101,7 +101,7 @@ class GemsCompositeCommand < GemsCommand
|
|
101
101
|
ViewResults::print_diff(k, @results, @target)
|
102
102
|
end
|
103
103
|
@checkers.each do |check_class|
|
104
|
-
@results[@target].each do |k, gem|
|
104
|
+
@results[@target].sort.each do |k, gem|
|
105
105
|
ViewResults::print_check(check_class::description, gem.name) unless check_class::check?(gem)
|
106
106
|
end
|
107
107
|
end
|
data/lib/gems_status.rb
CHANGED
data/lib/gems_status_metadata.rb
CHANGED
data/lib/lockfile_gems.rb
CHANGED
@@ -10,36 +10,41 @@ require "utils"
|
|
10
10
|
|
11
11
|
class LockfileGems < GemsCommand
|
12
12
|
def initialize(conf)
|
13
|
-
Utils::check_parameters('LockfileGems', conf, ["id", "
|
14
|
-
@
|
15
|
-
@filename = conf['filename']
|
13
|
+
Utils::check_parameters('LockfileGems', conf, ["id", "filenames", "gems_url"])
|
14
|
+
@filenames = conf['filenames']
|
16
15
|
@gems_url = conf['gems_url']
|
17
16
|
@result = {}
|
18
17
|
@ident = conf['id']
|
19
18
|
end
|
20
19
|
|
21
|
-
def get_data
|
22
|
-
Dir.chdir(
|
20
|
+
def get_data(dirname, filename)
|
21
|
+
Dir.chdir(dirname)
|
23
22
|
data = ""
|
24
23
|
begin
|
25
|
-
data = File.open(
|
24
|
+
data = File.open(filename).read
|
26
25
|
rescue
|
27
|
-
Utils
|
26
|
+
Utils::log_error "ERROR: There was a problem opening file #{filename} "
|
28
27
|
end
|
29
28
|
return data
|
30
29
|
end
|
31
30
|
|
32
31
|
def execute
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
32
|
+
@filenames.each do |filename|
|
33
|
+
Utils::log_debug "DEBUG: reading #{filename}"
|
34
|
+
file_data = get_data(File::dirname(filename), File::basename(filename))
|
35
|
+
if file_data.empty?
|
36
|
+
Utils::log_error "ERROR: file empty #{filename}"
|
37
|
+
next
|
38
|
+
end
|
39
|
+
lockfile = Bundler::LockfileParser.new(file_data)
|
40
|
+
lockfile.specs.each do |spec|
|
41
|
+
name = spec.name
|
42
|
+
version = Gem::Version.create(spec.version)
|
43
|
+
if @result[name] && @result[name].version != version
|
44
|
+
Utils::log_error "ERROR: Same gem with different versions: #{name} - #{version} - #{filename}\n #{name} - #{@result[name].version} - #{@result[name].origin} "
|
45
|
+
end
|
46
|
+
@result[name] = RubyGemsGems_GemSimple.new(name, version , '', filename, @gems_url)
|
47
|
+
end
|
43
48
|
end
|
44
49
|
end
|
45
50
|
|
@@ -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
|
-
Utils
|
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
|
-
Utils
|
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
|
-
Utils
|
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
|
-
Utils
|
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
|
-
Utils
|
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
|
-
Utils
|
38
|
+
Utils::log_debug "DEBUG: Revision in link: #{rev}."
|
39
39
|
package = package + "?rev=" + rev
|
40
40
|
end
|
41
|
-
Utils
|
41
|
+
Utils::log_debug "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
|
-
Utils
|
50
|
+
Utils::log_error "ERROR: There was a problem opening #{url} "
|
51
51
|
end
|
52
52
|
return data
|
53
53
|
end
|
@@ -61,20 +61,22 @@ class OBSGems < GemsCommand
|
|
61
61
|
end
|
62
62
|
data = XmlSimple.xml_in(response)
|
63
63
|
if data["linkinfo"] then
|
64
|
-
Utils
|
64
|
+
Utils::log_debug "DEBUG: #{data["name"]} is a link."
|
65
65
|
if data["entry"].length != 1
|
66
|
-
|
66
|
+
msg = ""
|
67
|
+
data["entry"].each {|e| msg << e["name"]}
|
68
|
+
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" + msg
|
67
69
|
end
|
68
70
|
parse_link(data["linkinfo"])
|
69
71
|
return
|
70
72
|
end
|
71
73
|
if !data["entry"] then
|
72
|
-
Utils
|
74
|
+
Utils::log_error "ERROR: something went wrong retrieving info from #{project} : #{package}"
|
73
75
|
return
|
74
76
|
end
|
75
77
|
data["entry"].each do |entry|
|
76
|
-
if !(entry["name"] =~ /\w\.
|
77
|
-
Utils
|
78
|
+
if !(entry["name"] =~ /\w(\.gem|\.spec|\.changes|\.rpmlintrc|-rpm-lintrc|-rpmlintrc)/)
|
79
|
+
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
80
|
end
|
79
81
|
if entry["name"].end_with?(".gem") then
|
80
82
|
name = gem_name(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
|
-
Utils
|
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
|
-
Utils
|
14
|
+
Utils::log_debug "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
|
-
Utils
|
20
|
+
Utils::log_error "ERROR: There was a problem opening #{gem_uri}"
|
21
21
|
end
|
22
22
|
return nil
|
23
23
|
end
|
data/lib/view_results.rb
CHANGED
@@ -161,8 +161,8 @@ class ViewResults
|
|
161
161
|
end
|
162
162
|
|
163
163
|
def ViewResults.print_tail
|
164
|
-
puts "<h2>errors
|
165
|
-
Utils
|
164
|
+
puts "<h2>errors:#{Utils::errors.length}</h2>"
|
165
|
+
Utils::errors.each {|e| puts "<br/><span class='footer'><span class='alert'>#{e}</span></span>"}
|
166
166
|
date = Time.now.strftime('%F0')
|
167
167
|
puts "<p class='footer'>run by <a href=\"https://github.com/jordimassaguerpla/gems-status\">gems-status</a> - #{date} - version: #{GemsStatusMetadata::VERSION}</p>
|
168
168
|
</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: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 5
|
10
|
+
version: 0.2.5
|
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-07 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: xml-simple
|