gem-compare 0.0.7 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +16 -9
  3. data/lib/rubygems/commands/compare_command.rb +5 -0
  4. data/lib/rubygems/comparator/file_list_comparator.rb +13 -5
  5. data/lib/rubygems/comparator/gemfile_comparator.rb +2 -2
  6. data/lib/rubygems/comparator/monitor.rb +14 -0
  7. data/lib/rubygems/comparator/report.rb +1 -2
  8. data/lib/rubygems/comparator/version.rb +1 -1
  9. data/lib/rubygems/comparator.rb +2 -2
  10. data/test/gemfiles/lorem-0.0.1/Gemfile +4 -0
  11. data/test/gemfiles/lorem-0.0.1/LICENSE.txt +22 -0
  12. data/test/gemfiles/lorem-0.0.1/README.md +29 -0
  13. data/test/gemfiles/lorem-0.0.1/Rakefile +2 -0
  14. data/test/gemfiles/lorem-0.0.1/lib/lorem/version.rb +3 -0
  15. data/test/gemfiles/lorem-0.0.1/lib/lorem.rb +7 -0
  16. data/test/gemfiles/lorem-0.0.1/lorem.gemspec +24 -0
  17. data/test/gemfiles/lorem-0.0.1.gem +0 -0
  18. data/test/gemfiles/lorem-0.0.2/CHANGELOG.md +6 -0
  19. data/test/gemfiles/lorem-0.0.2/Gemfile +4 -0
  20. data/test/gemfiles/lorem-0.0.2/LICENSE.txt +3 -0
  21. data/test/gemfiles/lorem-0.0.2/README.md +29 -0
  22. data/test/gemfiles/lorem-0.0.2/Rakefile +2 -0
  23. data/test/gemfiles/lorem-0.0.2/lib/lorem/version.rb +3 -0
  24. data/test/gemfiles/lorem-0.0.2/lib/lorem.rb +11 -0
  25. data/test/gemfiles/lorem-0.0.2/lorem.gemspec +24 -0
  26. data/test/gemfiles/lorem-0.0.2.gem +0 -0
  27. data/test/gemfiles/lorem-0.0.3/CHANGELOG.md +14 -0
  28. data/test/gemfiles/lorem-0.0.3/Gemfile +7 -0
  29. data/test/gemfiles/lorem-0.0.3/LICENSE.txt +3 -0
  30. data/test/gemfiles/lorem-0.0.3/README.md +29 -0
  31. data/test/gemfiles/lorem-0.0.3/Rakefile +2 -0
  32. data/test/gemfiles/lorem-0.0.3/bin/lorem +3 -0
  33. data/test/gemfiles/lorem-0.0.3/lib/lorem/utils.rb +7 -0
  34. data/test/gemfiles/lorem-0.0.3/lib/lorem/version.rb +3 -0
  35. data/test/gemfiles/lorem-0.0.3/lib/lorem.rb +11 -0
  36. data/test/gemfiles/lorem-0.0.3/lorem.gemspec +25 -0
  37. data/test/gemfiles/lorem-0.0.3.gem +0 -0
  38. data/test/gemfiles/lorem-0.0.4/CHANGELOG.md +21 -0
  39. data/test/gemfiles/lorem-0.0.4/Gemfile +6 -0
  40. data/test/gemfiles/lorem-0.0.4/LICENSE.txt +3 -0
  41. data/test/gemfiles/lorem-0.0.4/README.md +29 -0
  42. data/test/gemfiles/lorem-0.0.4/Rakefile +2 -0
  43. data/test/gemfiles/lorem-0.0.4/bin/lorem +3 -0
  44. data/test/gemfiles/lorem-0.0.4/lib/lorem/utils.rb +7 -0
  45. data/test/gemfiles/lorem-0.0.4/lib/lorem/version.rb +3 -0
  46. data/test/gemfiles/lorem-0.0.4/lib/lorem.rb +11 -0
  47. data/test/gemfiles/lorem-0.0.4/lorem.gemspec +25 -0
  48. data/test/gemfiles/lorem-0.0.4.gem +0 -0
  49. data/test/rubygems/comparator/test_gemfile_comparator.rb +1 -1
  50. data/test/rubygems/comparator/test_monitor.rb +14 -0
  51. data/test/rubygems/comparator/test_report.rb +2 -2
  52. data/test/rubygems/comparator/test_utils.rb +2 -2
  53. data/test/rubygems/test_gem_commands_compare_command.rb +7 -2
  54. data/test/test_helper.rb +3 -3
  55. metadata +47 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7df4e33aee62541f45cf35d72750e90610fb8169
4
- data.tar.gz: 351e523ea4397cb30f3bd08be5e22c5c4caac9ae
2
+ SHA256:
3
+ metadata.gz: 1c09e8b3861dd1a6af69e63f8f7c9c0a3d2d9b6102cc704b57fafdbe24307421
4
+ data.tar.gz: '09bc3fb40b398b255340a99064a217556933b8813068043f8604ea34dafab8d9'
5
5
  SHA512:
6
- metadata.gz: fc3957b06a9e91ee4f532247b682084984735354815956fbcf8676b616652f0766d658e5284e2839e7dd415d10f8db2bf97afe9a87ba75f2bfe1fdb2e7cc9b0e
7
- data.tar.gz: adea8e935fb98d84e1b96bd580649db1c5295d998c6cdef530fc20a8920a7f096acefa11352a386fbce7abe7baf3dddedd05998e68e7c2f92245f3d9291ca0db
6
+ metadata.gz: 28ddb738619dbcd1fc61bfa32d2d3572a8684d1ebea535bcc39228e924989e4a470ca4cc0a39b11b3b34f27b04efef3169c1673dad6bb98ef0d79bac6cd17000
7
+ data.tar.gz: 1c91d527ffa6580d88a90004c709f44e23a72c116ba1edd76c5b94f255e8bea475ab2c5084aeb8c243e8cfe77e8b5f70e1db0d7c33a0c94a6f3a9ed0ef9005c2
data/README.md CHANGED
@@ -1,18 +1,26 @@
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
 
11
- ```
12
- gem install gem-compare
15
+ ```bash
16
+ $ gem install gem-compare
13
17
  ```
14
18
 
15
- Once it's stable I will package it for Fedora.
19
+ You'll also need header files for `curl` to install the `curb` dependency. On Fedora, run:
20
+
21
+ ```bash
22
+ $ sudo dnf install -y libcurl-devel
23
+ ```
16
24
 
17
25
  ## Usage
18
26
 
@@ -158,12 +166,11 @@ $ gem compare --help
158
166
 
159
167
  ## Requirements
160
168
 
161
- Currently tested against RubyGems 2.x.
169
+ Currently tested against RubyGems 3.x. Use the `0.0.7` release for RubyGems 2.x.
162
170
 
163
- ## Contributions
164
-
165
- Contributions are welcome! Please send a PR and make sure you follow the coding style.
166
171
 
167
172
  ## Copyright
168
173
 
174
+ Made by [Josef Strzibny](https://strzibny.name).
175
+
169
176
  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
@@ -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 = Monitor.lines_changed(prev_file, curr_file)
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
- report[param][vers]['changed'] << \
166
- "#{file} #{line_changes}"
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 &block
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
@@ -1,3 +1,3 @@
1
1
  class Gem::Comparator
2
- VERSION = '0.0.7'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -164,11 +164,11 @@ class Gem::Comparator
164
164
  expanded << version
165
165
  next
166
166
  end
167
- op, v = (version.scan /(>=|<=|~>|!=|>|<|=)\s*(.*)/).flatten
167
+ op, v = (version.scan(/(>=|<=|~>|!=|>|<|=)\s*(.*)/)).flatten
168
168
  # Supported operator and version?
169
169
  if OPERATORS.include?(op) && v =~ VERSION_REGEX
170
170
  dep = Gem::Dependency.new gem_name, version
171
- specs_and_sources, errors = Gem::SpecFetcher.fetcher.spec_for_dependency dep
171
+ specs_and_sources, _errors = Gem::SpecFetcher.fetcher.spec_for_dependency dep
172
172
  specs_and_sources.each do |s|
173
173
  expanded << s[0].version
174
174
  end
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in lorem.gemspec
4
+ gemspec
@@ -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,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,3 @@
1
+ module Lorem
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,7 @@
1
+ require "lorem/version"
2
+
3
+ module Lorem
4
+ def hello_world
5
+ puts 'Hello World'
6
+ end
7
+ end
@@ -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,6 @@
1
+ lorem 0.0.2
2
+ ===========
3
+
4
+ - add changelog file
5
+ - change license to GPLv2
6
+ - add new method to lib/lorem.rb
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in lorem.gemspec
4
+ gemspec
@@ -0,0 +1,3 @@
1
+ Copyright (c) 2014 Josef Stribny
2
+
3
+ You can use this library under GPLv2 conditions.
@@ -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,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,3 @@
1
+ module Lorem
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,11 @@
1
+ require "lorem/version"
2
+
3
+ module Lorem
4
+ def hello_world
5
+ puts 'Hello World'
6
+ end
7
+
8
+ def new_method
9
+ raise 'needs to be implemented'
10
+ end
11
+ end
@@ -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,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in lorem.gemspec
4
+ gemspec
5
+
6
+ gem 'minitest'
7
+ gem 'appraisal'
@@ -0,0 +1,3 @@
1
+ Copyright (c) 2014 Josef Stribny
2
+
3
+ You can use this library under GPLv2 conditions.
@@ -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,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/ruby
2
+
3
+ puts 'Lorem Executable!'
@@ -0,0 +1,7 @@
1
+ def check_something
2
+
3
+ end
4
+
5
+ def make_something
6
+
7
+ end
@@ -0,0 +1,3 @@
1
+ module Lorem
2
+ VERSION = "0.0.3"
3
+ end
@@ -0,0 +1,11 @@
1
+ require "lorem/version"
2
+
3
+ module Lorem
4
+ def hello_world
5
+ puts 'Hello World'
6
+ end
7
+
8
+ def new_method
9
+ raise 'needs to be implemented'
10
+ end
11
+ end
@@ -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,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in lorem.gemspec
4
+ gemspec
5
+
6
+ gem 'minitest', '5.0.0'
@@ -0,0 +1,3 @@
1
+ Copyright (c) 2014 Josef Stribny
2
+
3
+ You can use this library under GPLv2 conditions.
@@ -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,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/ruby
2
+
3
+ puts 'Lorem Executable!'
@@ -0,0 +1,7 @@
1
+ def check_something
2
+
3
+ end
4
+
5
+ def make_something
6
+
7
+ end
@@ -0,0 +1,3 @@
1
+ module Lorem
2
+ VERSION = "0.0.4"
3
+ end
@@ -0,0 +1,11 @@
1
+ require "lorem/version"
2
+
3
+ module Lorem
4
+ def hello_world
5
+ puts 'Hello World'
6
+ end
7
+
8
+ def new_method
9
+ raise 'needs to be implemented'
10
+ end
11
+ end
@@ -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,7 +1,7 @@
1
- require 'rubygems/test_case'
1
+ require_relative '../../test_helper'
2
2
  require 'rubygems/comparator'
3
3
 
4
- class TestGemComparatorReport < Gem::TestCase
4
+ class TestGemComparatorReport < Minitest::Test
5
5
  def setup
6
6
  super
7
7
  @report = Gem::Comparator::Report.new
@@ -1,7 +1,7 @@
1
- require 'rubygems/test_case'
1
+ require_relative '../../test_helper'
2
2
  require 'rubygems/comparator'
3
3
 
4
- class TestGemComparatorUtils < Gem::TestCase
4
+ class TestGemComparatorUtils < Minitest::Test
5
5
  def setup
6
6
  super
7
7
  # This should pull in Gem::Comparator::Utils
@@ -1,11 +1,16 @@
1
- require 'rubygems/test_case'
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 < Gem::TestCase
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 'rubygems/test_case'
1
+ require 'minitest/autorun'
2
2
  require 'rubygems/comparator'
3
3
 
4
- class TestGemComparator < Gem::TestCase
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 < Gem::TestCase
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: 0.0.7
4
+ version: 1.0.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: 2015-08-04 00:00:00.000000000 Z
11
+ date: 2022-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -105,6 +105,45 @@ files:
105
105
  - lib/rubygems/comparator/utils.rb
106
106
  - lib/rubygems/comparator/version.rb
107
107
  - lib/rubygems_plugin.rb
108
+ - test/gemfiles/lorem-0.0.1.gem
109
+ - test/gemfiles/lorem-0.0.1/Gemfile
110
+ - test/gemfiles/lorem-0.0.1/LICENSE.txt
111
+ - test/gemfiles/lorem-0.0.1/README.md
112
+ - test/gemfiles/lorem-0.0.1/Rakefile
113
+ - test/gemfiles/lorem-0.0.1/lib/lorem.rb
114
+ - test/gemfiles/lorem-0.0.1/lib/lorem/version.rb
115
+ - test/gemfiles/lorem-0.0.1/lorem.gemspec
116
+ - test/gemfiles/lorem-0.0.2.gem
117
+ - test/gemfiles/lorem-0.0.2/CHANGELOG.md
118
+ - test/gemfiles/lorem-0.0.2/Gemfile
119
+ - test/gemfiles/lorem-0.0.2/LICENSE.txt
120
+ - test/gemfiles/lorem-0.0.2/README.md
121
+ - test/gemfiles/lorem-0.0.2/Rakefile
122
+ - test/gemfiles/lorem-0.0.2/lib/lorem.rb
123
+ - test/gemfiles/lorem-0.0.2/lib/lorem/version.rb
124
+ - test/gemfiles/lorem-0.0.2/lorem.gemspec
125
+ - test/gemfiles/lorem-0.0.3.gem
126
+ - test/gemfiles/lorem-0.0.3/CHANGELOG.md
127
+ - test/gemfiles/lorem-0.0.3/Gemfile
128
+ - test/gemfiles/lorem-0.0.3/LICENSE.txt
129
+ - test/gemfiles/lorem-0.0.3/README.md
130
+ - test/gemfiles/lorem-0.0.3/Rakefile
131
+ - test/gemfiles/lorem-0.0.3/bin/lorem
132
+ - test/gemfiles/lorem-0.0.3/lib/lorem.rb
133
+ - test/gemfiles/lorem-0.0.3/lib/lorem/utils.rb
134
+ - test/gemfiles/lorem-0.0.3/lib/lorem/version.rb
135
+ - test/gemfiles/lorem-0.0.3/lorem.gemspec
136
+ - test/gemfiles/lorem-0.0.4.gem
137
+ - test/gemfiles/lorem-0.0.4/CHANGELOG.md
138
+ - test/gemfiles/lorem-0.0.4/Gemfile
139
+ - test/gemfiles/lorem-0.0.4/LICENSE.txt
140
+ - test/gemfiles/lorem-0.0.4/README.md
141
+ - test/gemfiles/lorem-0.0.4/Rakefile
142
+ - test/gemfiles/lorem-0.0.4/bin/lorem
143
+ - test/gemfiles/lorem-0.0.4/lib/lorem.rb
144
+ - test/gemfiles/lorem-0.0.4/lib/lorem/utils.rb
145
+ - test/gemfiles/lorem-0.0.4/lib/lorem/version.rb
146
+ - test/gemfiles/lorem-0.0.4/lorem.gemspec
108
147
  - test/rubygems/comparator/test_dependency_comparator.rb
109
148
  - test/rubygems/comparator/test_dir_utils.rb
110
149
  - test/rubygems/comparator/test_file_list_comparator.rb
@@ -119,7 +158,7 @@ homepage: http://github.com/fedora-ruby/gem-compare
119
158
  licenses:
120
159
  - MIT
121
160
  metadata: {}
122
- post_install_message:
161
+ post_install_message:
123
162
  rdoc_options: []
124
163
  require_paths:
125
164
  - lib
@@ -127,17 +166,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
166
  requirements:
128
167
  - - ">="
129
168
  - !ruby/object:Gem::Version
130
- version: 2.0.0
169
+ version: 3.0.0
131
170
  required_rubygems_version: !ruby/object:Gem::Requirement
132
171
  requirements:
133
172
  - - ">="
134
173
  - !ruby/object:Gem::Version
135
- version: 2.0.0
174
+ version: 3.0.0
136
175
  requirements: []
137
- rubyforge_project:
138
- rubygems_version: 2.4.5
139
- signing_key:
176
+ rubygems_version: 3.2.32
177
+ signing_key:
140
178
  specification_version: 4
141
179
  summary: RubyGems plugin for comparing gem versions
142
180
  test_files: []
143
- has_rdoc: