google-cloud-storage-extension 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b90c8012706923bd4b85456c031237fcb725ef9114267cfeba95a7fbafce8df8
4
- data.tar.gz: 976730495eaa8761772d581e2404f5775aaafd3e2cb8e6881c527f8a806d2717
3
+ metadata.gz: e534c19e20b5a6db4e2f9f79bc9829a51f376f7fb76bae29e73f72c7f42a508b
4
+ data.tar.gz: 9cd2c57a62f82b2e4c36026a2d5ca168c1127c2d705eff2ff398f53a28194768
5
5
  SHA512:
6
- metadata.gz: 594d44d877a2d7c5c4baea7f0365b9e12b26b9b4d2b8a0bea51d7ba651492080f9638aea2699a50c35ce6eec80119c71a856ada1117f0308a67c642b68a5b2ac
7
- data.tar.gz: 0270deec2820d2e9f684983f5d71f865c8a955e261ddecc4f67618d0b060751d1f1cdde328c50a80006881697e7196b94db3bb0cdc10e81d1c90813c646215f7
6
+ metadata.gz: ce860ebe0c70cde977e5b3887f167e601996611cf8a277de547b7892a7d26d735a990ded5c6508d910f5533563060d6953ca92b4d129e8b031c64f0bcdf47a16
7
+ data.tar.gz: b0d54930de9a427a41ed93cced2d26f34d4ce4ab3c021e93cfb82ea066d63fcfb88d637eaec1b9a6c377ac21dc1caf1dfca9006504e202a5477aa0bbf48bf72b
@@ -4,7 +4,7 @@ module Google
4
4
  module Cloud
5
5
  module Storage
6
6
  module Extension
7
- VERSION = '0.1.0'
7
+ VERSION = '0.1.1'
8
8
  end
9
9
  end
10
10
  end
@@ -13,14 +13,33 @@ module Google
13
13
  # @yield [path]
14
14
  # @yieldparam path [String] path of tempfile
15
15
  def f(filename, mode: 0)
16
- file = self.file(filename)
16
+ tries = 0
17
+ begin
18
+ file = self.file(filename)
19
+ rescue StandardError
20
+ tries += 1
21
+ retry if tries <= 5
22
+
23
+ raise
24
+ end
17
25
  raise 'file not found' unless file
18
26
 
19
27
  name = file.name
20
28
  basename = ::File.basename(name, '.*')
21
29
  extname = ::File.extname(name)
22
30
  tempfile = ::Tempfile.create([basename, extname], mode:)
23
- file.download(tempfile.path)
31
+
32
+ tries = 0
33
+ begin
34
+ file.download(tempfile.path)
35
+ rescue StandardError
36
+ tries += 1
37
+ retry if tries <= 5
38
+
39
+ ::File.delete(tempfile.path)
40
+ raise
41
+ end
42
+
24
43
  ret = yield(tempfile.path)
25
44
  ::File.delete(tempfile.path)
26
45
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-storage-extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ishotihadus
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-11 00:00:00.000000000 Z
11
+ date: 2022-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-storage