gem-compare 0.0.6 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +21 -14
- data/lib/rubygems/commands/compare_command.rb +9 -0
- data/lib/rubygems/comparator/file_list_comparator.rb +13 -5
- data/lib/rubygems/comparator/gemfile_comparator.rb +2 -2
- data/lib/rubygems/comparator/monitor.rb +14 -0
- data/lib/rubygems/comparator/report.rb +1 -2
- data/lib/rubygems/comparator/version.rb +3 -0
- data/lib/rubygems/comparator.rb +51 -14
- data/test/gemfiles/lorem-0.0.1/Gemfile +4 -0
- data/test/gemfiles/lorem-0.0.1/LICENSE.txt +22 -0
- data/test/gemfiles/lorem-0.0.1/README.md +29 -0
- data/test/gemfiles/lorem-0.0.1/Rakefile +2 -0
- data/test/gemfiles/lorem-0.0.1/lib/lorem/version.rb +3 -0
- data/test/gemfiles/lorem-0.0.1/lib/lorem.rb +7 -0
- data/test/gemfiles/lorem-0.0.1/lorem.gemspec +24 -0
- data/test/gemfiles/lorem-0.0.1.gem +0 -0
- data/test/gemfiles/lorem-0.0.2/CHANGELOG.md +6 -0
- data/test/gemfiles/lorem-0.0.2/Gemfile +4 -0
- data/test/gemfiles/lorem-0.0.2/LICENSE.txt +3 -0
- data/test/gemfiles/lorem-0.0.2/README.md +29 -0
- data/test/gemfiles/lorem-0.0.2/Rakefile +2 -0
- data/test/gemfiles/lorem-0.0.2/lib/lorem/version.rb +3 -0
- data/test/gemfiles/lorem-0.0.2/lib/lorem.rb +11 -0
- data/test/gemfiles/lorem-0.0.2/lorem.gemspec +24 -0
- data/test/gemfiles/lorem-0.0.2.gem +0 -0
- data/test/gemfiles/lorem-0.0.3/CHANGELOG.md +14 -0
- data/test/gemfiles/lorem-0.0.3/Gemfile +7 -0
- data/test/gemfiles/lorem-0.0.3/LICENSE.txt +3 -0
- data/test/gemfiles/lorem-0.0.3/README.md +29 -0
- data/test/gemfiles/lorem-0.0.3/Rakefile +2 -0
- data/test/gemfiles/lorem-0.0.3/bin/lorem +3 -0
- data/test/gemfiles/lorem-0.0.3/lib/lorem/utils.rb +7 -0
- data/test/gemfiles/lorem-0.0.3/lib/lorem/version.rb +3 -0
- data/test/gemfiles/lorem-0.0.3/lib/lorem.rb +11 -0
- data/test/gemfiles/lorem-0.0.3/lorem.gemspec +25 -0
- data/test/gemfiles/lorem-0.0.3.gem +0 -0
- data/test/gemfiles/lorem-0.0.4/CHANGELOG.md +21 -0
- data/test/gemfiles/lorem-0.0.4/Gemfile +6 -0
- data/test/gemfiles/lorem-0.0.4/LICENSE.txt +3 -0
- data/test/gemfiles/lorem-0.0.4/README.md +29 -0
- data/test/gemfiles/lorem-0.0.4/Rakefile +2 -0
- data/test/gemfiles/lorem-0.0.4/bin/lorem +3 -0
- data/test/gemfiles/lorem-0.0.4/lib/lorem/utils.rb +7 -0
- data/test/gemfiles/lorem-0.0.4/lib/lorem/version.rb +3 -0
- data/test/gemfiles/lorem-0.0.4/lib/lorem.rb +11 -0
- data/test/gemfiles/lorem-0.0.4/lorem.gemspec +25 -0
- data/test/gemfiles/lorem-0.0.4.gem +0 -0
- data/test/rubygems/comparator/test_gemfile_comparator.rb +1 -1
- data/test/rubygems/comparator/test_monitor.rb +14 -0
- data/test/rubygems/comparator/test_report.rb +2 -2
- data/test/rubygems/comparator/test_utils.rb +2 -2
- data/test/rubygems/test_gem_commands_compare_command.rb +7 -2
- data/test/test_helper.rb +3 -3
- metadata +48 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0c044164ee56748354c54ebf233e953fcb35f2f3d8066c4ea6890d3ad30ea7d4
|
4
|
+
data.tar.gz: 6904897ef13bb77558dd451c120288a1454e5806a5de72ea5fc779bba5298392
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e331da083741102852183767b231fddfe7d26d39ee4d7a5c6e2cac1ba3723841deb56d7f10f91e6864f37a4a9da8ef9363375c61a93d63ff2031e21f98da67f3
|
7
|
+
data.tar.gz: 5792b1420f20a15cf65d7d8dc6009e0381add33ee9a606cea928fe3d27d4f02dca1f7ea21fe91b49292809ad9414190a8f78221c56ba040218e1ccd3e1e2a6cf
|
data/README.md
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
# gem-compare
|
2
2
|
|
3
|
-
## Description
|
4
|
-
|
5
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.
|
6
4
|
|
5
|
+
This is especially handy for:
|
6
|
+
|
7
|
+
- checking what goes into to a next gem release
|
8
|
+
- tracking dependencies and license changes before upgrades
|
9
|
+
- spotting anything suspicious and unusual
|
10
|
+
|
7
11
|
## Installation
|
8
12
|
|
9
13
|
You can install `gem-compare` as a gem from RubyGems.org:
|
10
14
|
|
15
|
+
```bash
|
16
|
+
$ gem install gem-compare
|
11
17
|
```
|
12
|
-
gem install gem-compare
|
13
|
-
```
|
14
|
-
|
15
|
-
Once it's stable I will package it for Fedora.
|
16
18
|
|
17
19
|
## Usage
|
18
20
|
|
@@ -29,9 +31,9 @@ Compared versions: ["3.0.0", "4.0.0"]
|
|
29
31
|
4.0.0: []
|
30
32
|
DIFFERENT has_rdoc:
|
31
33
|
3.0.0: true
|
32
|
-
4.0.0:
|
34
|
+
4.0.0:
|
33
35
|
DIFFERENT license:
|
34
|
-
3.0.0:
|
36
|
+
3.0.0:
|
35
37
|
4.0.0: MIT
|
36
38
|
DIFFERENT licenses:
|
37
39
|
3.0.0: []
|
@@ -103,10 +105,10 @@ Compared versions: ["2.0.1", "3.0.0"]
|
|
103
105
|
(!) Shebang probably added: #!/usr/bin/env ruby
|
104
106
|
```
|
105
107
|
|
106
|
-
If you would like to see all development dependencies for `prawn` since `0.1` version, let *gem-compare* expand the versions for you:
|
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):
|
107
109
|
|
108
110
|
```
|
109
|
-
$ gem compare prawn '>=0.1' -k -a
|
111
|
+
$ gem compare prawn '>=0.1' -k -a --development
|
110
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"]
|
111
113
|
DIFFERENT development dependencies:
|
112
114
|
0.12.0->0.13.0:
|
@@ -143,6 +145,12 @@ $ gem compare nokogiri 1.5.6 1.6.1 -ak --platform java # for JRuby
|
|
143
145
|
$ gem compare nokogiri 1.5.6 1.6.1 -ak --platform x86-mingw32 # on Windows
|
144
146
|
```
|
145
147
|
|
148
|
+
#### Gems from different source server
|
149
|
+
|
150
|
+
If you run your own gem source server, you can override the RubyGems.org default with
|
151
|
+
`--sources SOURCE1,SOURCE2` option.
|
152
|
+
|
153
|
+
|
146
154
|
### Supported options
|
147
155
|
|
148
156
|
To see all possible options run:
|
@@ -152,12 +160,11 @@ $ gem compare --help
|
|
152
160
|
|
153
161
|
## Requirements
|
154
162
|
|
155
|
-
Currently tested against RubyGems 2.x.
|
163
|
+
Currently tested against RubyGems 3.x. Use the `0.0.7` release for RubyGems 2.x.
|
156
164
|
|
157
|
-
## Contributions
|
158
|
-
|
159
|
-
Contributions are welcome! Please send a PR and make sure you follow the coding style.
|
160
165
|
|
161
166
|
## Copyright
|
162
167
|
|
168
|
+
Made by [Josef Strzibny](https://strzibny.name).
|
169
|
+
|
163
170
|
Released under the MIT license. Feel free to contribute!
|
@@ -40,6 +40,11 @@ class Gem::Commands::CompareCommand < Gem::Command
|
|
40
40
|
options[:param] = 'files'
|
41
41
|
end
|
42
42
|
|
43
|
+
add_option('-F', '--diff', 'Diff file contents') do
|
44
|
+
options[:diff] = true
|
45
|
+
options[:param] = 'files'
|
46
|
+
end
|
47
|
+
|
43
48
|
add_option('-g', '--gemfiles', 'Compare only Gemfiles') do
|
44
49
|
options[:param] = 'gemfiles'
|
45
50
|
end
|
@@ -49,6 +54,10 @@ class Gem::Commands::CompareCommand < Gem::Command
|
|
49
54
|
options[:brief] = true
|
50
55
|
end
|
51
56
|
|
57
|
+
add_option('-sSOURCES', '--sources SOURCES', 'Use different source URIs for gems (separated by comma)') do |sources, options|
|
58
|
+
options[:sources] = sources.split ','
|
59
|
+
end
|
60
|
+
|
52
61
|
end
|
53
62
|
|
54
63
|
def arguments # :nodoc:
|
@@ -80,7 +80,7 @@ class Gem::Comparator
|
|
80
80
|
report = check_added_files(param, vers, index, added, report, options[:brief])
|
81
81
|
|
82
82
|
report[param][vers]['changed'].set_header '* Changed:'
|
83
|
-
report = check_same_files(param, vers, index, same, report, options[:brief])
|
83
|
+
report = check_same_files(param, vers, index, same, report, options[:brief], options[:diff])
|
84
84
|
same_files = report[param][vers]['changed'].messages.empty?
|
85
85
|
all_same = false unless same_files
|
86
86
|
|
@@ -148,22 +148,30 @@ class Gem::Comparator
|
|
148
148
|
report
|
149
149
|
end
|
150
150
|
|
151
|
-
def check_same_files(param, vers, index, files, report, brief_mode)
|
151
|
+
def check_same_files(param, vers, index, files, report, brief_mode, diff_mode)
|
152
152
|
files.each do |file|
|
153
153
|
prev_file = File.join(unpacked_gem_dirs[@packages[index-1].spec.version], file)
|
154
154
|
curr_file = File.join(unpacked_gem_dirs[@packages[index].spec.version], file)
|
155
155
|
|
156
156
|
next unless check_files([prev_file, curr_file])
|
157
157
|
|
158
|
-
line_changes =
|
158
|
+
line_changes = if diff_mode
|
159
|
+
Monitor.files_diff(prev_file, curr_file)
|
160
|
+
else
|
161
|
+
Monitor.lines_changed(prev_file, curr_file)
|
162
|
+
end
|
159
163
|
|
160
164
|
changes = Monitor.files_permissions_changes(prev_file, curr_file),
|
161
165
|
Monitor.files_executability_changes(prev_file, curr_file),
|
162
166
|
Monitor.files_shebang_changes(prev_file, curr_file)
|
163
167
|
|
164
168
|
if(!changes.join.empty? || (!brief_mode && !line_changes.empty?))
|
165
|
-
|
166
|
-
|
169
|
+
if diff_mode
|
170
|
+
report[param][vers]['changed'][file].set_header file
|
171
|
+
report[param][vers]['changed'][file] << line_changes.split("\n")
|
172
|
+
else
|
173
|
+
report[param][vers]['changed'] << "#{file} #{line_changes}"
|
174
|
+
end
|
167
175
|
end
|
168
176
|
|
169
177
|
changes.each do |change|
|
@@ -44,11 +44,11 @@ class Gem::Comparator
|
|
44
44
|
|
45
45
|
report['gemfiles'][vers]['added'].section do
|
46
46
|
set_header '* Added:'
|
47
|
-
puts added.map { |x| "#{x.name} #{x.requirements_list}" } unless added.empty?
|
47
|
+
puts added.map { |x| "#{x.name} #{x.requirements_list} (#{x.type})" } unless added.empty?
|
48
48
|
end
|
49
49
|
report['gemfiles'][vers]['deleted'].section do
|
50
50
|
set_header '* Deleted'
|
51
|
-
puts deleted.map { |x| "#{x.name} #{x.requirements_list}" } unless deleted.empty?
|
51
|
+
puts deleted.map { |x| "#{x.name} #{x.requirements_list} (#{x.type})" } unless deleted.empty?
|
52
52
|
end
|
53
53
|
report['gemfiles'][vers]['updated'].section do
|
54
54
|
set_header '* Updated'
|
@@ -26,6 +26,20 @@ class Gem::Comparator
|
|
26
26
|
changes
|
27
27
|
end
|
28
28
|
|
29
|
+
def self.files_diff(prev_file, curr_file)
|
30
|
+
changes = ''
|
31
|
+
Diffy::Diff.new(
|
32
|
+
prev_file, curr_file, :source => 'files', :context => 0, :include_diff_info => true
|
33
|
+
).each do |line|
|
34
|
+
case line
|
35
|
+
when /^\+/ then changes << Rainbow(line).green
|
36
|
+
when /^-/ then changes << Rainbow(line).red
|
37
|
+
else changes << line
|
38
|
+
end
|
39
|
+
end
|
40
|
+
changes
|
41
|
+
end
|
42
|
+
|
29
43
|
def self.files_permissions_changes(prev_file, curr_file)
|
30
44
|
prev_permissions = DirUtils.file_permissions(prev_file)
|
31
45
|
curr_permissions = DirUtils.file_permissions(curr_file)
|
@@ -56,7 +56,7 @@ class Gem::Comparator
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def section(&block)
|
59
|
-
instance_eval
|
59
|
+
instance_eval(&block)
|
60
60
|
end
|
61
61
|
|
62
62
|
def set_header(message)
|
@@ -122,7 +122,6 @@ class Gem::Comparator
|
|
122
122
|
def set_parent(parent)
|
123
123
|
parent.sections << self
|
124
124
|
@level = parent.level + 1
|
125
|
-
parent_section = parent
|
126
125
|
end
|
127
126
|
|
128
127
|
end
|
data/lib/rubygems/comparator.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
require 'tmpdir'
|
2
2
|
require 'rbconfig'
|
3
3
|
require 'rainbow'
|
4
|
-
require '
|
4
|
+
require 'uri'
|
5
5
|
require 'json'
|
6
6
|
require 'rubygems/package'
|
7
7
|
require 'rubygems/dependency'
|
8
8
|
require 'rubygems/spec_fetcher'
|
9
|
+
require 'rubygems/remote_fetcher'
|
10
|
+
require 'rubygems/comparator/version'
|
9
11
|
require 'rubygems/comparator/utils'
|
10
12
|
require 'rubygems/comparator/report'
|
11
13
|
require 'rubygems/comparator/spec_comparator'
|
@@ -22,8 +24,6 @@ class Gem::Comparator
|
|
22
24
|
include Gem::Comparator::Utils
|
23
25
|
attr_accessor :options, :report
|
24
26
|
|
25
|
-
VERSION = '0.0.4'
|
26
|
-
|
27
27
|
##
|
28
28
|
# Set the working dir and process options
|
29
29
|
#
|
@@ -91,10 +91,13 @@ class Gem::Comparator
|
|
91
91
|
DependencyComparator,
|
92
92
|
GemfileComparator]
|
93
93
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
94
|
+
# Use different gem sources if specified
|
95
|
+
with_sources @options[:sources] do
|
96
|
+
comparators.each do |c|
|
97
|
+
comparator = c.new
|
98
|
+
cmp = (comparator.compares == :packages) ? gem_packages.values : gem_specs.values
|
99
|
+
@report = comparator.compare(cmp, @report, @options)
|
100
|
+
end
|
98
101
|
end
|
99
102
|
|
100
103
|
# Clean up
|
@@ -108,6 +111,43 @@ class Gem::Comparator
|
|
108
111
|
|
109
112
|
private
|
110
113
|
|
114
|
+
def with_sources(sources, &block)
|
115
|
+
if sources
|
116
|
+
override_sources sources do
|
117
|
+
yield
|
118
|
+
end
|
119
|
+
else
|
120
|
+
yield
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def override_sources(new_sources, &block)
|
125
|
+
original_sources = Gem.sources.clone
|
126
|
+
old_sources = Gem.sources.to_a
|
127
|
+
old_sources.each do |source_uri|
|
128
|
+
Gem.sources.delete source_uri
|
129
|
+
end
|
130
|
+
new_sources.each do |source_uri|
|
131
|
+
source = Gem::Source.new source_uri
|
132
|
+
source.load_specs :released
|
133
|
+
Gem.sources << source
|
134
|
+
end
|
135
|
+
Gem.configuration.write
|
136
|
+
yield
|
137
|
+
rescue URI::Error, ArgumentError
|
138
|
+
error 'Given URI is not valid.'
|
139
|
+
rescue Gem::RemoteFetcher::FetchError => e
|
140
|
+
error "Fetching the gem from the given URI failed with the " +
|
141
|
+
"following error:\n #{e.message}"
|
142
|
+
ensure
|
143
|
+
original_sources.each do |source_uri|
|
144
|
+
source = Gem::Source.new source_uri
|
145
|
+
source.load_specs :released
|
146
|
+
Gem.sources << source
|
147
|
+
end
|
148
|
+
Gem.configuration.write
|
149
|
+
end
|
150
|
+
|
111
151
|
##
|
112
152
|
# If there is an unexpanded version in +versions+ such
|
113
153
|
# as '>= 4.0.0' or '~>1.0.0', find all existing
|
@@ -124,11 +164,11 @@ class Gem::Comparator
|
|
124
164
|
expanded << version
|
125
165
|
next
|
126
166
|
end
|
127
|
-
op, v = (version.scan
|
167
|
+
op, v = (version.scan(/(>=|<=|~>|!=|>|<|=)\s*(.*)/)).flatten
|
128
168
|
# Supported operator and version?
|
129
169
|
if OPERATORS.include?(op) && v =~ VERSION_REGEX
|
130
170
|
dep = Gem::Dependency.new gem_name, version
|
131
|
-
specs_and_sources,
|
171
|
+
specs_and_sources, _errors = Gem::SpecFetcher.fetcher.spec_for_dependency dep
|
132
172
|
specs_and_sources.each do |s|
|
133
173
|
expanded << s[0].version
|
134
174
|
end
|
@@ -148,11 +188,8 @@ class Gem::Comparator
|
|
148
188
|
end
|
149
189
|
|
150
190
|
def remote_gem_versions(gem_name)
|
151
|
-
|
152
|
-
|
153
|
-
client.follow_location = true
|
154
|
-
client.http_get
|
155
|
-
json = JSON.parse(client.body_str)
|
191
|
+
body_str = URI.open("https://rubygems.org/api/v1/versions/#{gem_name}.json").read
|
192
|
+
json = JSON.parse(body_str)
|
156
193
|
gems = json.collect { |version| version['number'] }
|
157
194
|
info "Upstream versions: #{gems}"
|
158
195
|
gems
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Josef Stribny
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Lorem
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'lorem'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install lorem
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( https://github.com/[my-github-username]/lorem/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create a new Pull Request
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'lorem/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "lorem"
|
8
|
+
spec.version = Lorem::VERSION
|
9
|
+
spec.authors = ["Josef Stribny"]
|
10
|
+
spec.email = ["jstribny@redhat.com"]
|
11
|
+
spec.summary = "lorem is a gem for testing gem-compare"
|
12
|
+
spec.description = "lorem changes a lot so we can test gem-compare a lot"
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = ["lorem.gemspec", "Gemfile", "Rakefile", "LICENSE.txt", "README.md"] +
|
17
|
+
Dir.glob("lib/**/*")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
end
|
Binary file
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Lorem
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'lorem'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install lorem
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( https://github.com/[my-github-username]/lorem/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create a new Pull Request
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'lorem/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "lorem"
|
8
|
+
spec.version = Lorem::VERSION
|
9
|
+
spec.authors = ["Josef Stribny"]
|
10
|
+
spec.email = ["jstribny@redhat.com"]
|
11
|
+
spec.summary = "lorem is a gem for testing gem-compare"
|
12
|
+
spec.description = "lorem changes a lot so we can test gem-compare a lot"
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "GPLv2"
|
15
|
+
|
16
|
+
spec.files = ["lorem.gemspec", "CHANGELOG.md", "Gemfile", "Rakefile", "LICENSE.txt", "README.md"] +
|
17
|
+
Dir.glob("lib/**/*")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
end
|
Binary file
|
@@ -0,0 +1,14 @@
|
|
1
|
+
lorem 0.0.3
|
2
|
+
===========
|
3
|
+
|
4
|
+
- add homepage
|
5
|
+
- add some lib files
|
6
|
+
- add an executable file
|
7
|
+
- change dependencies in gemspec and Gemfile
|
8
|
+
|
9
|
+
lorem 0.0.2
|
10
|
+
===========
|
11
|
+
|
12
|
+
- add changelog file
|
13
|
+
- change license to GPLv2
|
14
|
+
- add new method to lib/lorem.rb
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Lorem
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'lorem'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install lorem
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( https://github.com/[my-github-username]/lorem/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create a new Pull Request
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'lorem/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "lorem"
|
8
|
+
spec.version = Lorem::VERSION
|
9
|
+
spec.authors = ["Josef Stribny"]
|
10
|
+
spec.email = ["jstribny@redhat.com"]
|
11
|
+
spec.summary = "lorem is a gem for testing gem-compare"
|
12
|
+
spec.description = "lorem changes a lot so we can test gem-compare a lot"
|
13
|
+
spec.homepage = "http://lorem.lorem"
|
14
|
+
spec.license = "GPLv2"
|
15
|
+
|
16
|
+
spec.files = ["lorem.gemspec", "bin/lorem", "CHANGELOG.md", "Gemfile", "Rakefile", "LICENSE.txt", "README.md"] +
|
17
|
+
Dir.glob("lib/**/*")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "rails", ">= 4.0.0"
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.0"
|
24
|
+
spec.add_development_dependency "rake", ">= 10.0.0"
|
25
|
+
end
|
Binary file
|
@@ -0,0 +1,21 @@
|
|
1
|
+
lorem 0.0.4
|
2
|
+
===========
|
3
|
+
|
4
|
+
- change summary and description
|
5
|
+
- make bin/lorem really executable
|
6
|
+
- bump dependencies
|
7
|
+
|
8
|
+
lorem 0.0.3
|
9
|
+
===========
|
10
|
+
|
11
|
+
- add homepage
|
12
|
+
- add some lib files
|
13
|
+
- add an executable file
|
14
|
+
- change dependencies in gemspec and Gemfile
|
15
|
+
|
16
|
+
lorem 0.0.2
|
17
|
+
===========
|
18
|
+
|
19
|
+
- add changelog file
|
20
|
+
- change license to GPLv2
|
21
|
+
- add new method to lib/lorem.rb
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Lorem
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'lorem'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install lorem
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( https://github.com/[my-github-username]/lorem/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create a new Pull Request
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'lorem/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "lorem"
|
8
|
+
spec.version = Lorem::VERSION
|
9
|
+
spec.authors = ["Josef Stribny"]
|
10
|
+
spec.email = ["jstribny@redhat.com"]
|
11
|
+
spec.summary = "lorem is a gem for testing gem-compare plugin"
|
12
|
+
spec.description = "lorem changes a lot so we can test gem-compare plugin a lot"
|
13
|
+
spec.homepage = "http://lorem.lorem"
|
14
|
+
spec.license = "GPLv2"
|
15
|
+
|
16
|
+
spec.files = ["lorem.gemspec", "bin/lorem", "CHANGELOG.md", "Gemfile", "Rakefile", "LICENSE.txt", "README.md"] +
|
17
|
+
Dir.glob("lib/**/*")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "rails", ">= 4.1.0"
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.1"
|
24
|
+
spec.add_development_dependency "rake", ">= 10.0.0"
|
25
|
+
end
|
Binary file
|
@@ -8,7 +8,7 @@ class TestGemfileComparator < TestGemComparator
|
|
8
8
|
assert_equal [], @report['gemfiles']['0.0.2->0.0.3'].messages
|
9
9
|
assert_equal [], @report['gemfiles']['0.0.3->0.0.4']['added'].messages
|
10
10
|
assert_equal '* Deleted', @report['gemfiles']['0.0.3->0.0.4'].lines(1)
|
11
|
-
assert_equal ['appraisal [">= 0"]'], @report['gemfiles']['0.0.3->0.0.4']['deleted'].lines(1)
|
11
|
+
assert_equal ['appraisal [">= 0"] (runtime)'], @report['gemfiles']['0.0.3->0.0.4']['deleted'].lines(1)
|
12
12
|
assert_equal ['minitest from: [">= 0"] to: ["= 5.0.0"]'], @report['gemfiles']['0.0.3->0.0.4']['updated'].lines(1)
|
13
13
|
end
|
14
14
|
end
|
@@ -14,6 +14,20 @@ class TestMonitor < TestGemModule
|
|
14
14
|
assert_equal '++++', Gem::Comparator::Monitor.compact_files_diff(file1, file2)
|
15
15
|
end
|
16
16
|
|
17
|
+
def test_files_diff
|
18
|
+
Rainbow.enabled = false
|
19
|
+
file1 = File.join(@v001, 'lib/lorem.rb')
|
20
|
+
file2 = File.join(@v002, 'lib/lorem.rb')
|
21
|
+
diff = Gem::Comparator::Monitor.files_diff(file1, file2)
|
22
|
+
assert_equal diff.split(/\n/, 3)[2], <<~EOF
|
23
|
+
@@ -6,0 +7,4 @@
|
24
|
+
+
|
25
|
+
+ def new_method
|
26
|
+
+ raise 'needs to be implemented'
|
27
|
+
+ end
|
28
|
+
EOF
|
29
|
+
end
|
30
|
+
|
17
31
|
def test_files_permissions_changes
|
18
32
|
file1 = File.join(@v003, 'bin/lorem')
|
19
33
|
file2 = File.join(@v004, 'bin/lorem')
|
@@ -1,11 +1,16 @@
|
|
1
|
-
|
1
|
+
require_relative '../test_helper'
|
2
|
+
require 'rubygems/user_interaction'
|
3
|
+
require 'rubygems/mock_gem_ui'
|
2
4
|
require 'rubygems/commands/compare_command'
|
3
5
|
|
4
|
-
class TestGemCommandsCompareCommand <
|
6
|
+
class TestGemCommandsCompareCommand < Minitest::Test
|
7
|
+
include Gem::DefaultUserInteraction
|
8
|
+
|
5
9
|
def setup
|
6
10
|
super
|
7
11
|
|
8
12
|
@command = Gem::Commands::CompareCommand.new
|
13
|
+
@ui = Gem::MockGemUi.new
|
9
14
|
end
|
10
15
|
|
11
16
|
def test_execute_no_gemfile
|
data/test/test_helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require '
|
1
|
+
require 'minitest/autorun'
|
2
2
|
require 'rubygems/comparator'
|
3
3
|
|
4
|
-
class TestGemComparator <
|
4
|
+
class TestGemComparator < Minitest::Test
|
5
5
|
def setup
|
6
6
|
super
|
7
7
|
|
@@ -19,7 +19,7 @@ class TestGemComparator < Gem::TestCase
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
class TestGemModule <
|
22
|
+
class TestGemModule < Minitest::Test
|
23
23
|
def setup
|
24
24
|
super
|
25
25
|
gemfiles_path = File.expand_path('gemfiles', File.dirname(__FILE__))
|
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:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josef Stribny
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: curb
|
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'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: diffy
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,7 +89,47 @@ files:
|
|
103
89
|
- lib/rubygems/comparator/report/entry.rb
|
104
90
|
- lib/rubygems/comparator/spec_comparator.rb
|
105
91
|
- lib/rubygems/comparator/utils.rb
|
92
|
+
- lib/rubygems/comparator/version.rb
|
106
93
|
- lib/rubygems_plugin.rb
|
94
|
+
- test/gemfiles/lorem-0.0.1.gem
|
95
|
+
- test/gemfiles/lorem-0.0.1/Gemfile
|
96
|
+
- test/gemfiles/lorem-0.0.1/LICENSE.txt
|
97
|
+
- test/gemfiles/lorem-0.0.1/README.md
|
98
|
+
- test/gemfiles/lorem-0.0.1/Rakefile
|
99
|
+
- test/gemfiles/lorem-0.0.1/lib/lorem.rb
|
100
|
+
- test/gemfiles/lorem-0.0.1/lib/lorem/version.rb
|
101
|
+
- test/gemfiles/lorem-0.0.1/lorem.gemspec
|
102
|
+
- test/gemfiles/lorem-0.0.2.gem
|
103
|
+
- test/gemfiles/lorem-0.0.2/CHANGELOG.md
|
104
|
+
- test/gemfiles/lorem-0.0.2/Gemfile
|
105
|
+
- test/gemfiles/lorem-0.0.2/LICENSE.txt
|
106
|
+
- test/gemfiles/lorem-0.0.2/README.md
|
107
|
+
- test/gemfiles/lorem-0.0.2/Rakefile
|
108
|
+
- test/gemfiles/lorem-0.0.2/lib/lorem.rb
|
109
|
+
- test/gemfiles/lorem-0.0.2/lib/lorem/version.rb
|
110
|
+
- test/gemfiles/lorem-0.0.2/lorem.gemspec
|
111
|
+
- test/gemfiles/lorem-0.0.3.gem
|
112
|
+
- test/gemfiles/lorem-0.0.3/CHANGELOG.md
|
113
|
+
- test/gemfiles/lorem-0.0.3/Gemfile
|
114
|
+
- test/gemfiles/lorem-0.0.3/LICENSE.txt
|
115
|
+
- test/gemfiles/lorem-0.0.3/README.md
|
116
|
+
- test/gemfiles/lorem-0.0.3/Rakefile
|
117
|
+
- test/gemfiles/lorem-0.0.3/bin/lorem
|
118
|
+
- test/gemfiles/lorem-0.0.3/lib/lorem.rb
|
119
|
+
- test/gemfiles/lorem-0.0.3/lib/lorem/utils.rb
|
120
|
+
- test/gemfiles/lorem-0.0.3/lib/lorem/version.rb
|
121
|
+
- test/gemfiles/lorem-0.0.3/lorem.gemspec
|
122
|
+
- test/gemfiles/lorem-0.0.4.gem
|
123
|
+
- test/gemfiles/lorem-0.0.4/CHANGELOG.md
|
124
|
+
- test/gemfiles/lorem-0.0.4/Gemfile
|
125
|
+
- test/gemfiles/lorem-0.0.4/LICENSE.txt
|
126
|
+
- test/gemfiles/lorem-0.0.4/README.md
|
127
|
+
- test/gemfiles/lorem-0.0.4/Rakefile
|
128
|
+
- test/gemfiles/lorem-0.0.4/bin/lorem
|
129
|
+
- test/gemfiles/lorem-0.0.4/lib/lorem.rb
|
130
|
+
- test/gemfiles/lorem-0.0.4/lib/lorem/utils.rb
|
131
|
+
- test/gemfiles/lorem-0.0.4/lib/lorem/version.rb
|
132
|
+
- test/gemfiles/lorem-0.0.4/lorem.gemspec
|
107
133
|
- test/rubygems/comparator/test_dependency_comparator.rb
|
108
134
|
- test/rubygems/comparator/test_dir_utils.rb
|
109
135
|
- test/rubygems/comparator/test_file_list_comparator.rb
|
@@ -118,7 +144,7 @@ homepage: http://github.com/fedora-ruby/gem-compare
|
|
118
144
|
licenses:
|
119
145
|
- MIT
|
120
146
|
metadata: {}
|
121
|
-
post_install_message:
|
147
|
+
post_install_message:
|
122
148
|
rdoc_options: []
|
123
149
|
require_paths:
|
124
150
|
- lib
|
@@ -126,17 +152,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
152
|
requirements:
|
127
153
|
- - ">="
|
128
154
|
- !ruby/object:Gem::Version
|
129
|
-
version:
|
155
|
+
version: 3.0.0
|
130
156
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
157
|
requirements:
|
132
158
|
- - ">="
|
133
159
|
- !ruby/object:Gem::Version
|
134
|
-
version:
|
160
|
+
version: 3.0.0
|
135
161
|
requirements: []
|
136
|
-
|
137
|
-
|
138
|
-
signing_key:
|
162
|
+
rubygems_version: 3.2.32
|
163
|
+
signing_key:
|
139
164
|
specification_version: 4
|
140
165
|
summary: RubyGems plugin for comparing gem versions
|
141
166
|
test_files: []
|
142
|
-
has_rdoc:
|