gem-compare 1.1.0 → 1.2.0
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 -7
- data/lib/rubygems/commands/compare_command.rb +1 -1
- data/lib/rubygems/comparator/dir_utils.rb +1 -5
- data/lib/rubygems/comparator/file_list_comparator.rb +19 -8
- data/lib/rubygems/comparator/monitor.rb +22 -11
- data/lib/rubygems/comparator/report.rb +1 -1
- data/lib/rubygems/comparator/utils.rb +0 -1
- data/lib/rubygems/comparator/version.rb +1 -1
- data/test/rubygems/comparator/test_dir_utils.rb +3 -10
- data/test/rubygems/comparator/test_file_list_comparator.rb +6 -5
- data/test/rubygems/comparator/test_monitor.rb +78 -2
- data/test/rubygems/comparator/test_spec_comparator.rb +0 -5
- data/test/test_helper.rb +14 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0caaeffb3233009f5be958ac76e97a0f1f30ff83b9029833f83129ccfb682885
|
4
|
+
data.tar.gz: 40747fe01a1698f048dc67e98b7d28f2a0d52cd9c9f37badeba47ea2bf8f2e3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 449146838c58824fb8c9a74b357a2d51ee9f90dc69a10c7e40c8cc859562accb90946114c7c090a93122d4573b9ab8ef7cc175f9543e65c5d61d9361039d97bc
|
7
|
+
data.tar.gz: 60a07492868fbbe221089b1cb5afe3887e9f7e47f3aeafe72c72271aaf6c9e30f2fbd99560bbc999194b040ab34d19c33d01652c8da2fc22a7e496cd8695c946
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# gem-compare
|
2
2
|
|
3
|
-
|
3
|
+
gem-compare is a RubyGems plugin that compares different versions of the specified gem. It can help you to track changes in metadata through the time, see how dependencies were evolving and spot important changes in gem's files such as shebang or permissions modifications.
|
4
4
|
|
5
5
|
This is especially handy for:
|
6
6
|
|
@@ -20,7 +20,7 @@ $ gem install gem-compare
|
|
20
20
|
|
21
21
|
By default, `gem-compare` compares specified versions of the given gem and includes only changes in the final report. If it's supposed to compare file lists or Gemfiles it will need to download the gems, otherwise it just downloads the specs. If you want to keep the downloaded `.gem` files, use `-k` (as 'keep') option. If you want to see the full report use `-a` (as 'all') switch:
|
22
22
|
|
23
|
-
```
|
23
|
+
```bash
|
24
24
|
$ gem compare rails 3.0.0 4.0.0 -k
|
25
25
|
Compared versions: ["3.0.0", "4.0.0"]
|
26
26
|
DIFFERENT date:
|
@@ -63,7 +63,7 @@ Compared versions: ["3.0.0", "4.0.0"]
|
|
63
63
|
|
64
64
|
You can also specify what you are interested in by using -p (as 'param') option:
|
65
65
|
|
66
|
-
```
|
66
|
+
```bash
|
67
67
|
$ gem compare activesupport 4.0.0 4.1.0 -p 'runtime_dependency'
|
68
68
|
Compared versions: ["4.0.0", "4.1.0"]
|
69
69
|
DIFFERENT runtime dependencies:
|
@@ -79,7 +79,7 @@ Compared versions: ["4.0.0", "4.1.0"]
|
|
79
79
|
```
|
80
80
|
There are also shortcuts for favourite options. Use `--runtime` for runtime dependencies, `--gemfiles` for comparing Gemfiles or `--files` for comparing file lists:
|
81
81
|
|
82
|
-
```
|
82
|
+
```bash
|
83
83
|
$ gem compare rails 2.0.1 3.0.0 -k --files
|
84
84
|
Compared versions: ["2.0.1", "3.0.0"]
|
85
85
|
DIFFERENT files:
|
@@ -107,7 +107,7 @@ Compared versions: ["2.0.1", "3.0.0"]
|
|
107
107
|
|
108
108
|
If you would like to see all development dependencies for `prawn` since `0.1` version, let *gem-compare* expand the versions for you (`>=0.0` won't work as RubyGems asks for the latest spec only):
|
109
109
|
|
110
|
-
```
|
110
|
+
```bash
|
111
111
|
$ gem compare prawn '>=0.1' -k -a --development
|
112
112
|
Compared versions: ["0.1.0", "0.1.1", "0.1.2", "0.2.0", "0.2.1", "0.2.2", "0.2.3", "0.3.0", "0.4.0", "0.4.1", "0.5.0.1", "0.5.1", "0.6.1", "0.6.2", "0.6.3", "0.7.1", "0.7.2", "0.8.4", "0.11.1", "0.12.0", "0.13.0", "0.13.1", "0.13.2", "0.14.0", "0.15.0", "1.0.0", "1.1.0"]
|
113
113
|
DIFFERENT development dependencies:
|
@@ -140,7 +140,8 @@ Compared versions: ["0.1.0", "0.1.1", "0.1.2", "0.2.0", "0.2.1", "0.2.2", "0.2.3
|
|
140
140
|
|
141
141
|
*gem-compare* supports querying different gem platforms via standard `--platform` option. To compare
|
142
142
|
nokogiri gem on different platform run:
|
143
|
-
|
143
|
+
|
144
|
+
```bash
|
144
145
|
$ gem compare nokogiri 1.5.6 1.6.1 -ak --platform java # for JRuby
|
145
146
|
$ gem compare nokogiri 1.5.6 1.6.1 -ak --platform x86-mingw32 # on Windows
|
146
147
|
```
|
@@ -154,7 +155,8 @@ If you run your own gem source server, you can override the RubyGems.org default
|
|
154
155
|
### Supported options
|
155
156
|
|
156
157
|
To see all possible options run:
|
157
|
-
|
158
|
+
|
159
|
+
```bash
|
158
160
|
$ gem compare --help
|
159
161
|
```
|
160
162
|
|
@@ -24,7 +24,7 @@ class Gem::Commands::CompareCommand < Gem::Command
|
|
24
24
|
# Speficy the platform using --platform=PLATFORM
|
25
25
|
add_platform_option
|
26
26
|
|
27
|
-
add_option('-pPARAM', '--param PARAM', 'Compare only a given
|
27
|
+
add_option('-pPARAM', '--param PARAM', 'Compare only a given gemspec parameter (like "version")') do |param, options|
|
28
28
|
options[:param] = param
|
29
29
|
end
|
30
30
|
|
@@ -19,10 +19,6 @@ class Gem::Comparator
|
|
19
19
|
file_first_line(file1) == file_first_line(file2)
|
20
20
|
end
|
21
21
|
|
22
|
-
def self.file_permissions(file)
|
23
|
-
sprintf("%o", File.stat(file).mode)
|
24
|
-
end
|
25
|
-
|
26
22
|
def self.gem_bin_file?(file)
|
27
23
|
file =~ /(\A|.*\/)bin\/.*/
|
28
24
|
end
|
@@ -50,4 +46,4 @@ class Gem::Comparator
|
|
50
46
|
dirs
|
51
47
|
end
|
52
48
|
end
|
53
|
-
end
|
49
|
+
end
|
@@ -15,7 +15,7 @@ class Gem::Comparator
|
|
15
15
|
|
16
16
|
class FileListComparator < Gem::Comparator::Base
|
17
17
|
|
18
|
-
def initialize
|
18
|
+
def initialize(ignore_group_writable=true)
|
19
19
|
expect(:packages)
|
20
20
|
|
21
21
|
# We need diff
|
@@ -24,6 +24,8 @@ class Gem::Comparator
|
|
24
24
|
rescue Exception
|
25
25
|
error('Calling `diff` command failed. Do you have it installed?')
|
26
26
|
end
|
27
|
+
|
28
|
+
@ignore_group_writable = ignore_group_writable
|
27
29
|
end
|
28
30
|
|
29
31
|
##
|
@@ -77,7 +79,7 @@ class Gem::Comparator
|
|
77
79
|
end
|
78
80
|
end
|
79
81
|
# Add information about permissions, shebangs etc.
|
80
|
-
report = check_added_files(param, vers, index, added, report, options[:brief])
|
82
|
+
report = check_added_files(param, vers, index, added, report, options[:brief], options[:diff])
|
81
83
|
|
82
84
|
report[param][vers]['changed'].set_header '* Changed:'
|
83
85
|
report = check_same_files(param, vers, index, same, report, options[:brief], options[:diff])
|
@@ -127,18 +129,27 @@ class Gem::Comparator
|
|
127
129
|
[deleted, added]
|
128
130
|
end
|
129
131
|
|
130
|
-
def check_added_files(param, vers, index, files, report, brief_mode)
|
132
|
+
def check_added_files(param, vers, index, files, report, brief_mode, diff_mode)
|
131
133
|
files.each do |file|
|
132
134
|
added_file = File.join(unpacked_gem_dirs[@packages[index].spec.version], file)
|
133
135
|
|
134
|
-
|
136
|
+
line_changes = if diff_mode
|
137
|
+
Monitor.files_diff(nil, added_file)
|
138
|
+
else
|
139
|
+
Monitor.lines_changed(nil, added_file)
|
140
|
+
end
|
135
141
|
|
136
|
-
changes = Monitor.new_file_permissions(added_file),
|
142
|
+
changes = Monitor.new_file_permissions(added_file, @ignore_group_writable),
|
137
143
|
Monitor.new_file_executability(added_file),
|
138
144
|
Monitor.new_file_shebang(added_file)
|
139
145
|
|
140
|
-
if(!changes.join.empty? || !brief_mode)
|
141
|
-
|
146
|
+
if(!changes.join.empty? || (!brief_mode && !line_changes.empty?))
|
147
|
+
if diff_mode
|
148
|
+
report[param][vers]['added'][file].set_header file
|
149
|
+
report[param][vers]['added'][file] << line_changes.split("\n")
|
150
|
+
else
|
151
|
+
report[param][vers]['added'] << "#{file} #{line_changes}"
|
152
|
+
end
|
142
153
|
end
|
143
154
|
|
144
155
|
changes.each do |change|
|
@@ -161,7 +172,7 @@ class Gem::Comparator
|
|
161
172
|
Monitor.lines_changed(prev_file, curr_file)
|
162
173
|
end
|
163
174
|
|
164
|
-
changes = Monitor.files_permissions_changes(prev_file, curr_file),
|
175
|
+
changes = Monitor.files_permissions_changes(prev_file, curr_file, @ignore_group_writable),
|
165
176
|
Monitor.files_executability_changes(prev_file, curr_file),
|
166
177
|
Monitor.files_shebang_changes(prev_file, curr_file)
|
167
178
|
|
@@ -14,6 +14,7 @@ class Gem::Comparator
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.compact_files_diff(prev_file, curr_file)
|
17
|
+
prev_file = prev_file.nil? ? Tempfile.new.path : prev_file
|
17
18
|
changes = ''
|
18
19
|
Diffy::Diff.new(
|
19
20
|
prev_file, curr_file, :source => 'files', :context => 0
|
@@ -27,6 +28,7 @@ class Gem::Comparator
|
|
27
28
|
end
|
28
29
|
|
29
30
|
def self.files_diff(prev_file, curr_file)
|
31
|
+
prev_file = prev_file.nil? ? Tempfile.new.path : prev_file
|
30
32
|
changes = ''
|
31
33
|
Diffy::Diff.new(
|
32
34
|
prev_file, curr_file, :source => 'files', :context => 0, :include_diff_info => true
|
@@ -40,25 +42,30 @@ class Gem::Comparator
|
|
40
42
|
changes
|
41
43
|
end
|
42
44
|
|
43
|
-
def self.files_permissions_changes(prev_file, curr_file)
|
44
|
-
prev_permissions =
|
45
|
-
curr_permissions =
|
45
|
+
def self.files_permissions_changes(prev_file, curr_file, ignore_group_writable=false)
|
46
|
+
prev_permissions = File.stat(prev_file).mode
|
47
|
+
curr_permissions = File.stat(curr_file).mode
|
46
48
|
|
47
|
-
|
49
|
+
diff = prev_permissions ^ curr_permissions
|
50
|
+
diff ^= 020 if ignore_group_writable
|
51
|
+
|
52
|
+
if diff != 0
|
48
53
|
" (!) New permissions: " +
|
49
|
-
"#{prev_permissions} -> #{curr_permissions}"
|
54
|
+
"#{format_permissions(prev_permissions)} -> #{format_permissions(curr_permissions)}"
|
50
55
|
else
|
51
56
|
''
|
52
57
|
end
|
53
58
|
end
|
54
59
|
|
55
|
-
def self.new_file_permissions(file)
|
56
|
-
file_permissions =
|
60
|
+
def self.new_file_permissions(file, ignore_group_writable=false)
|
61
|
+
file_permissions = File.stat(file).mode
|
62
|
+
formatted_file_permissions = format_permissions(file_permissions)
|
57
63
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
64
|
+
file_permissions ^= 020 if ignore_group_writable
|
65
|
+
|
66
|
+
unless file_permissions == 0100644 || \
|
67
|
+
(DirUtils.gem_bin_file?(file) && file_permissions == 0100755)
|
68
|
+
return " (!) Unexpected permissions: #{formatted_file_permissions}"
|
62
69
|
end
|
63
70
|
''
|
64
71
|
end
|
@@ -115,5 +122,9 @@ class Gem::Comparator
|
|
115
122
|
''
|
116
123
|
end
|
117
124
|
end
|
125
|
+
|
126
|
+
def self.format_permissions(permissions)
|
127
|
+
sprintf("%o", permissions)
|
128
|
+
end
|
118
129
|
end
|
119
130
|
end
|
@@ -7,14 +7,14 @@ class TestDirUtils < TestGemModule
|
|
7
7
|
file2 = File.join(@v002, 'bin/lorem')
|
8
8
|
file3 = File.join(@v003, 'bin/lorem')
|
9
9
|
assert_equal 'require "lorem/version"', Gem::Comparator::DirUtils.file_first_line(file1)
|
10
|
-
|
10
|
+
assert_nil Gem::Comparator::DirUtils.file_first_line(file2)
|
11
11
|
assert_equal '#!/usr/bin/ruby', Gem::Comparator::DirUtils.file_first_line(file3)
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_file_has_shebang?
|
15
15
|
file1 = File.join(@v003, 'lib/lorem.rb')
|
16
16
|
file2 = File.join(@v004, 'bin/lorem')
|
17
|
-
|
17
|
+
assert_nil Gem::Comparator::DirUtils.file_has_shebang?(file1)
|
18
18
|
assert_equal 0, Gem::Comparator::DirUtils.file_has_shebang?(file2)
|
19
19
|
end
|
20
20
|
|
@@ -26,17 +26,10 @@ class TestDirUtils < TestGemModule
|
|
26
26
|
assert_equal false, Gem::Comparator::DirUtils.files_same_first_line?(file1, file3)
|
27
27
|
end
|
28
28
|
|
29
|
-
def test_file_permissions
|
30
|
-
file1 = File.join(@v001, 'lib/lorem.rb')
|
31
|
-
file2 = File.join(@v004, 'bin/lorem')
|
32
|
-
assert_equal '100664', Gem::Comparator::DirUtils.file_permissions(file1)
|
33
|
-
assert_equal '100775', Gem::Comparator::DirUtils.file_permissions(file2)
|
34
|
-
end
|
35
|
-
|
36
29
|
def test_gem_bin_file
|
37
30
|
file1 = File.join(@v001, 'lib/lorem.rb')
|
38
31
|
file2 = File.join(@v004, 'bin/lorem')
|
39
|
-
|
32
|
+
assert_nil Gem::Comparator::DirUtils.gem_bin_file?(file1)
|
40
33
|
assert_equal 0, Gem::Comparator::DirUtils.gem_bin_file?(file2)
|
41
34
|
end
|
42
35
|
|
@@ -5,13 +5,14 @@ class TestFileListComparator < TestGemComparator
|
|
5
5
|
def test_files_comparison
|
6
6
|
assert_equal 'DIFFERENT files:', @report['files'].header.data
|
7
7
|
assert_equal '0.0.1->0.0.2:', @report['files'].lines(1)
|
8
|
-
assert_equal "CHANGELOG.md", @report['files']['0.0.1->0.0.2']['added'].lines(1)
|
8
|
+
assert_equal "CHANGELOG.md +6/-0", @report['files']['0.0.1->0.0.2']['added'].lines(1)
|
9
9
|
assert_equal [], @report['files']['0.0.1->0.0.2']['deleted'].messages
|
10
10
|
assert_equal [], @report['files']['0.0.1->0.0.2']['updated'].messages
|
11
|
-
assert_equal "bin/lorem", @report['files']['0.0.2->0.0.3']['added'].lines(1)
|
12
|
-
assert_equal "(!)
|
13
|
-
assert_equal "(!)
|
14
|
-
assert_equal "
|
11
|
+
assert_equal "bin/lorem +3/-0", @report['files']['0.0.2->0.0.3']['added'].lines(1)
|
12
|
+
assert_equal "(!) File is not executable", @report['files']['0.0.2->0.0.3']['added'].lines(2).strip
|
13
|
+
assert_equal "(!) Shebang found: #!/usr/bin/ruby", @report['files']['0.0.2->0.0.3']['added'].lines(3).strip
|
14
|
+
assert_equal "lib/lorem/utils.rb +7/-0", @report['files']['0.0.2->0.0.3']['added'].lines(4).strip
|
15
|
+
assert_nil @report['files']['0.0.2->0.0.3']['added'].lines(6)
|
15
16
|
assert_equal [], @report['files']['0.0.2->0.0.3']['deleted'].messages
|
16
17
|
assert_equal [], @report['files']['0.0.2->0.0.3']['updated'].messages
|
17
18
|
assert_equal [], @report['files']['0.0.3->0.0.4']['added'].messages
|
@@ -14,18 +14,35 @@ class TestMonitor < TestGemModule
|
|
14
14
|
assert_equal '++++', Gem::Comparator::Monitor.compact_files_diff(file1, file2)
|
15
15
|
end
|
16
16
|
|
17
|
+
def test_files_added_diff
|
18
|
+
file1 = nil
|
19
|
+
file2 = File.join(@v003, 'lib/lorem/utils.rb')
|
20
|
+
diff = Gem::Comparator::Monitor.files_diff(file1, file2)
|
21
|
+
expected_diff = <<~EOF
|
22
|
+
@@ -0,0 +1,7 @@
|
23
|
+
+def check_something
|
24
|
+
+
|
25
|
+
+end
|
26
|
+
+
|
27
|
+
+def make_something
|
28
|
+
+
|
29
|
+
+end
|
30
|
+
EOF
|
31
|
+
assert_equal expected_diff, diff.split(/\n/, 3)[2]
|
32
|
+
end
|
33
|
+
|
17
34
|
def test_files_diff
|
18
|
-
Rainbow.enabled = false
|
19
35
|
file1 = File.join(@v001, 'lib/lorem.rb')
|
20
36
|
file2 = File.join(@v002, 'lib/lorem.rb')
|
21
37
|
diff = Gem::Comparator::Monitor.files_diff(file1, file2)
|
22
|
-
|
38
|
+
expected_diff = <<~EOF
|
23
39
|
@@ -6,0 +7,4 @@
|
24
40
|
+
|
25
41
|
+ def new_method
|
26
42
|
+ raise 'needs to be implemented'
|
27
43
|
+ end
|
28
44
|
EOF
|
45
|
+
assert_equal expected_diff, diff.split(/\n/, 3)[2]
|
29
46
|
end
|
30
47
|
|
31
48
|
def test_files_permissions_changes
|
@@ -34,6 +51,45 @@ class TestMonitor < TestGemModule
|
|
34
51
|
assert_equal '(!) New permissions: 100664 -> 100775', Gem::Comparator::Monitor.files_permissions_changes(file1, file2).strip
|
35
52
|
end
|
36
53
|
|
54
|
+
def test_files_permissions_changes_ignores_group_writable_added
|
55
|
+
file1 = Tempfile.new
|
56
|
+
file2 = Tempfile.new
|
57
|
+
begin
|
58
|
+
File.chmod(0644, file1)
|
59
|
+
File.chmod(0664, file2)
|
60
|
+
assert_equal '', Gem::Comparator::Monitor.files_permissions_changes(file1.path, file2.path, true)
|
61
|
+
ensure
|
62
|
+
file1.unlink
|
63
|
+
file2.unlink
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_files_permissions_changes_ignores_group_writable_other_changes
|
68
|
+
file1 = Tempfile.new
|
69
|
+
file2 = Tempfile.new
|
70
|
+
begin
|
71
|
+
File.chmod(0644, file1)
|
72
|
+
File.chmod(0660, file2)
|
73
|
+
assert_equal ' (!) New permissions: 100644 -> 100660', Gem::Comparator::Monitor.files_permissions_changes(file1.path, file2.path, true)
|
74
|
+
ensure
|
75
|
+
file1.unlink
|
76
|
+
file2.unlink
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_files_permissions_changes_ignores_group_writable_removed
|
81
|
+
file1 = Tempfile.new
|
82
|
+
file2 = Tempfile.new
|
83
|
+
begin
|
84
|
+
File.chmod(0664, file1)
|
85
|
+
File.chmod(0644, file2)
|
86
|
+
assert_equal '', Gem::Comparator::Monitor.files_permissions_changes(file1.path, file2.path, true)
|
87
|
+
ensure
|
88
|
+
file1.unlink
|
89
|
+
file2.unlink
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
37
93
|
def test_new_file_permissions
|
38
94
|
file1 = File.join(@v004, 'bin/lorem')
|
39
95
|
file2 = File.join(@v004, 'lib/lorem.rb')
|
@@ -41,6 +97,26 @@ class TestMonitor < TestGemModule
|
|
41
97
|
assert_equal '(!) Unexpected permissions: 100664', Gem::Comparator::Monitor.new_file_permissions(file2).strip
|
42
98
|
end
|
43
99
|
|
100
|
+
def test_new_file_permissions_ignore_group_writable
|
101
|
+
file = Tempfile.new
|
102
|
+
begin
|
103
|
+
File.chmod(0664, file)
|
104
|
+
assert_equal '', Gem::Comparator::Monitor.new_file_permissions(file, true)
|
105
|
+
ensure
|
106
|
+
file.unlink
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_new_file_permissions_ignore_group_writable_unreadable
|
111
|
+
file = Tempfile.new
|
112
|
+
begin
|
113
|
+
File.chmod(0660, file)
|
114
|
+
assert_equal ' (!) Unexpected permissions: 100660', Gem::Comparator::Monitor.new_file_permissions(file.path, true)
|
115
|
+
ensure
|
116
|
+
file.unlink
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
44
120
|
def test_files_executability_changes
|
45
121
|
file1 = File.join(@v003, 'bin/lorem')
|
46
122
|
file2 = File.join(@v004, 'bin/lorem')
|
@@ -140,11 +140,6 @@ class TestSpecComparator < TestGemComparator
|
|
140
140
|
assert_equal 'SAME signing_key:', @report['signing_key'].lines(0)
|
141
141
|
end
|
142
142
|
|
143
|
-
def test_has_rdoc_comparison
|
144
|
-
assert_equal 'SAME has_rdoc:', @report['has_rdoc'].header.data
|
145
|
-
assert_equal 'SAME has_rdoc:', @report['has_rdoc'].lines(0)
|
146
|
-
end
|
147
|
-
|
148
143
|
def test_date_comparison
|
149
144
|
assert_equal 'SAME date:', @report['date'].header.data
|
150
145
|
assert_equal 'SAME date:', @report['date'].lines(0)
|
data/test/test_helper.rb
CHANGED
@@ -1,10 +1,22 @@
|
|
1
1
|
require 'minitest/autorun'
|
2
2
|
require 'rubygems/comparator'
|
3
3
|
|
4
|
+
# The tests expects these permissions, which isn't the case if you have
|
5
|
+
# umask 022 when cloning the repo
|
6
|
+
def setup_file_permissions
|
7
|
+
gemfiles_path = File.expand_path('gemfiles', File.dirname(__FILE__))
|
8
|
+
File.chmod(0664, File.join(gemfiles_path, 'lorem-0.0.1', 'lib', 'lorem.rb'))
|
9
|
+
File.chmod(0664, File.join(gemfiles_path, 'lorem-0.0.3', 'bin', 'lorem'))
|
10
|
+
File.chmod(0664, File.join(gemfiles_path, 'lorem-0.0.4', 'lib', 'lorem.rb'))
|
11
|
+
File.chmod(0775, File.join(gemfiles_path, 'lorem-0.0.4', 'bin', 'lorem'))
|
12
|
+
end
|
13
|
+
|
4
14
|
class TestGemComparator < Minitest::Test
|
5
15
|
def setup
|
6
16
|
super
|
7
17
|
|
18
|
+
setup_file_permissions
|
19
|
+
|
8
20
|
options = { keep_all: true, log_all: true, no_color: true, brief_mode: false }
|
9
21
|
versions = ['0.0.1', '0.0.2', '0.0.3', '0.0.4']
|
10
22
|
|
@@ -22,6 +34,8 @@ end
|
|
22
34
|
class TestGemModule < Minitest::Test
|
23
35
|
def setup
|
24
36
|
super
|
37
|
+
Rainbow.enabled = false
|
38
|
+
setup_file_permissions
|
25
39
|
gemfiles_path = File.expand_path('gemfiles', File.dirname(__FILE__))
|
26
40
|
@v001 = File.join(gemfiles_path, 'lorem-0.0.1')
|
27
41
|
@v002 = File.join(gemfiles_path, 'lorem-0.0.2')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem-compare
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josef Stribny
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
159
|
- !ruby/object:Gem::Version
|
160
160
|
version: 3.0.0
|
161
161
|
requirements: []
|
162
|
-
rubygems_version: 3.
|
162
|
+
rubygems_version: 3.3.7
|
163
163
|
signing_key:
|
164
164
|
specification_version: 4
|
165
165
|
summary: RubyGems plugin for comparing gem versions
|