gem-compare 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/Rakefile +3 -1
- data/lib/rubygems/commands/compare_command.rb +7 -1
- data/lib/rubygems/comparator.rb +76 -13
- data/lib/rubygems/comparator/base.rb +17 -62
- data/lib/rubygems/comparator/dependency_comparator.rb +9 -12
- data/lib/rubygems/comparator/dir_utils.rb +51 -0
- data/lib/rubygems/comparator/file_list_comparator.rb +83 -154
- data/lib/rubygems/comparator/gemfile_comparator.rb +28 -31
- data/lib/rubygems/comparator/monitor.rb +106 -0
- data/lib/rubygems/comparator/report.rb +48 -39
- data/lib/rubygems/comparator/report/entry.rb +38 -0
- data/lib/rubygems/comparator/spec_comparator.rb +10 -23
- data/lib/rubygems/comparator/utils.rb +133 -0
- data/test/rubygems/comparator/test_dependency_comparator.rb +2 -1
- data/test/rubygems/comparator/test_dir_utils.rb +52 -0
- data/test/rubygems/comparator/test_file_list_comparator.rb +5 -2
- data/test/rubygems/comparator/test_monitor.rb +53 -0
- data/test/rubygems/comparator/test_report.rb +23 -0
- data/test/rubygems/comparator/test_utils.rb +33 -0
- data/test/test_helper.rb +12 -1
- metadata +38 -2
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rubygems/test_case'
|
2
|
+
require 'rubygems/comparator'
|
3
|
+
|
4
|
+
class TestGemComparatorReport < Gem::TestCase
|
5
|
+
def setup
|
6
|
+
super
|
7
|
+
@report = Gem::Comparator::Report.new
|
8
|
+
@report['1'] << '1'
|
9
|
+
@report['1']['2'] << '2'
|
10
|
+
@report['1']['unused'].set_header 'Unused'
|
11
|
+
@report['1.1'].section do
|
12
|
+
nest('1.1.1').section do
|
13
|
+
puts [3, 3]
|
14
|
+
end
|
15
|
+
puts []
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_all_messages
|
20
|
+
assert_equal 2, @report['1'].all_messages.size
|
21
|
+
assert_equal 1, @report['1.1'].all_messages.size
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rubygems/test_case'
|
2
|
+
require 'rubygems/comparator'
|
3
|
+
|
4
|
+
class TestGemComparatorUtils < Gem::TestCase
|
5
|
+
def setup
|
6
|
+
super
|
7
|
+
# This should pull in Gem::Comparator::Utils
|
8
|
+
@test_comparator = Class.new(Gem::Comparator::Base).new
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_param_exist?
|
12
|
+
params = (Gem::Comparator::Utils::SPEC_PARAMS +
|
13
|
+
Gem::Comparator::Utils::SPEC_FILES_PARAMS +
|
14
|
+
Gem::Comparator::Utils::DEPENDENCY_PARAMS +
|
15
|
+
Gem::Comparator::Utils::GEMFILE_PARAMS)
|
16
|
+
|
17
|
+
params.each do |param|
|
18
|
+
assert_equal true, @test_comparator.send(:param_exists?, param)
|
19
|
+
end
|
20
|
+
|
21
|
+
assert_equal false, @test_comparator.send(:param_exists?, 'i_dont_exist')
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_filter_params
|
25
|
+
params = Gem::Comparator::Utils::SPEC_PARAMS
|
26
|
+
assert_equal ['license'], @test_comparator.send(:filter_params, params, 'license')
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_filter_for_brief_mode
|
30
|
+
exclude = Gem::Comparator::Utils::FILTER_WHEN_BRIEF + ['not_excluded']
|
31
|
+
assert_equal ['not_excluded'], @test_comparator.send(:filter_for_brief_mode, exclude)
|
32
|
+
end
|
33
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -5,7 +5,7 @@ class TestGemComparator < Gem::TestCase
|
|
5
5
|
def setup
|
6
6
|
super
|
7
7
|
|
8
|
-
options = { keep_all: true, log_all: true, no_color: true }
|
8
|
+
options = { keep_all: true, log_all: true, no_color: true, brief_mode: false }
|
9
9
|
versions = ['0.0.1', '0.0.2', '0.0.3', '0.0.4']
|
10
10
|
|
11
11
|
@comparator = Gem::Comparator.new(options)
|
@@ -18,3 +18,14 @@ class TestGemComparator < Gem::TestCase
|
|
18
18
|
@report = @comparator.report
|
19
19
|
end
|
20
20
|
end
|
21
|
+
|
22
|
+
class TestGemModule < Gem::TestCase
|
23
|
+
def setup
|
24
|
+
super
|
25
|
+
gemfiles_path = File.expand_path('gemfiles', File.dirname(__FILE__))
|
26
|
+
@v001 = File.join(gemfiles_path, 'lorem-0.0.1')
|
27
|
+
@v002 = File.join(gemfiles_path, 'lorem-0.0.2')
|
28
|
+
@v003 = File.join(gemfiles_path, 'lorem-0.0.3')
|
29
|
+
@v004 = File.join(gemfiles_path, 'lorem-0.0.4')
|
30
|
+
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem-compare
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josef Stribny
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: curl
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: diffy
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,15 +95,23 @@ files:
|
|
67
95
|
- lib/rubygems/comparator.rb
|
68
96
|
- lib/rubygems/comparator/base.rb
|
69
97
|
- lib/rubygems/comparator/dependency_comparator.rb
|
98
|
+
- lib/rubygems/comparator/dir_utils.rb
|
70
99
|
- lib/rubygems/comparator/file_list_comparator.rb
|
71
100
|
- lib/rubygems/comparator/gemfile_comparator.rb
|
101
|
+
- lib/rubygems/comparator/monitor.rb
|
72
102
|
- lib/rubygems/comparator/report.rb
|
103
|
+
- lib/rubygems/comparator/report/entry.rb
|
73
104
|
- lib/rubygems/comparator/spec_comparator.rb
|
105
|
+
- lib/rubygems/comparator/utils.rb
|
74
106
|
- lib/rubygems_plugin.rb
|
75
107
|
- test/rubygems/comparator/test_dependency_comparator.rb
|
108
|
+
- test/rubygems/comparator/test_dir_utils.rb
|
76
109
|
- test/rubygems/comparator/test_file_list_comparator.rb
|
77
110
|
- test/rubygems/comparator/test_gemfile_comparator.rb
|
111
|
+
- test/rubygems/comparator/test_monitor.rb
|
112
|
+
- test/rubygems/comparator/test_report.rb
|
78
113
|
- test/rubygems/comparator/test_spec_comparator.rb
|
114
|
+
- test/rubygems/comparator/test_utils.rb
|
79
115
|
- test/rubygems/test_gem_commands_compare_command.rb
|
80
116
|
- test/test_helper.rb
|
81
117
|
homepage: http://github.com/strzibny/gem-compare
|