gem-compare 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc96f307c32525272b20d96b0a7c2868aef1050c
4
- data.tar.gz: 823a99971f99e8e200e924292dc8bab39ddd12dc
3
+ metadata.gz: 7df4e33aee62541f45cf35d72750e90610fb8169
4
+ data.tar.gz: 351e523ea4397cb30f3bd08be5e22c5c4caac9ae
5
5
  SHA512:
6
- metadata.gz: b2fee98426cc1f86957e04cacb70c49c12ae031c303db12350e54ee42c7040ae9e745ff9be68da01e323b8e73a153c51fd61c0af5a1739cedf609fb6c398f38d
7
- data.tar.gz: e59e79ae3d3aedc2d8bc3591d2014a36213814e75950fa7ad628654154a1bf4215cddc71c9ad8ee8672597fe4de73d626d49433d69f7e7086476bd1d6238e14b
6
+ metadata.gz: fc3957b06a9e91ee4f532247b682084984735354815956fbcf8676b616652f0766d658e5284e2839e7dd415d10f8db2bf97afe9a87ba75f2bfe1fdb2e7cc9b0e
7
+ data.tar.gz: adea8e935fb98d84e1b96bd580649db1c5295d998c6cdef530fc20a8920a7f096acefa11352a386fbce7abe7baf3dddedd05998e68e7c2f92245f3d9291ca0db
data/README.md CHANGED
@@ -29,9 +29,9 @@ Compared versions: ["3.0.0", "4.0.0"]
29
29
  4.0.0: []
30
30
  DIFFERENT has_rdoc:
31
31
  3.0.0: true
32
- 4.0.0:
32
+ 4.0.0:
33
33
  DIFFERENT license:
34
- 3.0.0:
34
+ 3.0.0:
35
35
  4.0.0: MIT
36
36
  DIFFERENT licenses:
37
37
  3.0.0: []
@@ -103,10 +103,10 @@ Compared versions: ["2.0.1", "3.0.0"]
103
103
  (!) Shebang probably added: #!/usr/bin/env ruby
104
104
  ```
105
105
 
106
- If you would like to see all development dependencies for `prawn` since `0.1` version, let *gem-compare* expand the versions for you:
106
+ 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
107
 
108
108
  ```
109
- $ gem compare prawn '>=0.1' -k -a -p --development
109
+ $ gem compare prawn '>=0.1' -k -a --development
110
110
  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
111
  DIFFERENT development dependencies:
112
112
  0.12.0->0.13.0:
@@ -143,6 +143,12 @@ $ gem compare nokogiri 1.5.6 1.6.1 -ak --platform java # for JRuby
143
143
  $ gem compare nokogiri 1.5.6 1.6.1 -ak --platform x86-mingw32 # on Windows
144
144
  ```
145
145
 
146
+ #### Gems from different source server
147
+
148
+ If you run your own gem source server, you can override the RubyGems.org default with
149
+ `--sources SOURCE1,SOURCE2` option.
150
+
151
+
146
152
  ### Supported options
147
153
 
148
154
  To see all possible options run:
@@ -49,6 +49,10 @@ class Gem::Commands::CompareCommand < Gem::Command
49
49
  options[:brief] = true
50
50
  end
51
51
 
52
+ add_option('-sSOURCES', '--sources SOURCES', 'Use different source URIs for gems (separated by comma)') do |sources, options|
53
+ options[:sources] = sources.split ','
54
+ end
55
+
52
56
  end
53
57
 
54
58
  def arguments # :nodoc:
@@ -6,6 +6,8 @@ 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
- comparators.each do |c|
95
- comparator = c.new
96
- cmp = (comparator.compares == :packages) ? gem_packages.values : gem_specs.values
97
- @report = comparator.compare(cmp, @report, @options)
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
@@ -0,0 +1,3 @@
1
+ class Gem::Comparator
2
+ VERSION = '0.0.7'
3
+ end
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.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josef Stribny
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-15 00:00:00.000000000 Z
11
+ date: 2015-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -103,6 +103,7 @@ files:
103
103
  - lib/rubygems/comparator/report/entry.rb
104
104
  - lib/rubygems/comparator/spec_comparator.rb
105
105
  - lib/rubygems/comparator/utils.rb
106
+ - lib/rubygems/comparator/version.rb
106
107
  - lib/rubygems_plugin.rb
107
108
  - test/rubygems/comparator/test_dependency_comparator.rb
108
109
  - test/rubygems/comparator/test_dir_utils.rb
@@ -134,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
135
  version: 2.0.0
135
136
  requirements: []
136
137
  rubyforge_project:
137
- rubygems_version: 2.2.2
138
+ rubygems_version: 2.4.5
138
139
  signing_key:
139
140
  specification_version: 4
140
141
  summary: RubyGems plugin for comparing gem versions