gems-status 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/gems-status +0 -1
- data/lib/exists_in_upstream.rb +21 -0
- data/lib/gem_checker.rb +6 -0
- data/lib/gem_simple.rb +3 -2
- data/lib/gems_command.rb +1 -0
- data/lib/gems_composite_command.rb +35 -54
- data/lib/gems_status.rb +11 -8
- data/lib/gems_status_metadata.rb +3 -0
- data/lib/lockfile_gems.rb +2 -1
- data/lib/not_native_gem_checker.rb +29 -0
- data/lib/not_rails_checker.rb +33 -0
- data/lib/obs_gems.rb +2 -1
- data/lib/ruby_gems_gems.rb +2 -1
- data/lib/ruby_gems_gems_gem_simple.rb +7 -5
- data/lib/utils.rb +3 -6
- data/lib/view_results.rb +162 -0
- data/test/Gemfile +4 -99
- data/test/Gemfile.lock +4 -329
- data/test/test-gems_composite_command.rb +32 -21
- data/test/test-utils.rb +51 -0
- metadata +11 -4
data/bin/gems-status
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'open-uri'
|
3
|
+
require 'gem_checker'
|
4
|
+
|
5
|
+
class ExistsInUpstream < GemChecker
|
6
|
+
def ExistsInUpstream.check?(gem)
|
7
|
+
$stderr.puts "DEBUG: Looking for #{gem.name}"
|
8
|
+
result = nil
|
9
|
+
gem_uri = "#{gem.gems_url}/#{gem.name}-#{gem.version}.gem"
|
10
|
+
begin
|
11
|
+
source = open(gem_uri)
|
12
|
+
return true
|
13
|
+
rescue
|
14
|
+
return false
|
15
|
+
end
|
16
|
+
end
|
17
|
+
def ExistsInUpstream.description
|
18
|
+
"This gem does not exist in upstream: "
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
data/lib/gem_checker.rb
ADDED
data/lib/gem_simple.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
class GemSimple
|
2
|
-
attr_reader :name, :version, :md5, :origin
|
3
|
-
def initialize(name, version, md5, origin)
|
2
|
+
attr_reader :name, :version, :md5, :origin, :gems_url
|
3
|
+
def initialize(name, version, md5, origin, gems_url=nil )
|
4
4
|
@name = name
|
5
5
|
@version = version
|
6
6
|
@md5 = md5
|
7
7
|
@origin = origin
|
8
|
+
@gems_url = gems_url
|
8
9
|
end
|
9
10
|
end
|
10
11
|
|
data/lib/gems_command.rb
CHANGED
@@ -1,16 +1,26 @@
|
|
1
1
|
require "gem_simple"
|
2
2
|
require "gems_command"
|
3
|
+
require "not_native_gem_checker"
|
4
|
+
require "not_rails_checker"
|
5
|
+
require "exists_in_upstream"
|
6
|
+
require "view_results"
|
3
7
|
|
4
8
|
class GemsCompositeCommand < GemsCommand
|
5
|
-
def initialize
|
9
|
+
def initialize(target)
|
6
10
|
@commands = []
|
7
|
-
@
|
11
|
+
@checkers = []
|
12
|
+
@results = {}
|
13
|
+
@target = target
|
8
14
|
end
|
9
15
|
|
10
16
|
def add_command(command)
|
11
17
|
@commands << command
|
12
18
|
end
|
13
19
|
|
20
|
+
def add_checker(check_class)
|
21
|
+
@checkers << check_class
|
22
|
+
end
|
23
|
+
|
14
24
|
def execute
|
15
25
|
threads = []
|
16
26
|
if !@commands then
|
@@ -21,15 +31,15 @@ class GemsCompositeCommand < GemsCommand
|
|
21
31
|
end
|
22
32
|
threads.each { |aThread| aThread.join }
|
23
33
|
@commands.each do |command|
|
24
|
-
@results
|
34
|
+
@results[command.ident] = command.result
|
25
35
|
end
|
26
36
|
end
|
27
37
|
|
28
38
|
def common_key?(k)
|
29
|
-
if
|
39
|
+
if !are_there_results?
|
30
40
|
return false
|
31
41
|
end
|
32
|
-
@results.each do |result|
|
42
|
+
@results.each do |key, result|
|
33
43
|
if !result[k] then
|
34
44
|
return false
|
35
45
|
end
|
@@ -38,15 +48,15 @@ class GemsCompositeCommand < GemsCommand
|
|
38
48
|
end
|
39
49
|
|
40
50
|
def equal_gems?(k)
|
41
|
-
if
|
51
|
+
if !are_there_results?
|
42
52
|
return false
|
43
53
|
end
|
44
54
|
if !common_key?(k)
|
45
55
|
return false
|
46
56
|
end
|
47
|
-
version = @results[
|
48
|
-
md5 = @results[
|
49
|
-
@results.each do |result|
|
57
|
+
version = @results[@target][k].version
|
58
|
+
md5 = @results[@target][k].md5
|
59
|
+
@results.each do |key, result|
|
50
60
|
if result[k].version != version
|
51
61
|
return false
|
52
62
|
end
|
@@ -60,70 +70,41 @@ class GemsCompositeCommand < GemsCommand
|
|
60
70
|
end
|
61
71
|
|
62
72
|
def are_there_results?
|
63
|
-
if !@results
|
73
|
+
if !@results or @results.empty?
|
64
74
|
return false
|
65
75
|
end
|
66
|
-
if !@results
|
76
|
+
if !@results.has_key?(@target)
|
67
77
|
return false
|
68
78
|
end
|
69
|
-
if
|
79
|
+
if @results.length<2
|
70
80
|
return false
|
71
81
|
end
|
72
82
|
return true
|
73
83
|
end
|
74
84
|
|
75
|
-
def
|
85
|
+
def print
|
86
|
+
ViewResults::print_head
|
87
|
+
ids = []
|
88
|
+
@commands.each { |c| ids << c.ident }
|
89
|
+
ViewResults::print_description(ids)
|
76
90
|
if !are_there_results?
|
77
91
|
return
|
78
92
|
end
|
79
|
-
|
80
|
-
@results[0].each do |k,v|
|
93
|
+
@results[@target].each do |k,v|
|
81
94
|
if !common_key?(k) then
|
95
|
+
$stderr.puts "ERROR: #{k} in #{@target} but not found in all the sources!"
|
82
96
|
next
|
83
97
|
end
|
84
98
|
if equal_gems?(k) then
|
85
|
-
$stderr.puts "DEBUG: equal gems: #{k}"
|
86
99
|
next
|
87
100
|
end
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
@results.each do |
|
92
|
-
|
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
|
101
|
+
ViewResults::print_diff(k, @results, @target)
|
102
|
+
end
|
103
|
+
@checkers.each do |check_class|
|
104
|
+
@results[@target].each do |k, gem|
|
105
|
+
ViewResults::print_check(check_class::description, gem.name) unless check_class::check?(gem)
|
124
106
|
end
|
125
107
|
end
|
126
|
-
|
108
|
+
ViewResults::print_tail
|
127
109
|
end
|
128
|
-
|
129
110
|
end
|
data/lib/gems_status.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
|
-
#TODO: implement license checker: ninka??
|
3
|
-
#TODO: do we need other checkers?
|
4
2
|
#TODO: implement a nicer interface
|
3
|
+
#
|
4
|
+
|
5
|
+
|
5
6
|
|
6
7
|
require "rubygems"
|
7
8
|
require "xmlsimple"
|
@@ -25,16 +26,18 @@ class GemStatus
|
|
25
26
|
end
|
26
27
|
|
27
28
|
def execute
|
28
|
-
gems_composite_command = GemsCompositeCommand.new
|
29
|
-
@conf.each do |c|
|
29
|
+
gems_composite_command = GemsCompositeCommand.new(@conf["target"])
|
30
|
+
@conf["sources"].each do |c|
|
30
31
|
gems = eval(c["classname"]).new(c)
|
31
32
|
gems_composite_command.add_command(gems)
|
32
33
|
end
|
34
|
+
if @conf["checkers"]
|
35
|
+
@conf["checkers"].each do |c|
|
36
|
+
gems_composite_command.add_checker(eval(c["classname"]))
|
37
|
+
end
|
38
|
+
end
|
33
39
|
gems_composite_command.execute
|
34
|
-
|
35
|
-
gems_composite_command.print_html_diff
|
36
|
-
puts "</html"
|
40
|
+
gems_composite_command.print
|
37
41
|
end
|
38
|
-
|
39
42
|
end
|
40
43
|
|
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, ["dirname", "filename", "gems_url"])
|
13
|
+
Utils::check_parameters('LockfileGems', conf, ["id", "dirname", "filename", "gems_url"])
|
14
14
|
@dirname = conf['dirname']
|
15
15
|
@filename = conf['filename']
|
16
16
|
@gems_url = conf['gems_url']
|
17
17
|
@result = {}
|
18
|
+
@ident = conf['id']
|
18
19
|
end
|
19
20
|
|
20
21
|
def get_data
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rubygems/format'
|
2
|
+
require 'rubygems/old_format'
|
3
|
+
require 'open-uri'
|
4
|
+
require 'gem_checker'
|
5
|
+
|
6
|
+
class NotNativeGemChecker < GemChecker
|
7
|
+
def NotNativeGemChecker.check?(gem)
|
8
|
+
result = nil
|
9
|
+
gem_uri = "#{gem.gems_url}/#{gem.name}-#{gem.version}.gem"
|
10
|
+
begin
|
11
|
+
source = open(gem_uri, Gem.binary_mode) do |io|
|
12
|
+
result = Gem::Format.from_io io
|
13
|
+
end
|
14
|
+
rescue IOError
|
15
|
+
#bug on open-uri:137 on closing strings
|
16
|
+
#it should be
|
17
|
+
#io.close if io && !io.closed?
|
18
|
+
#or is a bug on rubygems???
|
19
|
+
rescue => e
|
20
|
+
$stderr.puts "ERROR: There was a problem opening #{gem_uri} #{e.class} #{e.message}"
|
21
|
+
end
|
22
|
+
return false unless result
|
23
|
+
return result.spec.extensions.empty?
|
24
|
+
end
|
25
|
+
def NotNativeGemChecker.description
|
26
|
+
"This gem is a native gem or could not get specs: "
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rubygems/format'
|
2
|
+
require 'rubygems/old_format'
|
3
|
+
require 'open-uri'
|
4
|
+
require 'gem_checker'
|
5
|
+
|
6
|
+
class NotRailsChecker < GemChecker
|
7
|
+
def NotRailsChecker.check?(gem)
|
8
|
+
result = nil
|
9
|
+
gem_uri = "#{gem.gems_url}/#{gem.name}-#{gem.version}.gem"
|
10
|
+
begin
|
11
|
+
source = open(gem_uri, Gem.binary_mode) do |io|
|
12
|
+
result = Gem::Format.from_io io
|
13
|
+
end
|
14
|
+
rescue IOError
|
15
|
+
#bug on open-uri:137 on closing strings
|
16
|
+
#it should be
|
17
|
+
#io.close if io && !io.closed?
|
18
|
+
#or is a bug on rubygems???
|
19
|
+
rescue => e
|
20
|
+
$stderr.puts "ERROR: There was a problem opening #{gem_uri} #{e.class} #{e.message}"
|
21
|
+
end
|
22
|
+
return false unless result
|
23
|
+
result.spec.dependencies.each do |gem|
|
24
|
+
return false if gem.name == "rails"
|
25
|
+
end
|
26
|
+
return true
|
27
|
+
end
|
28
|
+
|
29
|
+
def NotRailsChecker.description
|
30
|
+
"This gem depends on rails or could not get spec: "
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
data/lib/obs_gems.rb
CHANGED
@@ -8,12 +8,13 @@ require "utils"
|
|
8
8
|
|
9
9
|
class OBSGems < GemsCommand
|
10
10
|
def initialize(conf)
|
11
|
-
Utils::check_parameters('OBSGems', conf, ["username", "password", "url", "obs_repo"])
|
11
|
+
Utils::check_parameters('OBSGems', conf, ["id", "username", "password", "url", "obs_repo"])
|
12
12
|
@result = {}
|
13
13
|
@username = conf['username']
|
14
14
|
@password = conf['password']
|
15
15
|
@obs_url = conf['url']
|
16
16
|
@repo = conf['obs_repo']
|
17
|
+
@ident = conf['id']
|
17
18
|
|
18
19
|
end
|
19
20
|
|
data/lib/ruby_gems_gems.rb
CHANGED
@@ -11,10 +11,11 @@ require "utils"
|
|
11
11
|
class RubyGemsGems < GemsCommand
|
12
12
|
|
13
13
|
def initialize(conf)
|
14
|
-
Utils::check_parameters('RubyGemsGems', conf, ["url", "specs"])
|
14
|
+
Utils::check_parameters('RubyGemsGems', conf, ["id", "url", "specs"])
|
15
15
|
@url = conf['url']
|
16
16
|
@specs = conf['specs']
|
17
17
|
@result = {}
|
18
|
+
@ident = conf['id']
|
18
19
|
|
19
20
|
end
|
20
21
|
|
@@ -3,21 +3,23 @@ require "gem_simple"
|
|
3
3
|
class RubyGemsGems_GemSimple < GemSimple
|
4
4
|
|
5
5
|
def initialize(name, version, md5, origin, gems_url)
|
6
|
-
super(name, version,
|
7
|
-
@gems_url = gems_url
|
6
|
+
super(name, version, nil, origin, gems_url)
|
8
7
|
end
|
9
8
|
|
10
9
|
def md5
|
10
|
+
if @md5
|
11
|
+
return @md5
|
12
|
+
end
|
11
13
|
gem_uri = "#{@gems_url}/#{@name}-#{@version}.gem"
|
12
14
|
$stderr.puts "DEBUG: download and md5 for #{@name} from #{gem_uri}"
|
13
15
|
begin
|
14
16
|
source = open(gem_uri)
|
15
|
-
|
16
|
-
return
|
17
|
+
@md5 = Digest::MD5.hexdigest(source.read)
|
18
|
+
return @md5
|
17
19
|
rescue
|
18
20
|
$stderr.puts "ERROR: There was a problem opening #{gem_uri}"
|
19
21
|
end
|
20
|
-
return
|
22
|
+
return nil
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
data/lib/utils.rb
CHANGED
@@ -1,17 +1,14 @@
|
|
1
1
|
class Utils
|
2
2
|
def Utils.check_parameters(classname, conf, parameters)
|
3
3
|
if !conf['classname'] then
|
4
|
-
|
5
|
-
exit
|
4
|
+
raise "ERROR: trying to initialize #{classname} when parameter classname does not exists"
|
6
5
|
end
|
7
6
|
if conf['classname'] != classname then
|
8
|
-
|
9
|
-
exit
|
7
|
+
raise "ERROR: trying to initialize #{classname} when parameter classname is #{conf['classname']}"
|
10
8
|
end
|
11
9
|
parameters.each do |p|
|
12
10
|
if !conf[p] then
|
13
|
-
|
14
|
-
exit
|
11
|
+
raise "ERROR: parameter #{p} not found for #{classname}"
|
15
12
|
end
|
16
13
|
end
|
17
14
|
end
|
data/lib/view_results.rb
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'gems_status_metadata'
|
3
|
+
|
4
|
+
class ViewResults
|
5
|
+
|
6
|
+
def ViewResults.print_description(ids)
|
7
|
+
puts "
|
8
|
+
<h1>gems-status</h1>
|
9
|
+
<p>This is a comparison between different gem sources:</p>
|
10
|
+
<ul>"
|
11
|
+
ids.each { |id| puts "<li>#{id}</li>" }
|
12
|
+
puts "</ul>
|
13
|
+
</p>
|
14
|
+
<p>The following table gives you an overview of:</p>
|
15
|
+
<ul>
|
16
|
+
<li>
|
17
|
+
<span class='alert'>patched</span>: gems that have same version but different md5sums
|
18
|
+
</li>
|
19
|
+
<li>
|
20
|
+
<span class='warning'>outdated</span>: gems that have different versions on the different sources
|
21
|
+
</li>
|
22
|
+
<li>
|
23
|
+
<span class='info'>up to date</span>: gems that are up to date in all the sources</span>
|
24
|
+
</li>
|
25
|
+
</ul>
|
26
|
+
<p>
|
27
|
+
Note that gems can be patched and outdated at the same time.
|
28
|
+
</p>
|
29
|
+
<p>
|
30
|
+
This information should help you decide which should be your next steps.
|
31
|
+
</p>
|
32
|
+
<ol>
|
33
|
+
<li> Maintain those gems that have been patched but are not outdated
|
34
|
+
</li>
|
35
|
+
<li> Update does gems that have been patched and are outdated
|
36
|
+
</li>
|
37
|
+
<li> Update does gems that are outdated
|
38
|
+
</li>
|
39
|
+
</ol>
|
40
|
+
<p>
|
41
|
+
After the comparison there are some checks that have been performed. Those checks imply also there is some kind of work to do
|
42
|
+
</p>
|
43
|
+
<p>
|
44
|
+
You should run gems-status periodically until the lists of patched, outdated and checks are gone.
|
45
|
+
</p>
|
46
|
+
"
|
47
|
+
end
|
48
|
+
|
49
|
+
def ViewResults.print_diff(k, results, target)
|
50
|
+
puts "<p>"
|
51
|
+
puts "<table width='100%' class='table_results'>"
|
52
|
+
version = results[target][k].version
|
53
|
+
md5 = results[target][k].md5
|
54
|
+
name_color = "info"
|
55
|
+
html_string = ""
|
56
|
+
results.each do |key, result|
|
57
|
+
html_string << "<tr>"
|
58
|
+
html_string << "<td>"
|
59
|
+
html_string << "#{result[k].origin}"
|
60
|
+
html_string << "</td>"
|
61
|
+
html_string << "<td>"
|
62
|
+
v_color = "info"
|
63
|
+
md5_color = "info"
|
64
|
+
if version != result[k].version then
|
65
|
+
v_color = "warning"
|
66
|
+
name_color = "warning" if name_color != "alert"
|
67
|
+
else
|
68
|
+
if md5 != result[k].md5 then
|
69
|
+
md5_color = name_color = "alert"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
html_string << "<span class='#{v_color}'>"
|
73
|
+
if !version then
|
74
|
+
html_string << "error: look error log"
|
75
|
+
end
|
76
|
+
html_string << "#{result[k].version}"
|
77
|
+
html_string << "</span>"
|
78
|
+
html_string << "</td>"
|
79
|
+
html_string << "<td>"
|
80
|
+
html_string << "<span class='#{md5_color}'>"
|
81
|
+
if result[k].md5.empty? then
|
82
|
+
html_string << "error: look error log"
|
83
|
+
end
|
84
|
+
html_string << "#{result[k].md5}"
|
85
|
+
html_string << "</span>"
|
86
|
+
html_string << "</td>"
|
87
|
+
html_string << "</tr>"
|
88
|
+
version = result[k].version
|
89
|
+
md5 = result[k].md5
|
90
|
+
end
|
91
|
+
puts "<tr><td><span class='#{name_color}'>#{k}</span></td></tr>"
|
92
|
+
puts html_string
|
93
|
+
puts "</table>"
|
94
|
+
puts "</p>"
|
95
|
+
end
|
96
|
+
|
97
|
+
def ViewResults.print_check(description, name_gem)
|
98
|
+
puts "<span class='check'> #{description} #{name_gem}</span><br/>"
|
99
|
+
end
|
100
|
+
|
101
|
+
def ViewResults.print_head
|
102
|
+
puts "<html>
|
103
|
+
<head>
|
104
|
+
<style>
|
105
|
+
body
|
106
|
+
{
|
107
|
+
font-size: 100%;
|
108
|
+
}
|
109
|
+
h1
|
110
|
+
{
|
111
|
+
font-size: 110%;
|
112
|
+
font-weight: bold;
|
113
|
+
}
|
114
|
+
.gem_name
|
115
|
+
{
|
116
|
+
color: #000000;
|
117
|
+
font-weight: bold;
|
118
|
+
}
|
119
|
+
.alert
|
120
|
+
{
|
121
|
+
color: #ff0000;
|
122
|
+
}
|
123
|
+
.warning
|
124
|
+
{
|
125
|
+
color: #ffaa00;
|
126
|
+
}
|
127
|
+
.info
|
128
|
+
{
|
129
|
+
color: #000000;
|
130
|
+
}
|
131
|
+
.info
|
132
|
+
{
|
133
|
+
color: #000000;
|
134
|
+
}
|
135
|
+
.footer
|
136
|
+
{
|
137
|
+
color: #aaaaaa;
|
138
|
+
font-size: 60%;
|
139
|
+
}
|
140
|
+
.check
|
141
|
+
{
|
142
|
+
font-style: italic;
|
143
|
+
color: #ff0000;
|
144
|
+
font-size: 80%;
|
145
|
+
}
|
146
|
+
.table_results
|
147
|
+
{
|
148
|
+
font-size: 80%;
|
149
|
+
}
|
150
|
+
</style>
|
151
|
+
</head>
|
152
|
+
<body>"
|
153
|
+
end
|
154
|
+
|
155
|
+
def ViewResults.print_tail
|
156
|
+
date = Time.now.strftime('%F0')
|
157
|
+
puts "<p class='footer'>run by <a href=\"https://github.com/jordimassaguerpla/gems-status\">gems-status</a> - #{date} - version: #{GemsStatusMetadata::VERSION}</p>
|
158
|
+
</body>
|
159
|
+
</html>"
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
data/test/Gemfile
CHANGED
@@ -1,104 +1,9 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
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
3
|
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
4
|
gem 'abingo'
|
80
|
-
gem '
|
81
|
-
gem '
|
82
|
-
gem '
|
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'
|
5
|
+
gem 'factory_girl_rails'
|
6
|
+
gem 'curb'
|
7
|
+
gem 'xml-simple'
|
8
|
+
gem 'fakefs'
|
101
9
|
|
102
|
-
group :test do
|
103
|
-
gem "rcov"
|
104
|
-
end
|
data/test/Gemfile.lock
CHANGED
@@ -1,340 +1,15 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
open4
|
7
|
-
Platform (0.4.0)
|
8
|
-
RedCloth (4.2.7)
|
9
|
-
XMLCanonicalizer (1.0.1)
|
10
|
-
log4r (>= 1.0.4)
|
4
|
+
gem 'fakefs'
|
5
|
+
system_timer (1.2.4)
|
11
6
|
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
7
|
factory_girl_rails (1.2.0)
|
79
|
-
|
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)
|
8
|
+
curb (0.7.15)
|
278
9
|
xml-simple (1.0.12)
|
279
|
-
|
280
|
-
POpen4 (>= 0.1.4)
|
10
|
+
fakefs (0.4.0)
|
281
11
|
|
282
12
|
PLATFORMS
|
283
13
|
ruby
|
284
14
|
|
285
15
|
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
|
@@ -8,78 +8,89 @@ end
|
|
8
8
|
|
9
9
|
class TestGemsCompositeCommand < Test::Unit::TestCase
|
10
10
|
def test_common_key_in_empty_results
|
11
|
-
gemscompositecommand = GemsCompositeCommand.new
|
11
|
+
gemscompositecommand = GemsCompositeCommand.new('id')
|
12
12
|
result = gemscompositecommand.common_key?("this key does not exists")
|
13
13
|
assert(!result)
|
14
14
|
end
|
15
15
|
def test_common_key_in_zero_coincidences_one_result
|
16
|
-
gemscompositecommand = GemsCompositeCommandTest.new
|
17
|
-
gemscompositecommand.results =
|
16
|
+
gemscompositecommand = GemsCompositeCommandTest.new('id')
|
17
|
+
gemscompositecommand.results['id'] = {"a key"=>"a value"}
|
18
18
|
result = gemscompositecommand.common_key?("this key does not exists")
|
19
19
|
assert(!result)
|
20
20
|
end
|
21
21
|
def test_common_key_in_zero_coincidences_two_results
|
22
|
-
gemscompositecommand = GemsCompositeCommandTest.new
|
23
|
-
gemscompositecommand.results =
|
22
|
+
gemscompositecommand = GemsCompositeCommandTest.new('id')
|
23
|
+
gemscompositecommand.results['id'] = {"a key"=>"a value"}
|
24
|
+
gemscompositecommand.results['id2'] = {"another key"=>"another value"}
|
24
25
|
result = gemscompositecommand.common_key?("this key does not exists")
|
25
26
|
assert(!result)
|
26
27
|
end
|
27
28
|
def test_common_key_in_one_coincidence_one_results
|
28
|
-
gemscompositecommand = GemsCompositeCommandTest.new
|
29
|
-
gemscompositecommand.results
|
29
|
+
gemscompositecommand = GemsCompositeCommandTest.new('id')
|
30
|
+
gemscompositecommand.results['id']= {"a key"=>"a value"}
|
30
31
|
result = gemscompositecommand.common_key?("a key")
|
31
|
-
assert(result)
|
32
|
+
assert(!result)
|
32
33
|
end
|
33
34
|
def test_common_key_in_one_coincidence_two_results
|
34
|
-
gemscompositecommand = GemsCompositeCommandTest.new
|
35
|
-
gemscompositecommand.results
|
35
|
+
gemscompositecommand = GemsCompositeCommandTest.new('id')
|
36
|
+
gemscompositecommand.results['id']= {"a key"=>"a value"}
|
37
|
+
gemscompositecommand.results['id2']= {"another key"=>"another value"}
|
36
38
|
result = gemscompositecommand.common_key?("a key")
|
37
39
|
assert(!result)
|
38
40
|
end
|
39
41
|
def test_common_key_in_two_coincidence_two_results
|
40
|
-
gemscompositecommand = GemsCompositeCommandTest.new
|
41
|
-
gemscompositecommand.results
|
42
|
+
gemscompositecommand = GemsCompositeCommandTest.new('id')
|
43
|
+
gemscompositecommand.results['id']= {"a key"=>"a value"}
|
44
|
+
gemscompositecommand.results['id2']= {"a key"=>"another value"}
|
42
45
|
result = gemscompositecommand.common_key?("a key")
|
43
46
|
assert(result)
|
44
47
|
end
|
45
48
|
def test_equals_when_no_common_keys
|
46
|
-
gemscompositecommand = GemsCompositeCommandTest.new
|
49
|
+
gemscompositecommand = GemsCompositeCommandTest.new('id')
|
47
50
|
gem1 = GemSimple.new("foo_name","foo_version","md5","origin1")
|
48
51
|
gem2 = GemSimple.new("foo_name","foo_version","md5","origin2")
|
49
52
|
gem3 = GemSimple.new("bar_name","bar_version","md5","origin3")
|
50
|
-
gemscompositecommand.results
|
53
|
+
gemscompositecommand.results['id']= {"foo"=>gem1}
|
54
|
+
gemscompositecommand.results['id2']= {"foo"=>gem2}
|
55
|
+
gemscompositecommand.results['id3']= {"bar"=>gem3}
|
51
56
|
result = gemscompositecommand.equal_gems?("foo")
|
52
57
|
assert(!result)
|
53
58
|
end
|
54
59
|
def test_equals_when_version_not_equals
|
55
|
-
gemscompositecommand = GemsCompositeCommandTest.new
|
60
|
+
gemscompositecommand = GemsCompositeCommandTest.new('id')
|
56
61
|
gem1 = GemSimple.new("foo_name","foo_version","md5","origin1")
|
57
62
|
gem2 = GemSimple.new("foo_name","foo_version","md5","origin2")
|
58
63
|
gem3 = GemSimple.new("foo_name","bar_version","md5","origin3")
|
59
|
-
gemscompositecommand.results
|
64
|
+
gemscompositecommand.results['id']= {"foo"=>gem1}
|
65
|
+
gemscompositecommand.results['id2']= {"foo"=>gem2}
|
66
|
+
gemscompositecommand.results['id3']= {"foo"=>gem3}
|
60
67
|
result = gemscompositecommand.equal_gems?("foo")
|
61
68
|
assert(!result)
|
62
69
|
end
|
63
70
|
def test_equals_when_md5_not_equals
|
64
|
-
gemscompositecommand = GemsCompositeCommandTest.new
|
71
|
+
gemscompositecommand = GemsCompositeCommandTest.new('id')
|
65
72
|
gem1 = GemSimple.new("foo_name","foo_version","md5","origin1")
|
66
73
|
gem2 = GemSimple.new("foo_name","foo_version","md5","origin2")
|
67
74
|
gem3 = GemSimple.new("foo_name","foo_version","md5_2","origin3")
|
68
|
-
gemscompositecommand.results
|
75
|
+
gemscompositecommand.results['id']= {"foo"=>gem1}
|
76
|
+
gemscompositecommand.results['id2']= {"foo"=>gem2}
|
77
|
+
gemscompositecommand.results['id3']= {"foo"=>gem3}
|
69
78
|
result = gemscompositecommand.equal_gems?("foo")
|
70
79
|
assert(!result)
|
71
80
|
end
|
72
81
|
def test_equals_when_equals
|
73
|
-
gemscompositecommand = GemsCompositeCommandTest.new
|
82
|
+
gemscompositecommand = GemsCompositeCommandTest.new('id')
|
74
83
|
gem1 = GemSimple.new("foo_name","foo_version","md5","origin1")
|
75
84
|
gem2 = GemSimple.new("foo_name","foo_version","md5","origin2")
|
76
85
|
gem3 = GemSimple.new("foo_name","foo_version","md5","origin3")
|
77
|
-
gemscompositecommand.results
|
86
|
+
gemscompositecommand.results['id']= {"foo"=>gem1}
|
87
|
+
gemscompositecommand.results['id2']= {"foo"=>gem2}
|
88
|
+
gemscompositecommand.results['id3']= {"foo"=>gem3}
|
78
89
|
result = gemscompositecommand.equal_gems?("foo")
|
79
90
|
assert(result)
|
80
91
|
end
|
81
92
|
def test_equals_when_no_results
|
82
|
-
gemscompositecommand = GemsCompositeCommandTest.new
|
93
|
+
gemscompositecommand = GemsCompositeCommandTest.new('id')
|
83
94
|
result = gemscompositecommand.equal_gems?("foo")
|
84
95
|
assert(!result)
|
85
96
|
end
|
data/test/test-utils.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rubygems'
|
4
|
+
require 'utils'
|
5
|
+
|
6
|
+
class TestUtils < Test::Unit::TestCase
|
7
|
+
def test_check_parameters_no_classname
|
8
|
+
begin
|
9
|
+
Utils::check_parameters("classname", {}, [])
|
10
|
+
assert(false)
|
11
|
+
rescue RuntimeError
|
12
|
+
assert(true)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
def test_check_parameters_different_class_name
|
16
|
+
begin
|
17
|
+
Utils::check_parameters("classname", { "classname" => "wrong_classname" },
|
18
|
+
[])
|
19
|
+
assert(false)
|
20
|
+
rescue RuntimeError
|
21
|
+
assert(true)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
def test_check_parameters_equal_class_name
|
25
|
+
begin
|
26
|
+
Utils::check_parameters("classname", { "classname" => "classname" },
|
27
|
+
[])
|
28
|
+
assert(true)
|
29
|
+
rescue RuntimeError
|
30
|
+
assert(false)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
def test_check_parameters_wrong_parameters
|
34
|
+
begin
|
35
|
+
Utils::check_parameters("classname", { "classname" => "classname" },
|
36
|
+
[ "parameter" ])
|
37
|
+
assert(false)
|
38
|
+
rescue RuntimeError
|
39
|
+
assert(true)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
def test_check_parameters_rigth_parameters
|
43
|
+
begin
|
44
|
+
Utils::check_parameters("classname", { "classname" => "classname",
|
45
|
+
"parameter" => "value" }, [ "parameter" ])
|
46
|
+
assert(true)
|
47
|
+
rescue RuntimeError
|
48
|
+
assert(false)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
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: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.2.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-02-
|
18
|
+
date: 2012-02-03 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: xml-simple
|
@@ -59,7 +59,13 @@ files:
|
|
59
59
|
- lib/gem_simple.rb
|
60
60
|
- lib/lockfile_gems.rb
|
61
61
|
- lib/ruby_gems_gems_gem_simple.rb
|
62
|
+
- lib/not_native_gem_checker.rb
|
62
63
|
- lib/gems_composite_command.rb
|
64
|
+
- lib/gems_status_metadata.rb
|
65
|
+
- lib/gem_checker.rb
|
66
|
+
- lib/exists_in_upstream.rb
|
67
|
+
- lib/not_rails_checker.rb
|
68
|
+
- lib/view_results.rb
|
63
69
|
- lib/obs_gems.rb
|
64
70
|
- lib/gems_command.rb
|
65
71
|
- lib/gems_status.rb
|
@@ -68,6 +74,7 @@ files:
|
|
68
74
|
- test/Gemfile.lock.test
|
69
75
|
- test/test-gems_composite_command.rb
|
70
76
|
- test/test-gems_command.rb
|
77
|
+
- test/test-utils.rb
|
71
78
|
- test/test-ruby_gems_gems.rb
|
72
79
|
- test/test-lockfile_gems.rb
|
73
80
|
- test/test-obs_gems.rb
|