gems-status 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (C) 2011 Jordi Massaguer Pla <jmassaguerpla@suse.com>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
20
+
data/bin/gems-status ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
4
+ require "gems_status"
5
+
6
+ def echo_usage
7
+ puts "usage: gem-status conf_file"
8
+ end
9
+
10
+ if ARGV.length == 0 then
11
+ echo_usage
12
+ exit
13
+ end
14
+
15
+ if !File::exists?(ARGV[0]) then
16
+ puts "ERROR: File does not exists: #{ARGV[1]}"
17
+ echo_usage
18
+ exit
19
+ end
20
+
21
+ GemStatus.new(ARGV[0]).execute
22
+
data/lib/gem_simple.rb ADDED
@@ -0,0 +1,10 @@
1
+ class GemSimple
2
+ attr_reader :name, :version, :md5, :origin
3
+ def initialize(name, version, md5, origin)
4
+ @name = name
5
+ @version = version
6
+ @md5 = md5
7
+ @origin = origin
8
+ end
9
+ end
10
+
@@ -0,0 +1,36 @@
1
+
2
+ require "gem_simple"
3
+
4
+ class GemsCommand
5
+ attr_reader :result
6
+ def gem_name(gem)
7
+ pos = gem.rindex(".gem")
8
+ if ! pos then
9
+ return gem
10
+ end
11
+ name = gem[0...pos]
12
+ pos = name.rindex("-")
13
+ if ! pos then
14
+ return name
15
+ end
16
+ return name[0...pos]
17
+ end
18
+
19
+ def gem_version(gem)
20
+ pos = gem.rindex(".gem")
21
+ if ! pos then
22
+ return '-1'
23
+ end
24
+ name = gem[0...pos]
25
+ pos = name.rindex("-")
26
+ if ! pos then
27
+ return '-1'
28
+ end
29
+ pos = pos + 1
30
+ return name[pos..-1]
31
+ end
32
+
33
+ def execute
34
+ end
35
+ end
36
+
@@ -0,0 +1,129 @@
1
+ require "gem_simple"
2
+ require "gems_command"
3
+
4
+ class GemsCompositeCommand < GemsCommand
5
+ def initialize
6
+ @commands = []
7
+ @results = []
8
+ end
9
+
10
+ def add_command(command)
11
+ @commands << command
12
+ end
13
+
14
+ def execute
15
+ threads = []
16
+ if !@commands then
17
+ return
18
+ end
19
+ @commands.each do |command|
20
+ threads << Thread.new { command.execute }
21
+ end
22
+ threads.each { |aThread| aThread.join }
23
+ @commands.each do |command|
24
+ @results << command.result
25
+ end
26
+ end
27
+
28
+ def common_key?(k)
29
+ if !@results or @results.empty?
30
+ return false
31
+ end
32
+ @results.each do |result|
33
+ if !result[k] then
34
+ return false
35
+ end
36
+ end
37
+ return true
38
+ end
39
+
40
+ def equal_gems?(k)
41
+ if !@results or @results.empty?
42
+ return false
43
+ end
44
+ if !common_key?(k)
45
+ return false
46
+ end
47
+ version = @results[0][k].version
48
+ md5 = @results[0][k].md5
49
+ @results.each do |result|
50
+ if result[k].version != version
51
+ return false
52
+ end
53
+ if result[k].md5 != md5
54
+ return false
55
+ end
56
+ version = result[k].version
57
+ md5 = result[k].md5
58
+ end
59
+ return true
60
+ end
61
+
62
+ def are_there_results?
63
+ if !@results
64
+ return false
65
+ end
66
+ if !@results[0]
67
+ return false
68
+ end
69
+ if !@results[1]
70
+ return false
71
+ end
72
+ return true
73
+ end
74
+
75
+ def print_html_diff
76
+ if !are_there_results?
77
+ return
78
+ end
79
+ puts "<table width='100%'>"
80
+ @results[0].each do |k,v|
81
+ if !common_key?(k) then
82
+ next
83
+ end
84
+ if equal_gems?(k) then
85
+ $stderr.puts "DEBUG: equal gems: #{k}"
86
+ next
87
+ end
88
+ puts "<tr><td><span style='font-weight:bold;'>#{k}</span></td></tr>"
89
+ version = @results[0][k].version
90
+ md5 = @results[0][k].md5
91
+ @results.each do |result|
92
+ puts "<tr>"
93
+ puts "<td>"
94
+ puts "#{result[k].origin}"
95
+ puts "</td>"
96
+ puts "<td>"
97
+ v_color = "black"
98
+ md5_color = "black"
99
+ if version != result[k].version then
100
+ v_color = "red"
101
+ else
102
+ if md5 != result[k].md5 then
103
+ md5_color = "red"
104
+ end
105
+ end
106
+ puts "<span style='color: #{v_color}'>"
107
+ if !version then
108
+ puts "error: look error log"
109
+ end
110
+ puts "#{result[k].version}"
111
+ puts "</span>"
112
+ puts "</td>"
113
+ puts "<td>"
114
+ puts "<span style='color: #{md5_color}'>"
115
+ if result[k].md5.empty? then
116
+ puts "error: look error log"
117
+ end
118
+ puts "#{result[k].md5}"
119
+ puts "</span>"
120
+ puts "</td>"
121
+ puts "</tr>"
122
+ version = result[k].version
123
+ md5 = result[k].md5
124
+ end
125
+ end
126
+ puts "</table>"
127
+ end
128
+
129
+ end
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/ruby
2
+ #TODO: implement license checker: ninka??
3
+ #TODO: do we need other checkers?
4
+ #TODO: implement a nicer interface
5
+
6
+ require "rubygems"
7
+ require "xmlsimple"
8
+ require "open-uri"
9
+ require "yaml"
10
+
11
+ require "gem_simple"
12
+ require "obs_gems"
13
+ require "lockfile_gems"
14
+ require "ruby_gems_gems"
15
+ require "gems_composite_command"
16
+
17
+ class GemStatus
18
+ def initialize(conf_file)
19
+ @conf_file = conf_file
20
+ begin
21
+ @conf = YAML::load(File::open(conf_file))
22
+ rescue
23
+ $stderr.puts "ERROR: There was a problem opening #{conf_file}"
24
+ end
25
+ end
26
+
27
+ def execute
28
+ gems_composite_command = GemsCompositeCommand.new
29
+ @conf.each do |c|
30
+ gems = eval(c["classname"]).new(c)
31
+ gems_composite_command.add_command(gems)
32
+ end
33
+ gems_composite_command.execute
34
+ puts "<html><head></head><body>"
35
+ gems_composite_command.print_html_diff
36
+ puts "</html"
37
+ end
38
+
39
+ end
40
+
@@ -0,0 +1,45 @@
1
+ require "rubygems"
2
+ require "xmlsimple"
3
+ require "open-uri"
4
+ require "zlib"
5
+
6
+ require "bundler"
7
+ require "ruby_gems_gems_gem_simple"
8
+ require "gems_command"
9
+ require "utils"
10
+
11
+ class LockfileGems < GemsCommand
12
+ def initialize(conf)
13
+ Utils::check_parameters('LockfileGems', conf, ["dirname", "filename", "gems_url"])
14
+ @dirname = conf['dirname']
15
+ @filename = conf['filename']
16
+ @gems_url = conf['gems_url']
17
+ @result = {}
18
+ end
19
+
20
+ def get_data
21
+ Dir.chdir(@dirname)
22
+ data = ""
23
+ begin
24
+ data = File.open(@filename).read
25
+ rescue
26
+ $stderr.puts "ERROR: There was a problem opening file #{filename} "
27
+ end
28
+ return data
29
+ end
30
+
31
+ def execute
32
+ $stderr.puts "DEBUG: reading #{@filename}"
33
+ file_data = get_data
34
+ if file_data.empty?
35
+ return
36
+ end
37
+ lockfile = Bundler::LockfileParser.new(file_data)
38
+ lockfile.specs.each do |spec|
39
+ name = spec.name
40
+ version = spec.version
41
+ @result[name] = RubyGemsGems_GemSimple.new(name, Gem::Version.create(version) , '', @filename, @gems_url)
42
+ end
43
+ end
44
+
45
+ end
data/lib/obs_gems.rb ADDED
@@ -0,0 +1,97 @@
1
+ require "rubygems"
2
+ require "xmlsimple"
3
+ require "open-uri"
4
+
5
+ require "gem_simple"
6
+ require "gems_command"
7
+ require "utils"
8
+
9
+ class OBSGems < GemsCommand
10
+ def initialize(conf)
11
+ Utils::check_parameters('OBSGems', conf, ["username", "password", "url", "obs_repo"])
12
+ @result = {}
13
+ @username = conf['username']
14
+ @password = conf['password']
15
+ @obs_url = conf['url']
16
+ @repo = conf['obs_repo']
17
+
18
+ end
19
+
20
+ def parse_link(linkinfo)
21
+ if linkinfo.length > 1 then
22
+ $stderr.puts "ERROR: There is more than one linkinfo element"
23
+ return
24
+ end
25
+ if !linkinfo[0]["project"] then
26
+ $stderr.puts "ERROR: Project element does not exists in linkinfo"
27
+ return
28
+ end
29
+ if !linkinfo[0]["package"] then
30
+ $stderr.puts "ERROR: Package element does not exists in linkinfo"
31
+ return
32
+ end
33
+ repo = linkinfo[0]["project"]
34
+ package = linkinfo[0]["package"]
35
+ if linkinfo[0]["rev"] then
36
+ rev = linkinfo[0]["rev"]
37
+ $stderr.puts "DEBUG: Revision in link: #{rev}."
38
+ package = package + "?rev=" + rev
39
+ end
40
+ $stderr.puts "DEBUG: follow link to project: #{repo} package: #{package}"
41
+ parse_rpm_data(repo, package)
42
+ end
43
+
44
+ def get_data(url)
45
+ data = ""
46
+ begin
47
+ data = open(url, :http_basic_authentication => [@username, @password]).read
48
+ rescue
49
+ $stderr.puts "ERROR: There was a problem opening #{url} "
50
+ end
51
+ return data
52
+ end
53
+
54
+ def parse_rpm_data(project, package)
55
+ url = @obs_url + "/" + project
56
+ rpm_url = url + "/" + package
57
+ response = get_data(rpm_url)
58
+ if response.empty? then
59
+ return
60
+ end
61
+ data = XmlSimple.xml_in(response)
62
+ if data["linkinfo"] then
63
+ $stderr.puts "DEBUG: #{data["name"]} is a link."
64
+ parse_link(data["linkinfo"])
65
+ return
66
+ end
67
+ if !data["entry"] then
68
+ $stderr.puts "ERROR: something went wrong retrieving info from #{project} : #{package}"
69
+ return
70
+ end
71
+ data["entry"].each do |entry|
72
+ if entry["name"].end_with?(".gem") then
73
+ name = gem_name(entry['name'])
74
+ version = gem_version(entry['name'])
75
+ md5 = entry['md5']
76
+ @result[name] = GemSimple.new(name, Gem::Version.new(version), md5, url)
77
+ end
78
+ end
79
+ end
80
+
81
+ def execute
82
+ url = @obs_url + "/" + @repo
83
+ response = get_data(url)
84
+ if response.empty? then
85
+ return
86
+ end
87
+ data = XmlSimple.xml_in(response)
88
+ data["entry"].each do |entry|
89
+ entry.each do |k,v|
90
+ if k == "name" and v.start_with?("rubygem-") then
91
+ parse_rpm_data(@repo, v)
92
+ end
93
+ end
94
+ end
95
+ end
96
+
97
+ end
@@ -0,0 +1,48 @@
1
+ require "rubygems"
2
+ require "xmlsimple"
3
+ require "open-uri"
4
+ require "zlib"
5
+
6
+ require "ruby_gems_gems_gem_simple"
7
+ require "gems_command"
8
+ require "utils"
9
+
10
+
11
+ class RubyGemsGems < GemsCommand
12
+
13
+ def initialize(conf)
14
+ Utils::check_parameters('RubyGemsGems', conf, ["url", "specs"])
15
+ @url = conf['url']
16
+ @specs = conf['specs']
17
+ @result = {}
18
+
19
+ end
20
+
21
+ def get_data
22
+ specs_url = @url + "/" + @specs
23
+ begin
24
+ source = open(specs_url)
25
+ gz = Zlib::GzipReader.new(source)
26
+ return gz.read
27
+ rescue
28
+ $stderr.puts "ERROR: There was a problem opening #{specs_url} "
29
+ end
30
+ return ""
31
+ end
32
+
33
+
34
+ def execute
35
+ response = get_data
36
+ if response.empty? then
37
+ return
38
+ end
39
+ data = Marshal.load(response)
40
+ data.each do |line|
41
+ name = line[0]
42
+ version = Gem::Version.new(line[1])
43
+ gems_url = "#{@url}/gems"
44
+ @result[name] = RubyGemsGems_GemSimple.new(name, version,'' , @url, gems_url)
45
+ end
46
+ end
47
+
48
+ end
@@ -0,0 +1,23 @@
1
+ require "gem_simple"
2
+
3
+ class RubyGemsGems_GemSimple < GemSimple
4
+
5
+ def initialize(name, version, md5, origin, gems_url)
6
+ super(name, version, md5, origin)
7
+ @gems_url = gems_url
8
+ end
9
+
10
+ def md5
11
+ gem_uri = "#{@gems_url}/#{@name}-#{@version}.gem"
12
+ $stderr.puts "DEBUG: download and md5 for #{@name} from #{gem_uri}"
13
+ begin
14
+ source = open(gem_uri)
15
+ digest = Digest::MD5.hexdigest(source.read)
16
+ return digest
17
+ rescue
18
+ $stderr.puts "ERROR: There was a problem opening #{gem_uri}"
19
+ end
20
+ return ""
21
+ end
22
+ end
23
+
data/lib/utils.rb ADDED
@@ -0,0 +1,18 @@
1
+ class Utils
2
+ def Utils.check_parameters(classname, conf, parameters)
3
+ if !conf['classname'] then
4
+ $stderr.puts "ERROR: trying to initialize #{classname} when parameter classname does not exists"
5
+ exit
6
+ end
7
+ if conf['classname'] != classname then
8
+ $stderr.puts "ERROR: trying to initialize #{classname} when parameter classname is #{conf['classname']}"
9
+ exit
10
+ end
11
+ parameters.each do |p|
12
+ if !conf[p] then
13
+ $stderr.puts "ERROR: parameter #{p} not found for #{classname}"
14
+ exit
15
+ end
16
+ end
17
+ end
18
+ end
data/test/Gemfile ADDED
@@ -0,0 +1,104 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'rake', '>=0.9.2'
4
+ gem 'rails', '3.1.1'
5
+
6
+ gem 'sqlite3-ruby', '>=1.3.3', :require => 'sqlite3'
7
+
8
+ # Use unicorn as the web server
9
+ # gem 'unicorn'
10
+
11
+ # Deploy with Capistrano
12
+ # gem 'capistrano'
13
+
14
+ # To use debugger
15
+ # gem 'ruby-debug'
16
+
17
+ # Bundle the extra gems:
18
+ # gem 'bj'
19
+ # gem 'nokogiri'
20
+ # gem 'sqlite3-ruby', :require => 'sqlite3'
21
+ # gem 'aws-s3', :require => 'aws/s3'
22
+
23
+ gem 'newrelic_rpm'
24
+
25
+ # Bundle gems for the local environment. Make sure to
26
+ # put test-only gems in this group so their generators
27
+ # and rake tasks are available in development mode:
28
+ group :test do
29
+ gem 'timecop'
30
+ gem 'shoulda'
31
+ gem 'ci_reporter'
32
+ gem 'factory_girl'
33
+ gem 'factory_girl_rails'
34
+ gem 'migration_test_helper'
35
+ gem 'mocha', :require => false
36
+ gem 'webmock', :require => 'webmock/test_unit'
37
+ gem 'fakefs', :require => 'fakefs/safe'
38
+ end
39
+
40
+ group :development do
41
+ gem 'parallel_tests'
42
+ end
43
+
44
+ gem 'multi_db'
45
+ gem 'haml'
46
+ gem 'sass'
47
+ gem 'friendly_id', '~> 3.3.0.rc2'
48
+ gem 'uuid_it'
49
+ gem 'RedCloth'
50
+ gem "gettext", '>=1.9.3'
51
+ #gem "gettext_activerecord"
52
+ gem "has_alter_ego"
53
+ gem 'oauth', '>=0.4.1'
54
+ gem "oauth-plugin"
55
+ gem 'thinking-sphinx', '~>2.0.5', :require => 'thinking_sphinx'
56
+ gem 'memcache-client'
57
+ gem 'system_timer'
58
+ gem 'ruby-openid'
59
+ gem 'fastercsv'
60
+ gem 'amazon-ec2'
61
+ gem 'aws-s3'
62
+ gem 'pg'
63
+ gem 'gruff'
64
+ gem 'rmagick', '=2.12.2'
65
+ gem 'awesome_nested_set'
66
+ gem 'verification', '>=1.0.2'
67
+ #, :git => 'git://github.com/collectiveidea/awesome_nested_set'
68
+ gem 'http_accept_language'
69
+ #, :git => 'git://github.com/iain/http_accept_language.git'
70
+ gem "will_paginate", '~> 3.0.pre4'
71
+ gem "net-ssh"
72
+ gem 'sass-rails'
73
+ gem "uglifier"
74
+ gem "yui-compressor"
75
+ # We need prototype-rails for the "render :update" blocks
76
+ gem 'prototype-rails'
77
+ gem 'daemons'
78
+ gem 'coffee-rails'
79
+ gem 'abingo'
80
+ gem 'dynamic_form'
81
+ gem 'private_pub'
82
+ gem 'faye'
83
+
84
+ gem "omniauth", '>=0.2.6'
85
+ gem "has_mobile_views"
86
+
87
+ ## Feedzirra not needed for Onsite or kiosk
88
+ #unless OPTS.onsite_mode or OPTS.kiosk_mode
89
+ gem 'feedzirra', '>=0.0.24'
90
+ #end
91
+
92
+ # TODO: Handle those special cases:
93
+ #if !OPTS.onsite_mode and OPTS.graylog2['enabled']
94
+ gem 'gelf'
95
+ #end
96
+
97
+ # to work around https://github.com/mikel/mail/issues/260,
98
+ # let's use https://github.com/mikel/mail/pull/265/files
99
+ gem 'mail'
100
+ #, :git => 'git://github.com/zimbatm/mail.git'
101
+
102
+ group :test do
103
+ gem "rcov"
104
+ end
data/test/Gemfile.lock ADDED
@@ -0,0 +1,340 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ POpen4 (0.1.4)
5
+ Platform (>= 0.4.0)
6
+ open4
7
+ Platform (0.4.0)
8
+ RedCloth (4.2.7)
9
+ XMLCanonicalizer (1.0.1)
10
+ log4r (>= 1.0.4)
11
+ abingo (1.0.3)
12
+ actionmailer (3.1.1)
13
+ actionpack (= 3.1.1)
14
+ mail (~> 2.3.0)
15
+ actionpack (3.1.1)
16
+ activemodel (= 3.1.1)
17
+ activesupport (= 3.1.1)
18
+ builder (~> 3.0.0)
19
+ erubis (~> 2.7.0)
20
+ i18n (~> 0.6)
21
+ rack (~> 1.3.2)
22
+ rack-cache (~> 1.1)
23
+ rack-mount (~> 0.8.2)
24
+ rack-test (~> 0.6.1)
25
+ sprockets (~> 2.0.2)
26
+ activemodel (3.1.1)
27
+ activesupport (= 3.1.1)
28
+ builder (~> 3.0.0)
29
+ i18n (~> 0.6)
30
+ activerecord (3.1.1)
31
+ activemodel (= 3.1.1)
32
+ activesupport (= 3.1.1)
33
+ arel (~> 2.2.1)
34
+ tzinfo (~> 0.3.29)
35
+ activeresource (3.1.1)
36
+ activemodel (= 3.1.1)
37
+ activesupport (= 3.1.1)
38
+ activesupport (3.1.1)
39
+ multi_json (~> 1.0)
40
+ addressable (2.2.6)
41
+ amazon-ec2 (0.9.17)
42
+ xml-simple (>= 1.0.12)
43
+ arel (2.2.1)
44
+ awesome_nested_set (2.0.1)
45
+ activerecord (>= 3.0.0)
46
+ aws-s3 (0.6.2)
47
+ builder
48
+ mime-types
49
+ xml-simple
50
+ babosa (0.3.5)
51
+ builder (3.0.0)
52
+ ci_reporter (1.6.5)
53
+ builder (>= 2.1.2)
54
+ coffee-rails (3.1.1)
55
+ coffee-script (>= 2.2.0)
56
+ railties (~> 3.1.0)
57
+ coffee-script (2.2.0)
58
+ coffee-script-source
59
+ execjs
60
+ coffee-script-source (1.1.2)
61
+ crack (0.1.7)
62
+ curb (0.7.15)
63
+ daemons (1.0.10)
64
+ dynamic_form (1.1.4)
65
+ em-hiredis (0.1.0)
66
+ hiredis (~> 0.3.0)
67
+ em-http-request (0.3.0)
68
+ addressable (>= 2.0.0)
69
+ escape_utils
70
+ eventmachine (>= 0.12.9)
71
+ erubis (2.7.0)
72
+ escape_utils (0.2.4)
73
+ eventmachine (0.12.10)
74
+ execjs (1.2.0)
75
+ multi_json (~> 1.0)
76
+ factory_girl (2.1.2)
77
+ activesupport
78
+ factory_girl_rails (1.2.0)
79
+ factory_girl (~> 2.1.0)
80
+ railties (>= 3.0.0)
81
+ fakefs (0.4.0)
82
+ faraday (0.7.5)
83
+ addressable (~> 2.2.6)
84
+ multipart-post (~> 1.1.3)
85
+ rack (>= 1.1.0, < 2)
86
+ fastercsv (1.5.4)
87
+ faye (0.6.7)
88
+ em-hiredis (>= 0.0.1)
89
+ em-http-request (~> 0.3)
90
+ eventmachine (~> 0.12.0)
91
+ json (>= 1.0)
92
+ rack (>= 1.0)
93
+ thin (~> 1.2)
94
+ feedzirra (0.1.1)
95
+ activesupport (>= 3.0.8)
96
+ builder (>= 2.1.2)
97
+ curb (~> 0.7.15)
98
+ i18n (>= 0.5.0)
99
+ loofah (~> 1.2.0)
100
+ nokogiri (>= 1.4.4)
101
+ rake (>= 0.8.7)
102
+ rdoc (~> 3.8)
103
+ sax-machine (~> 0.1.0)
104
+ friendly_id (3.3.0.rc2)
105
+ babosa (~> 0.3.0)
106
+ gelf (1.1.3)
107
+ json
108
+ gettext (2.1.0)
109
+ locale (>= 2.0.5)
110
+ gruff (0.3.6)
111
+ haml (3.1.2)
112
+ has_alter_ego (0.0.9)
113
+ has_mobile_views (0.0.3)
114
+ hike (1.2.1)
115
+ hiredis (0.3.2)
116
+ http_accept_language (1.0.3)
117
+ i18n (0.6.0)
118
+ json (1.6.1)
119
+ locale (2.0.5)
120
+ log4r (1.1.9)
121
+ loofah (1.2.0)
122
+ nokogiri (>= 1.4.4)
123
+ macaddr (1.0.0)
124
+ mail (2.3.0)
125
+ i18n (>= 0.4.0)
126
+ mime-types (~> 1.16)
127
+ treetop (~> 1.4.8)
128
+ memcache-client (1.8.3)
129
+ metaclass (0.0.1)
130
+ migration_test_helper (1.3.3)
131
+ mime-types (1.16)
132
+ mocha (0.10.0)
133
+ metaclass (~> 0.0.1)
134
+ multi_db (0.3.0)
135
+ activerecord (>= 2.1.0)
136
+ tlattr_accessors (>= 0.0.3)
137
+ multi_json (1.0.3)
138
+ multi_xml (0.4.1)
139
+ multipart-post (1.1.3)
140
+ net-ldap (0.2.2)
141
+ net-ssh (2.0.23)
142
+ newrelic_rpm (3.3.0)
143
+ nokogiri (1.5.0)
144
+ oa-basic (0.3.0)
145
+ oa-core (= 0.3.0)
146
+ rest-client (~> 1.6.0)
147
+ oa-core (0.3.0)
148
+ oa-enterprise (0.3.0)
149
+ XMLCanonicalizer (~> 1.0.1)
150
+ addressable (~> 2.2.6)
151
+ net-ldap (~> 0.2.2)
152
+ nokogiri (~> 1.5.0)
153
+ oa-core (= 0.3.0)
154
+ pyu-ruby-sasl (~> 0.0.3.1)
155
+ rubyntlm (~> 0.1.1)
156
+ uuid
157
+ oa-more (0.3.0)
158
+ multi_json (~> 1.0.0)
159
+ oa-core (= 0.3.0)
160
+ rest-client (~> 1.6.0)
161
+ oa-oauth (0.3.0)
162
+ faraday (~> 0.7.3)
163
+ multi_json (~> 1.0.0)
164
+ multi_xml (~> 0.4.0)
165
+ oa-core (= 0.3.0)
166
+ oauth (~> 0.4.0)
167
+ oauth2 (~> 0.5.0)
168
+ oa-openid (0.3.0)
169
+ oa-core (= 0.3.0)
170
+ rack-openid (~> 1.3.1)
171
+ ruby-openid-apps-discovery (~> 1.2.0)
172
+ oauth (0.4.5)
173
+ oauth-plugin (0.3.14)
174
+ oauth (>= 0.3.5)
175
+ oauth2 (0.5.1)
176
+ faraday (~> 0.7.4)
177
+ multi_json (~> 1.0.3)
178
+ omniauth (0.3.0)
179
+ oa-basic (= 0.3.0)
180
+ oa-core (= 0.3.0)
181
+ oa-enterprise (= 0.3.0)
182
+ oa-more (= 0.3.0)
183
+ oa-oauth (= 0.3.0)
184
+ oa-openid (= 0.3.0)
185
+ open4 (1.0.1)
186
+ parallel (0.5.11)
187
+ parallel_tests (0.6.12)
188
+ parallel
189
+ pg (0.11.0)
190
+ polyglot (0.3.2)
191
+ private_pub (0.2.0)
192
+ prototype-rails (3.1.0)
193
+ rails (~> 3.1)
194
+ pyu-ruby-sasl (0.0.3.2)
195
+ rack (1.3.5)
196
+ rack-cache (1.1)
197
+ rack (>= 0.4)
198
+ rack-mount (0.8.3)
199
+ rack (>= 1.0.0)
200
+ rack-openid (1.3.1)
201
+ rack (>= 1.1.0)
202
+ ruby-openid (>= 2.1.8)
203
+ rack-ssl (1.3.2)
204
+ rack
205
+ rack-test (0.6.1)
206
+ rack (>= 1.0)
207
+ rails (3.1.1)
208
+ actionmailer (= 3.1.1)
209
+ actionpack (= 3.1.1)
210
+ activerecord (= 3.1.1)
211
+ activeresource (= 3.1.1)
212
+ activesupport (= 3.1.1)
213
+ bundler (~> 1.0)
214
+ railties (= 3.1.1)
215
+ railties (3.1.1)
216
+ actionpack (= 3.1.1)
217
+ activesupport (= 3.1.1)
218
+ rack-ssl (~> 1.3.2)
219
+ rake (>= 0.8.7)
220
+ rdoc (~> 3.4)
221
+ thor (~> 0.14.6)
222
+ rake (0.9.2)
223
+ rcov (0.9.10)
224
+ rdoc (3.9.1)
225
+ rest-client (1.6.7)
226
+ mime-types (>= 1.16)
227
+ riddle (1.3.3)
228
+ rmagick (2.12.2)
229
+ ruby-openid (2.1.8)
230
+ ruby-openid-apps-discovery (1.2.0)
231
+ ruby-openid (>= 2.1.7)
232
+ rubyntlm (0.1.1)
233
+ sass (3.1.10)
234
+ sass-rails (3.1.4)
235
+ actionpack (~> 3.1.0)
236
+ railties (~> 3.1.0)
237
+ sass (>= 3.1.4)
238
+ sprockets (~> 2.0.0)
239
+ tilt (~> 1.3.2)
240
+ sax-machine (0.1.0)
241
+ nokogiri (> 0.0.0)
242
+ shoulda (2.11.3)
243
+ sprockets (2.0.2)
244
+ hike (~> 1.2)
245
+ rack (~> 1.0)
246
+ tilt (~> 1.1, != 1.3.0)
247
+ sqlite3 (1.3.4)
248
+ sqlite3-ruby (1.3.3)
249
+ sqlite3 (>= 1.3.3)
250
+ system_timer (1.2.4)
251
+ thin (1.2.11)
252
+ daemons (>= 1.0.9)
253
+ eventmachine (>= 0.12.6)
254
+ rack (>= 1.0.0)
255
+ thinking-sphinx (2.0.5)
256
+ activerecord (>= 3.0.3)
257
+ riddle (>= 1.3.3)
258
+ thor (0.14.6)
259
+ tilt (1.3.3)
260
+ timecop (0.3.5)
261
+ tlattr_accessors (0.0.3)
262
+ treetop (1.4.9)
263
+ polyglot (>= 0.3.1)
264
+ tzinfo (0.3.30)
265
+ uglifier (1.0.0)
266
+ execjs (>= 0.3.0)
267
+ multi_json (>= 1.0.2)
268
+ uuid (2.3.2)
269
+ macaddr (~> 1.0)
270
+ uuid_it (0.1.0)
271
+ verification (1.0.2)
272
+ actionpack (>= 3.0.0, < 3.2.0)
273
+ activesupport (>= 3.0.0, < 3.2.0)
274
+ webmock (1.7.7)
275
+ addressable (~> 2.2, > 2.2.5)
276
+ crack (>= 0.1.7)
277
+ will_paginate (3.0.0)
278
+ xml-simple (1.0.12)
279
+ yui-compressor (0.9.6)
280
+ POpen4 (>= 0.1.4)
281
+
282
+ PLATFORMS
283
+ ruby
284
+
285
+ DEPENDENCIES
286
+ RedCloth
287
+ abingo
288
+ amazon-ec2
289
+ awesome_nested_set
290
+ aws-s3
291
+ ci_reporter
292
+ coffee-rails
293
+ daemons
294
+ dynamic_form
295
+ factory_girl
296
+ factory_girl_rails
297
+ fakefs
298
+ fastercsv
299
+ faye
300
+ feedzirra (>= 0.0.24)
301
+ friendly_id (~> 3.3.0.rc2)
302
+ gelf
303
+ gettext (>= 1.9.3)
304
+ gruff
305
+ haml
306
+ has_alter_ego
307
+ has_mobile_views
308
+ http_accept_language
309
+ mail
310
+ memcache-client
311
+ migration_test_helper
312
+ mocha
313
+ multi_db
314
+ net-ssh
315
+ newrelic_rpm
316
+ oauth (>= 0.4.1)
317
+ oauth-plugin
318
+ omniauth (>= 0.2.6)
319
+ parallel_tests
320
+ pg
321
+ private_pub
322
+ prototype-rails
323
+ rails (= 3.1.1)
324
+ rake (>= 0.9.2)
325
+ rcov
326
+ rmagick (= 2.12.2)
327
+ ruby-openid
328
+ sass
329
+ sass-rails
330
+ shoulda
331
+ sqlite3-ruby (>= 1.3.3)
332
+ system_timer
333
+ thinking-sphinx (~> 2.0.5)
334
+ timecop
335
+ uglifier
336
+ uuid_it
337
+ verification (>= 1.0.2)
338
+ webmock
339
+ will_paginate (~> 3.0.pre4)
340
+ yui-compressor
@@ -0,0 +1,9 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ test (0.8.6)
5
+
6
+ PLATFORMS
7
+ ruby
8
+
9
+ DEPENDENCIES
@@ -0,0 +1,63 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
+ require 'test/unit'
3
+ require 'gems_command'
4
+
5
+ class TestGemsCommand < Test::Unit::TestCase
6
+ def test_gem_name_wrong_name
7
+ gem_name = 'wrong_name'
8
+ result = GemsCommand.new.gem_name(gem_name)
9
+ expected = gem_name
10
+ assert_equal(result, expected)
11
+ end
12
+
13
+ def test_gem_name_without_version
14
+ gem_name = 'name.gem'
15
+ result = GemsCommand.new.gem_name(gem_name)
16
+ expected = 'name'
17
+ assert_equal(result, expected)
18
+ end
19
+
20
+ def test_gem_name_simple
21
+ gem_name = 'name-1.0.0.gem'
22
+ result = GemsCommand.new.gem_name(gem_name)
23
+ expected = 'name'
24
+ assert_equal(result, expected)
25
+ end
26
+
27
+ def test_gem_name_with_dashes
28
+ gem_name = 'name-1-1.0.0.gem'
29
+ result = GemsCommand.new.gem_name(gem_name)
30
+ expected = 'name-1'
31
+ assert_equal(result, expected)
32
+ end
33
+
34
+ def test_gem_version_no_version
35
+ gem_name = 'name.gem'
36
+ result = GemsCommand.new.gem_version(gem_name)
37
+ expected = '-1'
38
+ assert_equal(result, expected)
39
+ end
40
+
41
+ def test_gem_version_wrong_name
42
+ gem_name = 'name-1.0'
43
+ result = GemsCommand.new.gem_version(gem_name)
44
+ expected = '-1'
45
+ assert_equal(result, expected)
46
+ end
47
+
48
+ def test_gem_version_simple_version
49
+ gem_name = 'name-1.0.0.gem'
50
+ result = GemsCommand.new.gem_version(gem_name)
51
+ expected = '1.0.0'
52
+ assert_equal(result, expected)
53
+ end
54
+
55
+ def test_gem_version_with_dashes
56
+ gem_name = 'name-a-1.0.0.gem'
57
+ result = GemsCommand.new.gem_version(gem_name)
58
+ expected = '1.0.0'
59
+ assert_equal(result, expected)
60
+ end
61
+
62
+ end
63
+
@@ -0,0 +1,86 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
+ require 'test/unit'
3
+ require 'gems_composite_command'
4
+
5
+ class GemsCompositeCommandTest < GemsCompositeCommand
6
+ attr_accessor :results
7
+ end
8
+
9
+ class TestGemsCompositeCommand < Test::Unit::TestCase
10
+ def test_common_key_in_empty_results
11
+ gemscompositecommand = GemsCompositeCommand.new
12
+ result = gemscompositecommand.common_key?("this key does not exists")
13
+ assert(!result)
14
+ end
15
+ def test_common_key_in_zero_coincidences_one_result
16
+ gemscompositecommand = GemsCompositeCommandTest.new
17
+ gemscompositecommand.results = [{"a key"=>"a value"}]
18
+ result = gemscompositecommand.common_key?("this key does not exists")
19
+ assert(!result)
20
+ end
21
+ def test_common_key_in_zero_coincidences_two_results
22
+ gemscompositecommand = GemsCompositeCommandTest.new
23
+ gemscompositecommand.results = [{"a key"=>"a value"},{"another key"=>"another value"}]
24
+ result = gemscompositecommand.common_key?("this key does not exists")
25
+ assert(!result)
26
+ end
27
+ def test_common_key_in_one_coincidence_one_results
28
+ gemscompositecommand = GemsCompositeCommandTest.new
29
+ gemscompositecommand.results = [{"a key"=>"a value"}]
30
+ result = gemscompositecommand.common_key?("a key")
31
+ assert(result)
32
+ end
33
+ def test_common_key_in_one_coincidence_two_results
34
+ gemscompositecommand = GemsCompositeCommandTest.new
35
+ gemscompositecommand.results = [{"a key"=>"a value"},{"another key"=>"another value"}]
36
+ result = gemscompositecommand.common_key?("a key")
37
+ assert(!result)
38
+ end
39
+ def test_common_key_in_two_coincidence_two_results
40
+ gemscompositecommand = GemsCompositeCommandTest.new
41
+ gemscompositecommand.results = [{"a key"=>"a value"},{"a key"=>"another value"}]
42
+ result = gemscompositecommand.common_key?("a key")
43
+ assert(result)
44
+ end
45
+ def test_equals_when_no_common_keys
46
+ gemscompositecommand = GemsCompositeCommandTest.new
47
+ gem1 = GemSimple.new("foo_name","foo_version","md5","origin1")
48
+ gem2 = GemSimple.new("foo_name","foo_version","md5","origin2")
49
+ gem3 = GemSimple.new("bar_name","bar_version","md5","origin3")
50
+ gemscompositecommand.results = [{"foo"=>gem1},{"foo"=>gem2},{"bar"=>gem3}]
51
+ result = gemscompositecommand.equal_gems?("foo")
52
+ assert(!result)
53
+ end
54
+ def test_equals_when_version_not_equals
55
+ gemscompositecommand = GemsCompositeCommandTest.new
56
+ gem1 = GemSimple.new("foo_name","foo_version","md5","origin1")
57
+ gem2 = GemSimple.new("foo_name","foo_version","md5","origin2")
58
+ gem3 = GemSimple.new("foo_name","bar_version","md5","origin3")
59
+ gemscompositecommand.results = [{"foo"=>gem1},{"foo"=>gem2},{"foo"=>gem3}]
60
+ result = gemscompositecommand.equal_gems?("foo")
61
+ assert(!result)
62
+ end
63
+ def test_equals_when_md5_not_equals
64
+ gemscompositecommand = GemsCompositeCommandTest.new
65
+ gem1 = GemSimple.new("foo_name","foo_version","md5","origin1")
66
+ gem2 = GemSimple.new("foo_name","foo_version","md5","origin2")
67
+ gem3 = GemSimple.new("foo_name","foo_version","md5_2","origin3")
68
+ gemscompositecommand.results = [{"foo"=>gem1},{"foo"=>gem2},{"foo"=>gem3}]
69
+ result = gemscompositecommand.equal_gems?("foo")
70
+ assert(!result)
71
+ end
72
+ def test_equals_when_equals
73
+ gemscompositecommand = GemsCompositeCommandTest.new
74
+ gem1 = GemSimple.new("foo_name","foo_version","md5","origin1")
75
+ gem2 = GemSimple.new("foo_name","foo_version","md5","origin2")
76
+ gem3 = GemSimple.new("foo_name","foo_version","md5","origin3")
77
+ gemscompositecommand.results = [{"foo"=>gem1},{"foo"=>gem2},{"foo"=>gem3}]
78
+ result = gemscompositecommand.equal_gems?("foo")
79
+ assert(result)
80
+ end
81
+ def test_equals_when_no_results
82
+ gemscompositecommand = GemsCompositeCommandTest.new
83
+ result = gemscompositecommand.equal_gems?("foo")
84
+ assert(!result)
85
+ end
86
+ end
@@ -0,0 +1,25 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
+ require 'test/unit'
3
+ require 'lockfile_gems'
4
+
5
+ class LockfileGemsTest < LockfileGems
6
+ attr_accessor :result
7
+ def initialize
8
+ @dirname = "."
9
+ @filename = "Gemfile.lock.test"
10
+ @gems_url = ""
11
+ @result = {}
12
+ end
13
+ end
14
+
15
+ class TestLockfileGems < Test::Unit::TestCase
16
+ def test_get_rubygems_data
17
+ lockfilegems = LockfileGemsTest.new
18
+ lockfilegems.execute
19
+ result = lockfilegems.result["test"].name
20
+ assert_equal("test",result)
21
+ result = lockfilegems.result["test"].version
22
+ assert_equal(Gem::Version.new("0.8.6"), result)
23
+ end
24
+ end
25
+
@@ -0,0 +1,37 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
+ require 'test/unit'
3
+ require 'obs_gems'
4
+
5
+ class OBSGemsTest < OBSGems
6
+ attr_accessor :result
7
+ def get_data(url)
8
+ return '<directory name="rubygem-test" rev="3" vrev="3" srcmd5="85dff037c5d450f68e3724af3624c6b4">
9
+ <entry name="rubygem-test.changes" md5="410f50267b43b7dba33b54cb3f588ecb" size="284" mtime="1276279120" />
10
+ <entry name="rubygem-test.spec" md5="6a519f6a782a6f3cb151feef1ab69aaa" size="1827" mtime="1276279120" />
11
+ <entry name="test-0.8.6.gem" md5="123" size="12288" mtime="1262870828" />
12
+ </directory>
13
+ '
14
+ end
15
+ def initialize
16
+ @result = {}
17
+ @username = ""
18
+ @password = ""
19
+ @obs_url = ""
20
+ @repo = ""
21
+ end
22
+ end
23
+
24
+ class TestObsGems < Test::Unit::TestCase
25
+ def test_get_rubygem_data
26
+ obsgems = OBSGemsTest.new
27
+ obsgems.execute
28
+ result = obsgems.result["test"].name
29
+ assert_equal("test", result)
30
+ result = obsgems.result["test"].version
31
+ assert_equal(Gem::Version.new("0.8.6"), result)
32
+ result = obsgems.result["test"].md5
33
+ assert_equal("123", result)
34
+ end
35
+ end
36
+
37
+
@@ -0,0 +1,29 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
+ require 'test/unit'
3
+ require 'ruby_gems_gems'
4
+
5
+ class RubyGemsGemsTest < RubyGemsGems
6
+ def initialize
7
+ @url = ""
8
+ @specs = ""
9
+ @result = {}
10
+ end
11
+
12
+ def get_data
13
+ return Marshal.dump([["test","0.8.6"]])
14
+ end
15
+ end
16
+
17
+ class TestRubyGemsGems < Test::Unit::TestCase
18
+ def test_get_rubygems_data
19
+ rubygemsgems = RubyGemsGemsTest.new
20
+ rubygemsgems.execute
21
+ rubygemsgems.result.each {|k,v| puts "k: #{k} v: #{v}"}
22
+ result = rubygemsgems.result["test"].name
23
+ assert_equal("test",result)
24
+ result = rubygemsgems.result["test"].version
25
+ assert_equal(Gem::Version.new("0.8.6"), result)
26
+ end
27
+ end
28
+
29
+
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gems-status
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Jordi Massaguer Pla
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-02-02 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: xml-simple
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: bundler
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ description: gem-status compares rubygems information from different sources as for reporting which gems are outdated. Sources can be opensuse build service, rubygems.org or a gemfile.lock. Data compared is version and md5sum
49
+ email: jmassaguerpla@suse.de
50
+ executables:
51
+ - gems-status
52
+ extensions: []
53
+
54
+ extra_rdoc_files: []
55
+
56
+ files:
57
+ - LICENSE
58
+ - lib/ruby_gems_gems.rb
59
+ - lib/gem_simple.rb
60
+ - lib/lockfile_gems.rb
61
+ - lib/ruby_gems_gems_gem_simple.rb
62
+ - lib/gems_composite_command.rb
63
+ - lib/obs_gems.rb
64
+ - lib/gems_command.rb
65
+ - lib/gems_status.rb
66
+ - lib/utils.rb
67
+ - bin/gems-status
68
+ - test/Gemfile.lock.test
69
+ - test/test-gems_composite_command.rb
70
+ - test/test-gems_command.rb
71
+ - test/test-ruby_gems_gems.rb
72
+ - test/test-lockfile_gems.rb
73
+ - test/test-obs_gems.rb
74
+ - test/Gemfile.lock
75
+ - test/Gemfile
76
+ homepage: http://github.com/jordimassaguerpla/gems-status
77
+ licenses: []
78
+
79
+ post_install_message:
80
+ rdoc_options: []
81
+
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ hash: 3
90
+ segments:
91
+ - 0
92
+ version: "0"
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ hash: 3
99
+ segments:
100
+ - 0
101
+ version: "0"
102
+ requirements: []
103
+
104
+ rubyforge_project:
105
+ rubygems_version: 1.8.15
106
+ signing_key:
107
+ specification_version: 3
108
+ summary: compares rubygems from different sources
109
+ test_files: []
110
+