gemirro 0.13.3 → 0.13.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of gemirro might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82b43d4fb674a2d477ca6e36892ce24cb75dc27e
4
- data.tar.gz: 6722f23ee14197f2eed5fdb3089b0bfaddb3321b
3
+ metadata.gz: 8a04e50004bf7949e1460687017117748843d66b
4
+ data.tar.gz: 43fea5e3676366061ddbdd9cb7ff0785feea2013
5
5
  SHA512:
6
- metadata.gz: 72c637dddc14a1a6f6f9649df99fd6e04dbbcfce0926b99c44ef084a8bda8d148507616ac80497df4e7ed609c37b3a7112fa310d1d64319995699ea88c6df388
7
- data.tar.gz: 0318c861a49c17318dec009db0284022459e839a6fdd2b74f26c5be1b4a784540b0d120ef09085bf95d932fe1e485f1434ad9734255e44194cc86c978894fbce
6
+ metadata.gz: 1e5019265061371cd6abba03fa3ed675898425615fba0bbe52a4f7eff53dede9f6a7d18e0f88a064585f34bcadf7076b7ec928117a4231a78769bdb50bd0b2f8
7
+ data.tar.gz: f3f21f3b670904827f8784ac52554441e9dde294adb88ffff2f76c439e91fb5672452a5ef6a59221efb3d86794ba53e3c2e25923e72fa1beaf1004229396c7ca
data/README.md CHANGED
@@ -6,7 +6,7 @@ More, to mirroring a source, you only need to start the server, and gems will au
6
6
 
7
7
  ## Requirements
8
8
 
9
- * Ruby 1.9.2 or newer
9
+ * Ruby 2.0.0 or newer
10
10
  * Enough space to store Gems
11
11
  * A recent version of Rubygems (`gem update --system`)
12
12
 
@@ -80,7 +80,7 @@ See `<command> --help` for more information on a specific command.
80
80
 
81
81
  ## Apache configuration
82
82
 
83
- You must active the apache `proxy` module.
83
+ You must activate the apache `proxy` module.
84
84
 
85
85
  ```bash
86
86
  $ sudo a2enmod proxy
@@ -94,8 +94,8 @@ Create your VirtualHost and replace following `http://localhost:2000` with your
94
94
  ServerName mirror.gemirro
95
95
  ProxyPreserveHost On
96
96
  ProxyRequests off
97
- ProxyPass / http://localhost:2000
98
- ProxyPassReverse / http://localhost:2000
97
+ ProxyPass / http://localhost:2000/
98
+ ProxyPassReverse / http://localhost:2000/
99
99
  </VirtualHost>
100
100
  ```
101
101
 
@@ -43,7 +43,7 @@ Gemirro::CLI.options.command 'server' do
43
43
 
44
44
  def create_pid
45
45
  File.open(@pid_file, 'w') do |f|
46
- f.write("#{Process.pid}")
46
+ f.write(Process.pid.to_s)
47
47
  end
48
48
  rescue Errno::EACCES
49
49
  STDOUT.reopen @orig_stdout
data/lib/gemirro/cli.rb CHANGED
@@ -11,7 +11,7 @@ module Gemirro
11
11
  strict: true,
12
12
  help: true,
13
13
  banner: 'Usage: gemirro [COMMAND] [OPTIONS]'
14
- }
14
+ }.freeze
15
15
 
16
16
  ##
17
17
  # @return [Slop]
@@ -25,13 +25,13 @@ module Gemirro
25
25
  attr_accessor :source, :ignored_gems, :logger
26
26
 
27
27
  LOGGER_LEVEL = {
28
- 'debug' => Logger::DEBUG,
28
+ 'debug' => Logger::DEBUG,
29
29
  'warning' => Logger::WARN,
30
30
  'info' => Logger::INFO,
31
31
  'unknown' => Logger::UNKNOWN,
32
32
  'error' => Logger::ERROR,
33
33
  'fatal' => Logger::FATAL
34
- }
34
+ }.freeze
35
35
 
36
36
  ##
37
37
  # Returns the logger
data/lib/gemirro/gem.rb CHANGED
@@ -15,7 +15,7 @@ module Gemirro
15
15
  class Gem
16
16
  attr_reader :name, :requirement, :platform, :version
17
17
  attr_accessor :gemspec
18
- ONLY_LATEST = [:latest, :newest]
18
+ ONLY_LATEST = [:latest, :newest].freeze
19
19
 
20
20
  ##
21
21
  # Returns a `Gem::Version` instance based on the specified requirement.
@@ -58,7 +58,7 @@ module Gemirro
58
58
  # @return [TrueClass|FalseClass]
59
59
  #
60
60
  def version?
61
- version && !version.segments.reject { |s| s == 0 }.empty?
61
+ version && !version.segments.reject(&:zero?).empty?
62
62
  end
63
63
 
64
64
  ##
@@ -55,8 +55,8 @@ module Gemirro
55
55
  def <=>(other)
56
56
  sort = other.name <=> @name
57
57
  sort = version <=> other.version if sort.zero?
58
- sort = (other.ruby? && !ruby?) ? 1 : -1 if sort.zero? &&
59
- ruby? != other.ruby?
58
+ sort = other.ruby? && !ruby? ? 1 : -1 if sort.zero? &&
59
+ ruby? != other.ruby?
60
60
  sort = other.platform <=> @platform if sort.zero?
61
61
 
62
62
  sort
@@ -30,11 +30,11 @@ module Gemirro
30
30
  if gem.gemspec?
31
31
  gemfile = fetch_gemspec(gem, version)
32
32
  Utils.configuration.mirror_gemspecs_directory
33
- .add_file(gem.gemspec_filename(version), gemfile) if gemfile
33
+ .add_file(gem.gemspec_filename(version), gemfile) if gemfile
34
34
  else
35
35
  gemfile = fetch_gem(gem, version)
36
36
  Utils.configuration.mirror_gems_directory
37
- .add_file(gem.filename(version), gemfile) if gemfile
37
+ .add_file(gem.filename(version), gemfile) if gemfile
38
38
  end
39
39
  end
40
40
  end
@@ -68,7 +68,8 @@ module Gemirro
68
68
  # @return [String]
69
69
  #
70
70
  def fetch_gemspec(gem, version)
71
- filename = gem.gemspec_filename(version)
71
+ filename = gem.gemspec_filename(version)
72
+ puts filename.inspect
72
73
  satisfied = if gem.only_latest?
73
74
  true
74
75
  else
@@ -81,7 +82,7 @@ module Gemirro
81
82
  end
82
83
 
83
84
  Utils.logger.info("Fetching #{filename}")
84
- fetch_from_source(gem, version, true)
85
+ fetch_from_source(filename, gem, version, true)
85
86
  end
86
87
 
87
88
  ##
@@ -108,21 +109,21 @@ module Gemirro
108
109
  Utils.configuration.ignore_gem(gem.name, version)
109
110
  Utils.logger.info("Fetching #{filename}")
110
111
 
111
- fetch_from_source(gem, version)
112
+ fetch_from_source(filename, gem, version)
112
113
  end
113
114
 
114
115
  ##
115
116
  #
116
- #
117
+ # @param [String] filename
117
118
  # @param [Gemirro::Gem] gem
118
119
  # @param [Gem::Version] version
119
120
  # @return [String]
120
121
  #
121
- def fetch_from_source(gem, version, gemspec = false)
122
+ def fetch_from_source(filename, gem, version, gemspec = false)
122
123
  data = nil
123
124
  begin
124
- data = @source.fetch_gem(gem.name, version) unless gemspec
125
- data = @source.fetch_gemspec(gem.name, version) if gemspec
125
+ data = @source.fetch_gem(filename) unless gemspec
126
+ data = @source.fetch_gemspec(filename) if gemspec
126
127
  rescue => e
127
128
  filename = gem.filename(version)
128
129
  Utils.logger.error("Failed to retrieve #{filename}: #{e.message}")
data/lib/gemirro/http.rb CHANGED
@@ -21,7 +21,7 @@ module Gemirro
21
21
  response = client.get(url, follow_redirect: true)
22
22
 
23
23
  unless HTTP::Status.successful?(response.status)
24
- fail HTTPClient::BadResponseError, response.reason
24
+ raise HTTPClient::BadResponseError, response.reason
25
25
  end
26
26
 
27
27
  response
@@ -39,7 +39,7 @@ module Gemirro
39
39
  require 'zlib'
40
40
 
41
41
  unless defined?(Builder::XChar)
42
- fail 'Gem::Indexer requires that the XML Builder ' \
42
+ raise 'Gem::Indexer requires that the XML Builder ' \
43
43
  'library be installed:' \
44
44
  "\n\tgem install builder"
45
45
  end
@@ -93,7 +93,7 @@ module Gemirro
93
93
  #
94
94
  def install_indicies
95
95
  Utils.logger
96
- .debug("Downloading index into production dir #{@dest_directory}")
96
+ .debug("Downloading index into production dir #{@dest_directory}")
97
97
 
98
98
  files = @files
99
99
  files.delete @quick_marshal_dir if files.include? @quick_dir
@@ -184,13 +184,19 @@ module Gemirro
184
184
  Utils.logger.info("[#{index + 1}/#{gems.size}]: Processing #{gemfile.split('/')[-1]}")
185
185
  # rubocop:enable Metrics/LineLength
186
186
 
187
- if File.size(gemfile) == 0
187
+ if File.size(gemfile).zero?
188
188
  Utils.logger.warn("Skipping zero-length gem: #{gemfile}")
189
189
  next
190
190
  end
191
191
 
192
192
  begin
193
- spec = ::Gem::Package.new(gemfile).spec
193
+ if ::Gem::Package.respond_to? :open
194
+ spec = ::Gem::Package
195
+ .open(File.open(gemfile, 'rb'), 'r', &:metadata)
196
+ else
197
+ spec = ::Gem::Package.new(gemfile).spec
198
+ end
199
+
194
200
  spec.loaded_from = gemfile
195
201
 
196
202
  # HACK: fuck this shit - borks all tests that use pl1
@@ -203,6 +209,13 @@ module Gemirro
203
209
  next
204
210
  end
205
211
 
212
+ version = spec.version.version
213
+ unless version =~ /^\d+\.\d+\.\d+.*/
214
+ msg = "Skipping gem #{spec.full_name} - invalid version #{version}"
215
+ Utils.logger.warn(msg)
216
+ next
217
+ end
218
+
206
219
  if ::Gem::VERSION >= '2.5.0'
207
220
  spec.abbreviate
208
221
  spec.sanitize
@@ -247,11 +260,11 @@ module Gemirro
247
260
 
248
261
  ::Gem::Specification.dirs = []
249
262
  ::Gem::Specification.all = *specs
250
- if ::Gem::VERSION >= '2.5.0'
251
- files = build_marshal_gemspecs specs
252
- else
253
- files = build_marshal_gemspecs
254
- end
263
+ files = if ::Gem::VERSION >= '2.5.0'
264
+ build_marshal_gemspecs specs
265
+ else
266
+ build_marshal_gemspecs
267
+ end
255
268
 
256
269
  ::Gem.time('Updated indexes') do
257
270
  update_specs_index(released, @dest_specs_index, @specs_index)
@@ -8,9 +8,9 @@ module Gemirro
8
8
  #
9
9
  class Server < Sinatra::Base
10
10
  # rubocop:disable Metrics/LineLength
11
- URI_REGEXP = /^(.*)-(\d+(?:\.\d+){1,4}.*?)(?:-x86-(?:(?:mswin|mingw)(?:32|64)).*?)?\.(gem(?:spec\.rz)?)$/
12
- GEMSPEC_TYPE = 'gemspec.rz'
13
- GEM_TYPE = 'gem'
11
+ URI_REGEXP = /^(.*)-(\d+(?:\.\d+){1,4}.*?)(?:-(x86-(?:(?:mswin|mingw)(?:32|64)).*?|java))?\.(gem(?:spec\.rz)?)$/
12
+ GEMSPEC_TYPE = 'gemspec.rz'.freeze
13
+ GEM_TYPE = 'gem'.freeze
14
14
 
15
15
  access_logger = Logger.new(Utils.configuration.server.access_log).tap do |logger|
16
16
  ::Logger.class_eval { alias_method :write, :'<<' }
@@ -130,11 +130,11 @@ module Gemirro
130
130
  result = name.match(URI_REGEXP)
131
131
  return unless result
132
132
 
133
- gem_name, gem_version, gem_type = result.captures
133
+ gem_name, gem_version, gem_platform, gem_type = result.captures
134
134
  return unless gem_name && gem_version
135
135
 
136
136
  begin
137
- gem = Utils.stored_gem(gem_name, gem_version)
137
+ gem = Utils.stored_gem(gem_name, gem_version, gem_platform)
138
138
  gem.gemspec = true if gem_type == GEMSPEC_TYPE
139
139
 
140
140
  # rubocop:disable Metrics/LineLength
@@ -143,7 +143,7 @@ module Gemirro
143
143
  # rubocop:enable Metrics/LineLength
144
144
 
145
145
  Utils.logger
146
- .info("Try to download #{gem_name} with version #{gem_version}")
146
+ .info("Try to download #{gem_name} with version #{gem_version}")
147
147
  Utils.gems_fetcher.source.gems.clear
148
148
  Utils.gems_fetcher.source.gems.push(gem)
149
149
  Utils.gems_fetcher.fetch
@@ -58,26 +58,25 @@ module Gemirro
58
58
  # @param [String] version
59
59
  # @return [String]
60
60
  #
61
- def fetch_gem(name, version)
61
+ def fetch_gem(filename)
62
62
  Utils.logger.info(
63
- "Fetching gem #{name}, #{version} on #{@name} (#{@host})"
63
+ "Fetching gem #{filename} on #{@host}"
64
64
  )
65
- Http.get(host + "/gems/#{name}-#{version}.gem").body
65
+ Http.get(host + "/gems/#{filename}").body
66
66
  end
67
67
 
68
68
  ##
69
69
  # Fetches the `.gemspec.rz` file of a given Gem and version.
70
70
  #
71
- # @param [String] name
72
- # @param [String] version
71
+ # @param [String] filename
73
72
  # @return [String]
74
73
  #
75
- def fetch_gemspec(name, version)
74
+ def fetch_gemspec(filename)
76
75
  Utils.logger.info(
77
- "Fetching gemspec #{name}, #{version} on #{@name} (#{@host})"
76
+ "Fetching gemspec #{filename} on #{@host}"
78
77
  )
79
78
  marshal = Gemirro::Configuration.marshal_identifier
80
- Http.get(host + "/quick/#{marshal}/#{name}-#{version}.gemspec.rz").body
79
+ Http.get(host + "/quick/#{marshal}/#{filename}").body
81
80
  end
82
81
 
83
82
  ##
data/lib/gemirro/utils.rb CHANGED
@@ -16,8 +16,7 @@ module Gemirro
16
16
  attr_reader(:cache,
17
17
  :versions_fetcher,
18
18
  :gems_fetcher,
19
- :gems_orig_collection,
20
- :gems_source_collection,
19
+ :gems_collection,
21
20
  :stored_gems)
22
21
  ##
23
22
  # Cache class to store marshal and data into files
@@ -36,21 +35,32 @@ module Gemirro
36
35
  # @return [Gemirro::GemVersionCollection]
37
36
  #
38
37
  def self.gems_collection(orig = true)
39
- return @gems_orig_collection if orig && !@gems_orig_collection.nil?
40
- return @gems_source_collection if !orig && !@gems_source_collection.nil?
38
+ @gems_collection = {} if @gems_collection.nil?
39
+
40
+ is_orig = orig ? 1 : 0
41
+ data = @gems_collection[is_orig]
42
+ data = { files: {}, values: nil } if data.nil?
43
+
44
+ file_paths = specs_files_paths(orig)
45
+ has_file_changed = false
46
+ file_paths.pmap do |file_path|
47
+ next if data[:files].key?(file_path) &&
48
+ data[:files][file_path] == File.mtime(file_path)
49
+ has_file_changed = true
50
+ end
51
+
52
+ # Return result if no file changed
53
+ return @gems_collection[is_orig][:values] unless has_file_changed
41
54
 
42
55
  gems = []
43
- specs_files_paths(orig).pmap do |specs_file_path|
44
- next unless File.exist?(specs_file_path)
45
- spec_gems = cache.cache(File.basename(specs_file_path)) do
46
- Marshal.load(Zlib::GzipReader.open(specs_file_path).read)
47
- end
48
- gems.concat(spec_gems)
56
+ file_paths.pmap do |file_path|
57
+ next unless File.exist?(file_path)
58
+ gems.concat(Marshal.load(Zlib::GzipReader.open(file_path).read))
59
+ data[:files][file_path] = File.mtime(file_path)
49
60
  end
50
61
 
51
62
  collection = GemVersionCollection.new(gems)
52
- @gems_source_collection = collection unless orig
53
- @gems_orig_collection = collection if orig
63
+ data[:values] = collection
54
64
 
55
65
  collection
56
66
  end
@@ -67,8 +77,7 @@ module Gemirro
67
77
  File.join(configuration.destination,
68
78
  [specs_file_type,
69
79
  marshal_version,
70
- 'gz' + (orig ? '.orig' : '')
71
- ].join('.'))
80
+ 'gz' + (orig ? '.orig' : '')].join('.'))
72
81
  end
73
82
  end
74
83
 
@@ -108,8 +117,8 @@ module Gemirro
108
117
  # @return [Gemirro::GemsFetcher]
109
118
  #
110
119
  def self.gems_fetcher
111
- @gems_fetcher ||= Gemirro::GemsFetcher.new(
112
- configuration.source, versions_fetcher)
120
+ @gems_fetcher ||= Gemirro::GemsFetcher
121
+ .new(configuration.source, versions_fetcher)
113
122
  end
114
123
 
115
124
  ##
@@ -119,6 +128,7 @@ module Gemirro
119
128
  # @return [Gem]
120
129
  #
121
130
  def self.stored_gem(gem_name, gem_version, platform = 'ruby')
131
+ platform = 'ruby' if platform.nil?
122
132
  @stored_gems ||= {}
123
133
  # rubocop:disable Metrics/LineLength
124
134
  @stored_gems[gem_name] = {} unless @stored_gems.key?(gem_name)
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Gemirro Version
3
3
  module Gemirro
4
- VERSION = '0.13.3'
4
+ VERSION = '0.13.4'.freeze
5
5
  end
@@ -64,7 +64,7 @@ module Gemirro
64
64
  gem = Gem.new('gemirro')
65
65
  version = ::Gem::Version.new('0.0.1')
66
66
  allow(@source).to receive(:fetch_gem)
67
- .with('gemirro', version).and_return('gemirro')
67
+ .with('gemirro-0.0.1.gem').and_return('gemirro')
68
68
 
69
69
  expect(@fetcher.fetch_gem(gem, version)).to eq('gemirro')
70
70
  end
@@ -76,7 +76,7 @@ module Gemirro
76
76
  gem = Gem.new('gemirro', :latest)
77
77
  version = ::Gem::Version.new('0.0.1')
78
78
  allow(@source).to receive(:fetch_gem)
79
- .with('gemirro', version).and_return('gemirro')
79
+ .with('gemirro-0.0.1.gem').and_return('gemirro')
80
80
 
81
81
  expect(@fetcher.fetch_gem(gem, version)).to eq('gemirro')
82
82
  end
@@ -89,7 +89,7 @@ module Gemirro
89
89
  gem.gemspec = true
90
90
  version = ::Gem::Version.new('0.0.1')
91
91
  allow(@source).to receive(:fetch_gemspec)
92
- .once.with('gemirro', version).and_return('gemirro')
92
+ .once.with('gemirro-0.0.1.gemspec.rz').and_return('gemirro')
93
93
 
94
94
  expect(@fetcher.fetch_gemspec(gem, version)).to eq('gemirro')
95
95
  end
@@ -102,7 +102,7 @@ module Gemirro
102
102
  gem.gemspec = true
103
103
  version = ::Gem::Version.new('0.0.1')
104
104
  allow(@source).to receive(:fetch_gemspec)
105
- .once.with('gemirro', version).and_return('gemirro')
105
+ .once.with('gemirro-0.0.1.gemspec.rz').and_return('gemirro')
106
106
 
107
107
  expect(@fetcher.fetch_gemspec(gem, version)).to eq('gemirro')
108
108
  end
@@ -126,8 +126,10 @@ module Gemirro
126
126
  'gems/gemirro-0.0.2.gem',
127
127
  'gems/gemirro-0.0.3.gem',
128
128
  'gems/gemirral-0.0.1.gem'])
129
- allow(indexer).to receive(:build_marshal_gemspecs).once.and_return([
130
- "#{indexer.directory}/quick/gemirro-0.0.1.gemspec.rz"])
129
+
130
+ allow(indexer).to receive(:build_marshal_gemspecs).once
131
+ .and_return(["#{indexer.directory}/quick/gemirro-0.0.1.gemspec.rz"])
132
+
131
133
  allow(indexer).to receive(:compress_indicies).once.and_return(true)
132
134
  allow(indexer).to receive(:compress_indices).once.and_return(true)
133
135
 
@@ -172,8 +174,9 @@ module Gemirro
172
174
  allow(indexer).to receive(:compress_indicies)
173
175
  allow(indexer).to receive(:compress_indices)
174
176
  allow(indexer).to receive(:build_zlib_file)
175
- allow(indexer).to receive(:build_marshal_gemspecs).once.and_return([
176
- "#{indexer.directory}/quick/gemirro-0.0.1.gemspec.rz"])
177
+ # rubocop:disable Metrics/LineLength
178
+ allow(indexer).to receive(:build_marshal_gemspecs).once.and_return(["#{indexer.directory}/quick/gemirro-0.0.1.gemspec.rz"])
179
+ # rubocop:enable Metrics/LineLength
177
180
 
178
181
  allow(Marshal).to receive(:load).and_return(['content'])
179
182
  allow(Marshal).to receive(:dump).and_return(['content'])
@@ -71,38 +71,40 @@ module Gemirro
71
71
  Struct.new('SuccessGzipReader', :read)
72
72
  gzip_reader = Struct::SuccessGzipReader.new(marshal_dump)
73
73
  MirrorDirectory.new('/var/www/gemirro')
74
- .add_directory('quick/Marshal.4.8')
74
+ .add_directory('quick/Marshal.4.8')
75
+ # rubocop:disable Metrics/LineLength
75
76
  MirrorFile.new('/var/www/gemirro/quick/Marshal.4.8/' \
76
77
  'volay-0.1.0.gemspec.rz')
77
- .write("x\x9C\x8D\x94]\x8F\xD2@\x14\x86\x89Y\xBB\xB4|\xEC\x12\xD7h" \
78
- "\xD4h\xD3K\x13J\x01\x97\xC84n\x9A\xA8\xBBi\xE2\xC5\x06\xBB" \
79
- "{\xC3\x85)\xE5\x00\x13f:u:E\xD1\xC4\xDF\xE6\xB5\xBF\xCAiK" \
80
- "\x11\xE3GK\xEF\x98\xF7\xBC\xCFy\xCF\xC9\xCCQ=A\x0F\xAE\x80" \
81
- "\"\xF4>\x82\x00/p\xE0\v\xCC\xC2;\xC1\xDD\xA3\xFA\xF4\xA1k4" \
82
- "\x06\xA6e\xF6_(Hy\xEBa\xD55\xB4\r#\xFEV\xB1k\xDE\r\xEAdu" \
83
- "\xB7\xC0cY1U\xE4\xA1\x95\x8A\xD3C7A\xAA\x87)\xB4\x9C\x1FO" \
84
- "\xBE\xD7\xE4OA\xEA\x17\x16\x82k\xD4o\xBC\xD7\x99\xC2x\xEC" \
85
- "\xAD@\xBFe$\xA1\xA0\xC7\xDBX\x00\xD5\x05/\xBC\xEFg\xDE\x13" \
86
- "\xF8\x98`\x0E\x14B1U\xE4w\xEC\x1A\xC7\x17\xAF2\x85\xADd\xC4" \
87
- "\xBE96\x87\xF9\x1F\xEA\xDF%\x8A\x95\xE3T\x9E\xCC2\xF3i\x9B" \
88
- "\xA1\xB3\xCC\xFE\rD\x10\xCE!\f\xB6\x1A\xD2\x9C\xD0\xA7\xB2" \
89
- "\xBF\x13\x8A?\x13<\xEB\x06\x04\xA7b\xD4q\xF8\xAF&\x0E!\xDF" \
90
- ".~\xEF\xE3\xDC\xCC@\xD2Hl\#@M\x9E\x84BN\x00\x9D:\x11\a\x0E" \
91
- "\x04\xFC\x18.\xD1#g\x93\xCF\xEB\xC3\x81m\\\xC1\x97\xD9" \
92
- "\x9Af7\\\xE3l\xD7_\xBC\x02BX\"\xD23\xBB\xF9o\x83A\xB1\x12" \
93
- "\xBBe\xB7\xED\x93K\xFB\xB4\x82\xB6\x80\xA9K\xB1\x1E\x96" \
94
- "\x10\xEA\x03sP\xCD\xBFP\x16\xEE\x8D\x85\xBF\x86E\\\x96" \
95
- "\xC02G\xF9\b\xEC\x16:\x9D\xC3\x06\b\x8B\xD2\xA9\x95\x84" \
96
- "\xD9\x97\xED\xC3p\x89+\x81\xA9}\xAB`\xD9\x9D\xFF\x03\xF6" \
97
- "\xD2\xC2\xBF\xCD\xFD`\xDD\x15\x10\x97\xED\xA4.[\xAB\xC6(" \
98
- "\x94\x05B\xE3\xB1\xBC\xA5e\xF6\xC3\xAA\x11\n\xE5>A\x8CiD " \
99
- "`\x9B\xF2\x04\xE3\xCA\t\xC6\x87\by-f,`Q\xD9\x1E,sp^q\x0F" \
100
- "\x85\xD4r\x8Dg\x11\x06\xCE\xC1\xE4>\x9D\xF9\xC9\xFC\xE5" \
101
- "\xC8YR\x1F\x133`4\xBB\xF9R~\xEF:\x93\xE8\x93\\\x92\xBF\r" \
102
- "\xA3\t\xF8\x84l\xF5<\xBF\xBE\xF9\xE3Q\xD2?q,\x04\x84:\x0E" \
103
- "\xF5\xF4\x1D1\xF3\xBA\xE7+!\"\xD4\xEB-\xB1X%\xB3\x14\xD3" \
104
- "\xCB\xEDw\xEE\xBD\xFDk\xE99OSz\xF3\xEA\xFA]w7\xF5\xAF\xB5" \
105
- "\x9F+\xFEG\x96")
78
+ .write("x\x9C\x8D\x94]\x8F\xD2@\x14\x86\x89Y\xBB\xB4|\xEC\x12\xD7h" \
79
+ "\xD4h\xD3K\x13J\x01\x97\xC84n\x9A\xA8\xBBi\xE2\xC5\x06\xBB" \
80
+ "{\xC3\x85)\xE5\x00\x13f:u:E\xD1\xC4\xDF\xE6\xB5\xBF\xCAiK" \
81
+ "\x11\xE3GK\xEF\x98\xF7\xBC\xCFy\xCF\xC9\xCCQ=A\x0F\xAE\x80" \
82
+ "\"\xF4>\x82\x00/p\xE0\v\xCC\xC2;\xC1\xDD\xA3\xFA\xF4\xA1k4" \
83
+ "\x06\xA6e\xF6_(Hy\xEBa\xD55\xB4\r#\xFEV\xB1k\xDE\r\xEAdu" \
84
+ "\xB7\xC0cY1U\xE4\xA1\x95\x8A\xD3C7A\xAA\x87)\xB4\x9C\x1FO" \
85
+ "\xBE\xD7\xE4OA\xEA\x17\x16\x82k\xD4o\xBC\xD7\x99\xC2x\xEC" \
86
+ "\xAD@\xBFe$\xA1\xA0\xC7\xDBX\x00\xD5\x05/\xBC\xEFg\xDE\x13" \
87
+ "\xF8\x98`\x0E\x14B1U\xE4w\xEC\x1A\xC7\x17\xAF2\x85\xADd\xC4" \
88
+ "\xBE96\x87\xF9\x1F\xEA\xDF%\x8A\x95\xE3T\x9E\xCC2\xF3i\x9B" \
89
+ "\xA1\xB3\xCC\xFE\rD\x10\xCE!\f\xB6\x1A\xD2\x9C\xD0\xA7\xB2" \
90
+ "\xBF\x13\x8A?\x13<\xEB\x06\x04\xA7b\xD4q\xF8\xAF&\x0E!\xDF" \
91
+ ".~\xEF\xE3\xDC\xCC@\xD2Hl\#@M\x9E\x84BN\x00\x9D:\x11\a\x0E" \
92
+ "\x04\xFC\x18.\xD1#g\x93\xCF\xEB\xC3\x81m\\\xC1\x97\xD9" \
93
+ "\x9Af7\\\xE3l\xD7_\xBC\x02BX\"\xD23\xBB\xF9o\x83A\xB1\x12" \
94
+ "\xBBe\xB7\xED\x93K\xFB\xB4\x82\xB6\x80\xA9K\xB1\x1E\x96" \
95
+ "\x10\xEA\x03sP\xCD\xBFP\x16\xEE\x8D\x85\xBF\x86E\\\x96" \
96
+ "\xC02G\xF9\b\xEC\x16:\x9D\xC3\x06\b\x8B\xD2\xA9\x95\x84" \
97
+ "\xD9\x97\xED\xC3p\x89+\x81\xA9}\xAB`\xD9\x9D\xFF\x03\xF6" \
98
+ "\xD2\xC2\xBF\xCD\xFD`\xDD\x15\x10\x97\xED\xA4.[\xAB\xC6(" \
99
+ "\x94\x05B\xE3\xB1\xBC\xA5e\xF6\xC3\xAA\x11\n\xE5>A\x8CiD " \
100
+ "`\x9B\xF2\x04\xE3\xCA\t\xC6\x87\by-f,`Q\xD9\x1E,sp^q\x0F" \
101
+ "\x85\xD4r\x8Dg\x11\x06\xCE\xC1\xE4>\x9D\xF9\xC9\xFC\xE5" \
102
+ "\xC8YR\x1F\x133`4\xBB\xF9R~\xEF:\x93\xE8\x93\\\x92\xBF\r" \
103
+ "\xA3\t\xF8\x84l\xF5<\xBF\xBE\xF9\xE3Q\xD2?q,\x04\x84:\x0E" \
104
+ "\xF5\xF4\x1D1\xF3\xBA\xE7+!\"\xD4\xEB-\xB1X%\xB3\x14\xD3" \
105
+ "\xCB\xEDw\xEE\xBD\xFDk\xE99OSz\xF3\xEA\xFA]w7\xF5\xAF\xB5" \
106
+ "\x9F+\xFEG\x96")
107
+ # rubocop:enable Metrics/LineLength
106
108
 
107
109
  allow(Zlib::GzipReader).to receive(:open)
108
110
  .once
@@ -156,7 +158,7 @@ module Gemirro
156
158
  expect(last_response.status).to eq(404)
157
159
 
158
160
  MirrorFile.new('/var/www/gemirro/gems/gemirro-0.0.1.gem')
159
- .write('content')
161
+ .write('content')
160
162
  get '/gems/gemirro-0.0.1.gem'
161
163
  expect(last_response).to be_ok
162
164
  expect(last_response.status).to eq(200)
@@ -224,38 +226,40 @@ module Gemirro
224
226
 
225
227
  it 'should retrieve json when gem was found' do
226
228
  MirrorDirectory.new('/var/www/gemirro')
227
- .add_directory('quick/Marshal.4.8')
229
+ .add_directory('quick/Marshal.4.8')
230
+ # rubocop:disable Metrics/LineLength
228
231
  MirrorFile.new('/var/www/gemirro/quick/Marshal.4.8/' \
229
232
  'volay-0.1.0.gemspec.rz')
230
- .write("x\x9C\x8D\x94]\x8F\xD2@\x14\x86\x89Y\xBB\xB4|\xEC\x12\xD7h" \
231
- "\xD4h\xD3K\x13J\x01\x97\xC84n\x9A\xA8\xBBi\xE2\xC5\x06\xBB" \
232
- "{\xC3\x85)\xE5\x00\x13f:u:E\xD1\xC4\xDF\xE6\xB5\xBF\xCAiK" \
233
- "\x11\xE3GK\xEF\x98\xF7\xBC\xCFy\xCF\xC9\xCCQ=A\x0F\xAE\x80" \
234
- "\"\xF4>\x82\x00/p\xE0\v\xCC\xC2;\xC1\xDD\xA3\xFA\xF4\xA1k4" \
235
- "\x06\xA6e\xF6_(Hy\xEBa\xD55\xB4\r#\xFEV\xB1k\xDE\r\xEAdu" \
236
- "\xB7\xC0cY1U\xE4\xA1\x95\x8A\xD3C7A\xAA\x87)\xB4\x9C\x1FO" \
237
- "\xBE\xD7\xE4OA\xEA\x17\x16\x82k\xD4o\xBC\xD7\x99\xC2x\xEC" \
238
- "\xAD@\xBFe$\xA1\xA0\xC7\xDBX\x00\xD5\x05/\xBC\xEFg\xDE\x13" \
239
- "\xF8\x98`\x0E\x14B1U\xE4w\xEC\x1A\xC7\x17\xAF2\x85\xADd\xC4" \
240
- "\xBE96\x87\xF9\x1F\xEA\xDF%\x8A\x95\xE3T\x9E\xCC2\xF3i\x9B" \
241
- "\xA1\xB3\xCC\xFE\rD\x10\xCE!\f\xB6\x1A\xD2\x9C\xD0\xA7\xB2" \
242
- "\xBF\x13\x8A?\x13<\xEB\x06\x04\xA7b\xD4q\xF8\xAF&\x0E!\xDF" \
243
- ".~\xEF\xE3\xDC\xCC@\xD2Hl\#@M\x9E\x84BN\x00\x9D:\x11\a\x0E" \
244
- "\x04\xFC\x18.\xD1#g\x93\xCF\xEB\xC3\x81m\\\xC1\x97\xD9" \
245
- "\x9Af7\\\xE3l\xD7_\xBC\x02BX\"\xD23\xBB\xF9o\x83A\xB1\x12" \
246
- "\xBBe\xB7\xED\x93K\xFB\xB4\x82\xB6\x80\xA9K\xB1\x1E\x96" \
247
- "\x10\xEA\x03sP\xCD\xBFP\x16\xEE\x8D\x85\xBF\x86E\\\x96" \
248
- "\xC02G\xF9\b\xEC\x16:\x9D\xC3\x06\b\x8B\xD2\xA9\x95\x84" \
249
- "\xD9\x97\xED\xC3p\x89+\x81\xA9}\xAB`\xD9\x9D\xFF\x03\xF6" \
250
- "\xD2\xC2\xBF\xCD\xFD`\xDD\x15\x10\x97\xED\xA4.[\xAB\xC6(" \
251
- "\x94\x05B\xE3\xB1\xBC\xA5e\xF6\xC3\xAA\x11\n\xE5>A\x8CiD " \
252
- "`\x9B\xF2\x04\xE3\xCA\t\xC6\x87\by-f,`Q\xD9\x1E,sp^q\x0F" \
253
- "\x85\xD4r\x8Dg\x11\x06\xCE\xC1\xE4>\x9D\xF9\xC9\xFC\xE5" \
254
- "\xC8YR\x1F\x133`4\xBB\xF9R~\xEF:\x93\xE8\x93\\\x92\xBF\r" \
255
- "\xA3\t\xF8\x84l\xF5<\xBF\xBE\xF9\xE3Q\xD2?q,\x04\x84:\x0E" \
256
- "\xF5\xF4\x1D1\xF3\xBA\xE7+!\"\xD4\xEB-\xB1X%\xB3\x14\xD3" \
257
- "\xCB\xEDw\xEE\xBD\xFDk\xE99OSz\xF3\xEA\xFA]w7\xF5\xAF\xB5" \
258
- "\x9F+\xFEG\x96")
233
+ .write("x\x9C\x8D\x94]\x8F\xD2@\x14\x86\x89Y\xBB\xB4|\xEC\x12\xD7h" \
234
+ "\xD4h\xD3K\x13J\x01\x97\xC84n\x9A\xA8\xBBi\xE2\xC5\x06\xBB" \
235
+ "{\xC3\x85)\xE5\x00\x13f:u:E\xD1\xC4\xDF\xE6\xB5\xBF\xCAiK" \
236
+ "\x11\xE3GK\xEF\x98\xF7\xBC\xCFy\xCF\xC9\xCCQ=A\x0F\xAE\x80" \
237
+ "\"\xF4>\x82\x00/p\xE0\v\xCC\xC2;\xC1\xDD\xA3\xFA\xF4\xA1k4" \
238
+ "\x06\xA6e\xF6_(Hy\xEBa\xD55\xB4\r#\xFEV\xB1k\xDE\r\xEAdu" \
239
+ "\xB7\xC0cY1U\xE4\xA1\x95\x8A\xD3C7A\xAA\x87)\xB4\x9C\x1FO" \
240
+ "\xBE\xD7\xE4OA\xEA\x17\x16\x82k\xD4o\xBC\xD7\x99\xC2x\xEC" \
241
+ "\xAD@\xBFe$\xA1\xA0\xC7\xDBX\x00\xD5\x05/\xBC\xEFg\xDE\x13" \
242
+ "\xF8\x98`\x0E\x14B1U\xE4w\xEC\x1A\xC7\x17\xAF2\x85\xADd\xC4" \
243
+ "\xBE96\x87\xF9\x1F\xEA\xDF%\x8A\x95\xE3T\x9E\xCC2\xF3i\x9B" \
244
+ "\xA1\xB3\xCC\xFE\rD\x10\xCE!\f\xB6\x1A\xD2\x9C\xD0\xA7\xB2" \
245
+ "\xBF\x13\x8A?\x13<\xEB\x06\x04\xA7b\xD4q\xF8\xAF&\x0E!\xDF" \
246
+ ".~\xEF\xE3\xDC\xCC@\xD2Hl\#@M\x9E\x84BN\x00\x9D:\x11\a\x0E" \
247
+ "\x04\xFC\x18.\xD1#g\x93\xCF\xEB\xC3\x81m\\\xC1\x97\xD9" \
248
+ "\x9Af7\\\xE3l\xD7_\xBC\x02BX\"\xD23\xBB\xF9o\x83A\xB1\x12" \
249
+ "\xBBe\xB7\xED\x93K\xFB\xB4\x82\xB6\x80\xA9K\xB1\x1E\x96" \
250
+ "\x10\xEA\x03sP\xCD\xBFP\x16\xEE\x8D\x85\xBF\x86E\\\x96" \
251
+ "\xC02G\xF9\b\xEC\x16:\x9D\xC3\x06\b\x8B\xD2\xA9\x95\x84" \
252
+ "\xD9\x97\xED\xC3p\x89+\x81\xA9}\xAB`\xD9\x9D\xFF\x03\xF6" \
253
+ "\xD2\xC2\xBF\xCD\xFD`\xDD\x15\x10\x97\xED\xA4.[\xAB\xC6(" \
254
+ "\x94\x05B\xE3\xB1\xBC\xA5e\xF6\xC3\xAA\x11\n\xE5>A\x8CiD " \
255
+ "`\x9B\xF2\x04\xE3\xCA\t\xC6\x87\by-f,`Q\xD9\x1E,sp^q\x0F" \
256
+ "\x85\xD4r\x8Dg\x11\x06\xCE\xC1\xE4>\x9D\xF9\xC9\xFC\xE5" \
257
+ "\xC8YR\x1F\x133`4\xBB\xF9R~\xEF:\x93\xE8\x93\\\x92\xBF\r" \
258
+ "\xA3\t\xF8\x84l\xF5<\xBF\xBE\xF9\xE3Q\xD2?q,\x04\x84:\x0E" \
259
+ "\xF5\xF4\x1D1\xF3\xBA\xE7+!\"\xD4\xEB-\xB1X%\xB3\x14\xD3" \
260
+ "\xCB\xEDw\xEE\xBD\xFDk\xE99OSz\xF3\xEA\xFA]w7\xF5\xAF\xB5" \
261
+ "\x9F+\xFEG\x96")
262
+ # rubocop:enable Metrics/LineLength
259
263
 
260
264
  gem = Gemirro::GemVersion.new('volay', '0.1.0', 'ruby')
261
265
  collection = Gemirro::GemVersionCollection.new([gem])
@@ -39,17 +39,17 @@ module Gemirro
39
39
  it 'should fetch gem' do
40
40
  Struct.new('FetchGem', :body)
41
41
  result = Struct::FetchGem.new(true)
42
- allow(Http).to receive(:get).once.with(
43
- 'https://rubygems.org/gems/gemirro-0.0.1.gem').and_return(result)
44
- expect(@source.fetch_gem('gemirro', '0.0.1')).to be_truthy
42
+ allow(Http).to receive(:get).once
43
+ .with('https://rubygems.org/gems/gemirro-0.0.1.gem').and_return(result)
44
+ expect(@source.fetch_gem('gemirro-0.0.1.gem')).to be_truthy
45
45
  end
46
46
 
47
47
  it 'should fetch gemspec' do
48
48
  Struct.new('FetchGemspec', :body)
49
49
  result = Struct::FetchGemspec.new(true)
50
- allow(Http).to receive(:get).once.with(
51
- 'https://rubygems.org/quick/Marshal.4.8/gemirro-0.0.1.gemspec.rz').and_return(result)
52
- expect(@source.fetch_gemspec('gemirro', '0.0.1')).to be_truthy
50
+ allow(Http).to receive(:get).once
51
+ .with('https://rubygems.org/quick/Marshal.4.8/gemirro-0.0.1.gemspec.rz').and_return(result)
52
+ expect(@source.fetch_gemspec('gemirro-0.0.1.gemspec.rz')).to be_truthy
53
53
  end
54
54
 
55
55
  it 'should add gems' do
@@ -9,14 +9,10 @@ module Gemirro
9
9
  include FakeFS::SpecHelpers
10
10
 
11
11
  it 'should be initialized' do
12
- @versions_file = VersionsFile.new([
13
- ['gemirro', '0.0.1'],
14
- ['gemirro', '0.0.2']
15
- ])
16
- expect(@versions_file.versions).to eq([
17
- ['gemirro', '0.0.1'],
18
- ['gemirro', '0.0.2']
19
- ])
12
+ @versions_file = VersionsFile.new([['gemirro', '0.0.1'],
13
+ ['gemirro', '0.0.2']])
14
+ expect(@versions_file.versions).to eq([['gemirro', '0.0.1'],
15
+ ['gemirro', '0.0.2']])
20
16
  expect(@versions_file.versions_hash).to eq(
21
17
  'gemirro' => [
22
18
  ['gemirro', '0.0.1'],
@@ -28,28 +24,22 @@ module Gemirro
28
24
  it 'should load versions file' do
29
25
  spec = StringIO.new('w')
30
26
  w_gz = Zlib::GzipWriter.new(spec)
31
- w_gz.write(Marshal.dump([
32
- ['gemirro', '0.0.1'],
33
- ['gemirro', '0.0.2']
34
- ]))
27
+ w_gz.write(Marshal.dump([['gemirro', '0.0.1'],
28
+ ['gemirro', '0.0.2']]))
35
29
  w_gz.close
36
30
  prerelease = StringIO.new('w')
37
31
  w_gz = Zlib::GzipWriter.new(prerelease)
38
- w_gz.write(Marshal.dump([
39
- ['gemirro', '0.0.1.alpha1'],
40
- ['gemirro', '0.0.2.alpha2']
41
- ]))
32
+ w_gz.write(Marshal.dump([['gemirro', '0.0.1.alpha1'],
33
+ ['gemirro', '0.0.2.alpha2']]))
42
34
  w_gz.close
43
35
 
44
36
  result = VersionsFile.load(spec.string, prerelease.string)
45
37
  expect(result).to be_a(VersionsFile)
46
38
 
47
- expect(result.versions).to eq([
48
- ['gemirro', '0.0.1'],
49
- ['gemirro', '0.0.2'],
50
- ['gemirro', '0.0.1.alpha1'],
51
- ['gemirro', '0.0.2.alpha2']
52
- ])
39
+ expect(result.versions).to eq([['gemirro', '0.0.1'],
40
+ ['gemirro', '0.0.2'],
41
+ ['gemirro', '0.0.1.alpha1'],
42
+ ['gemirro', '0.0.2.alpha2']])
53
43
  expect(result.versions_hash).to eq(
54
44
  'gemirro' => [
55
45
  ['gemirro', '0.0.1'],
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: 0.13.3
4
+ version: 0.13.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Rambaud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-07 00:00:00.000000000 Z
11
+ date: 2016-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slop
@@ -289,9 +289,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
289
289
  version: '0'
290
290
  requirements: []
291
291
  rubyforge_project:
292
- rubygems_version: 2.5.0
292
+ rubygems_version: 2.6.7
293
293
  signing_key:
294
294
  specification_version: 4
295
295
  summary: Gem for easily creating your own gems mirror.
296
296
  test_files: []
297
- has_rdoc: