geminabox 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 geminabox might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 759a92d17a3e229f2c7e974618f3eb970a7d8f4c
4
- data.tar.gz: c9263bebaca15a36bf4c2f21ea85a29d1a453abc
3
+ metadata.gz: 06c1719b0b3d8508755171751405a9e44a65b3d8
4
+ data.tar.gz: 2a843634e631cd122dfead4d0ff7f9b28c114934
5
5
  SHA512:
6
- metadata.gz: cf565347feda26ff82b1f1c81f6988ca9d50f2d9b12e6ad6b2c5b578e024bfd3839b127cfb31cea50b8129f53271da703cc2a49b15696b2c93edb026e7dce44a
7
- data.tar.gz: 5669bd9b4976883e3c8f23ef7232f573a946ebbc90e9e76d646bca53363a126fde6e8a01c410d26118a267453f8c8c65acf512b802802a8803923162e101f568
6
+ metadata.gz: 26576e1a5defefbbe0eef931d707a459fdfd4a172dc243828bd1dcc3bc6e9bf80ab491fd1a415c7720c5030c0c7ba010f6d3fa2864efd94ffab2fbd64d0c7169
7
+ data.tar.gz: efd5805d53e8265f3e0929d257e160d3aa5a2c731d7d80f8e14e9b1814e5023b8c5107a8af938eff52e6c8e398c493cfb13a41e141e8b93dca6814a741f8be8d
@@ -22,7 +22,9 @@ module Geminabox
22
22
 
23
23
  def get_remote
24
24
  begin
25
- File.open(proxy_path, 'w'){|f| f.write(remote_content)}
25
+ if rc = remote_content
26
+ File.open(proxy_path, 'w'){|f| f.write(rc) }
27
+ end
26
28
  rescue
27
29
  File.unlink(proxy_path) if File.exists?(proxy_path)
28
30
  raise $!
@@ -45,11 +45,12 @@ module Geminabox
45
45
  def remote_content
46
46
  Geminabox.http_adapter.get_content(remote_url).force_encoding(encoding)
47
47
  rescue
48
+ return nil if Geminabox.allow_remote_failure
48
49
  raise GemStoreError.new(500, "Unable to get content from #{remote_url}")
49
50
  end
50
51
 
51
52
  def remote_url
52
- "http://rubygems.org/#{file_name}"
53
+ URI.join(Geminabox.ruby_gems_url, file_name)
53
54
  end
54
55
 
55
56
  def local_content
@@ -1,4 +1,5 @@
1
1
  require 'tempfile'
2
+ require 'fileutils'
2
3
 
3
4
  module Geminabox
4
5
  module Proxy
@@ -11,16 +12,15 @@ module Geminabox
11
12
  end
12
13
 
13
14
  def create
14
- data = new_content
15
- return nil if data.nil?
16
- begin
17
- tmp = Tempfile.new('geminabox')
18
- File.open(tmp, 'w'){|f| f.write(data)}
19
- rescue
20
- return nil
15
+ if data = new_content
16
+ f = Tempfile.create('geminabox')
17
+ begin
18
+ f.write(data)
19
+ ensure
20
+ f.close rescue nil
21
+ end
22
+ FileUtils.mv f.path, splice_path
21
23
  end
22
-
23
- FileUtils.mv tmp, splice_path
24
24
  end
25
25
 
26
26
  def new_content
@@ -57,7 +57,11 @@ module Geminabox
57
57
 
58
58
  private
59
59
  def merge_gziped_content
60
- package(unpackage(local_content) | unpackage(remote_content))
60
+ if rc = remote_content
61
+ package(unpackage(local_content) | unpackage(rc))
62
+ else
63
+ local_content
64
+ end
61
65
  end
62
66
 
63
67
  def unpackage(content)
@@ -1,3 +1,3 @@
1
1
  module Geminabox
2
- VERSION = '0.13.3' unless defined? VERSION
2
+ VERSION = '0.13.4' unless defined? VERSION
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geminabox
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
  - Tom Lea
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-10-13 00:00:00.000000000 Z
14
+ date: 2016-10-25 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: sinatra