gemirro 1.1.1 → 1.2.0

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
  SHA256:
3
- metadata.gz: 87f41903a6fc72f5282ec7d6f707736bc11a07d5856fe9b6390568942f39b6a2
4
- data.tar.gz: 68b8d3d5709f95f732891fd041a48a3c98d7ad28057fd0f4ec356af0cd478236
3
+ metadata.gz: 743376753a6202cadfe4fb780411c3b1a5c13b551aed1025abca32ec98bb8d0d
4
+ data.tar.gz: 9b251517b641c81a708c1d66e15c300d2e159d8024512107de2366418f638927
5
5
  SHA512:
6
- metadata.gz: f49439dcef571151c9ed97618de886ca9601001ea527fb75fae4decd9cede92cf3f6f5f636a54c0a7cacfcbfe8128174cab3ab069e9c4d7e352086797a4e97f3
7
- data.tar.gz: 234f1e30e1c46900fc1c407c5896da6554a713cef8ef57704f8db6d9662497541ac4e877360a4ce68d0571281c31ea25078604aa3aba8ff1b26ca095dc51769e
6
+ metadata.gz: 2d2bf4a45e5d4128ddfe0fe392bf326d8f35afbdb98ddbdca27edd3be53ff8841e51e6e96b7bc95a99b1a44a259a535453b2d6b28a6583a6d4cf6f46d2226bf1
7
+ data.tar.gz: 6a3eebf032d60e1eaf61b55fba14c0988d85e27b80d4a90ea69cbeb50c6e7a81cb73d648bd61144e46be42600af01e5c9ae30ef350a41674c8f1a92374ee1c30
@@ -9,6 +9,7 @@ AllCops:
9
9
  - files/**/*
10
10
  - templates/**/*
11
11
  - spec/**/*
12
+ - vendor/**/*
12
13
 
13
14
  Naming/FileName:
14
15
  Exclude:
@@ -162,7 +162,7 @@ module Gemirro
162
162
  # @return [Hash]
163
163
  #
164
164
  def ignored_gems
165
- @ignored_gems ||= Hash.new { |hash, key| hash[key] = [] }
165
+ @ignored_gems ||= Hash.new { |hash, key| hash[key] = {} }
166
166
  end
167
167
 
168
168
  ##
@@ -171,9 +171,10 @@ module Gemirro
171
171
  # @param [String] name
172
172
  # @param [String] version
173
173
  #
174
- def ignore_gem(name, version)
175
- ignored_gems[name] ||= []
176
- ignored_gems[name] << version
174
+ def ignore_gem(name, version, platform)
175
+ ignored_gems[platform] ||= {}
176
+ ignored_gems[platform][name] ||= []
177
+ ignored_gems[platform][name] << version
177
178
  end
178
179
 
179
180
  ##
@@ -183,8 +184,12 @@ module Gemirro
183
184
  # @param [String] version
184
185
  # @return [TrueClass|FalseClass]
185
186
  #
186
- def ignore_gem?(name, version)
187
- ignored_gems[name].include?(version)
187
+ def ignore_gem?(name, version, platform)
188
+ if ignored_gems[platform][name]
189
+ ignored_gems[platform][name].include?(version)
190
+ else
191
+ false
192
+ end
188
193
  end
189
194
 
190
195
  ##
@@ -105,12 +105,13 @@ module Gemirro
105
105
  end
106
106
  name = gem.name
107
107
 
108
- if gem_exists?(filename) || ignore_gem?(name, version) || !satisfied
108
+ if gem_exists?(filename) || ignore_gem?(name, version, gem.platform) ||
109
+ !satisfied
109
110
  Utils.logger.debug("Skipping #{filename}")
110
111
  return
111
112
  end
112
113
 
113
- Utils.configuration.ignore_gem(gem.name, version)
114
+ Utils.configuration.ignore_gem(gem.name, version, gem.platform)
114
115
  Utils.logger.info("Fetching #{filename}")
115
116
 
116
117
  fetch_from_source(filename, gem, version)
@@ -133,7 +134,7 @@ module Gemirro
133
134
  Utils.logger.error("Failed to retrieve #{filename}: #{e.message}")
134
135
  Utils.logger.debug("Adding #{filename} to the list of ignored Gems")
135
136
 
136
- Utils.configuration.ignore_gem(gem.name, version)
137
+ Utils.configuration.ignore_gem(gem.name, version, gem.platform)
137
138
  end
138
139
 
139
140
  data
@@ -1,4 +1,4 @@
1
1
  # Gemirro Version
2
2
  module Gemirro
3
- VERSION = '1.1.1'.freeze
3
+ VERSION = '1.2.0'.freeze
4
4
  end
@@ -68,10 +68,10 @@ module Gemirro
68
68
 
69
69
  it 'should return ignored gems' do
70
70
  expect(@config.ignored_gems).to eq({})
71
- expect(@config.ignore_gem?('rake', '1.0.0')).to be_falsy
72
- expect(@config.ignore_gem('rake', '1.0.0')).to eq(['1.0.0'])
73
- expect(@config.ignored_gems).to eq('rake' => ['1.0.0'])
74
- expect(@config.ignore_gem?('rake', '1.0.0')).to be_truthy
71
+ expect(@config.ignore_gem?('rake', '1.0.0', 'ruby')).to be_falsy
72
+ expect(@config.ignore_gem('rake', '1.0.0', 'ruby')).to eq(['1.0.0'])
73
+ expect(@config.ignored_gems).to eq('ruby' => {'rake' => ['1.0.0']})
74
+ expect(@config.ignore_gem?('rake', '1.0.0', 'ruby')).to be_truthy
75
75
  end
76
76
 
77
77
  it 'should add and return source' do
@@ -34,9 +34,9 @@ module Gemirro
34
34
  it 'should ignore gem' do
35
35
  allow(Utils.logger).to receive(:info)
36
36
  .once.with('Fetching gemirro-0.0.1.gem')
37
- expect(@fetcher.ignore_gem?('gemirro', '0.0.1')).to be_falsy
38
- Utils.configuration.ignore_gem('gemirro', '0.0.1')
39
- expect(@fetcher.ignore_gem?('gemirro', '0.0.1')).to be_truthy
37
+ expect(@fetcher.ignore_gem?('gemirro', '0.0.1', 'ruby')).to be_falsy
38
+ Utils.configuration.ignore_gem('gemirro', '0.0.1', 'ruby')
39
+ expect(@fetcher.ignore_gem?('gemirro', '0.0.1', 'ruby')).to be_truthy
40
40
  end
41
41
 
42
42
  it 'should log error when fetch gem failed' do
@@ -44,7 +44,7 @@ module Gemirro
44
44
  .once.with('Fetching gemirro-0.0.1.gem')
45
45
  gem = Gem.new('gemirro')
46
46
  version = ::Gem::Version.new('0.0.1')
47
- Utils.configuration.ignore_gem('gemirro', '0.0.1')
47
+ Utils.configuration.ignore_gem('gemirro', '0.0.1', 'ruby')
48
48
  allow(@source).to receive(:fetch_gem)
49
49
  .once.with('gemirro', version).and_raise(ArgumentError)
50
50
  allow(Utils.logger).to receive(:error)
@@ -53,7 +53,7 @@ module Gemirro
53
53
  .once.with(/Adding (.*) to the list of ignored Gems/)
54
54
 
55
55
  expect(@fetcher.fetch_gem(gem, version)).to be_nil
56
- expect(@fetcher.ignore_gem?('gemirro', '0.0.1')).to be_truthy
56
+ expect(@fetcher.ignore_gem?('gemirro', '0.0.1', 'ruby')).to be_truthy
57
57
  end
58
58
 
59
59
  it 'should fetch gem' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemirro
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Rambaud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-31 00:00:00.000000000 Z
11
+ date: 2019-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -317,7 +317,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
317
317
  version: '0'
318
318
  requirements: []
319
319
  rubyforge_project:
320
- rubygems_version: 2.7.3
320
+ rubygems_version: 2.7.5
321
321
  signing_key:
322
322
  specification_version: 4
323
323
  summary: Gem for easily creating your own gems mirror.