file-manager 0.6.0 → 0.7.1

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: a5889d97b6382e2e9d85f3af01a73586cee45fa3dde1eebbb2b95ca5ed1608ed
4
- data.tar.gz: 18683494a9bdce32792531b1c628c89a677663191b1ceeb095128f78cbdcc1fa
3
+ metadata.gz: 71fbfea4aafaafea13fa3621484f5c4056e58292f7bca814bd66fa5d9eefa139
4
+ data.tar.gz: b8fff60170f81479af9ecd47536e75f0f4fa006aeac69b4a8d70e81bf92896c4
5
5
  SHA512:
6
- metadata.gz: 31920a61731e9c2cca6328f1c622c4fec4a955df500e02352adfb655a93033e5ae04bf9a0eae549caeb481648435875b0fe1261c747bd6bde6bf9aa80624fd71
7
- data.tar.gz: 57117c765ae71ddb57261de259c78e49099bafda2b0c2fcd61a2ae551ac2d3a05bd94935818a873f79b7a0ad8cc2ce2bd477d699ce6eb8d6cd36ada52ecdb4ea
6
+ metadata.gz: e38752a0c002fe35f9f54b967312bfe1768c022bca776dd8962c5983faaded39c75e45d387cfa3c6c7ba41e602bf5ea8b2d138caec3d764be41901bfb8ea8ed2
7
+ data.tar.gz: e733d014c052c49d3e166fa7f30351cc5394e8c17e0723ed3a11b3b0b3e837093219280361ca6b5efd894479403e8a343e46ccb48fa87ef959e9f37d5c33f831
data/Gemfile.lock CHANGED
@@ -1,40 +1,42 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- file-manager (0.6.0)
4
+ file-manager (0.7.1)
5
5
  aws-sdk-s3 (~> 1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- addressable (2.7.0)
11
- public_suffix (>= 2.0.2, < 5.0)
12
- aws-eventstream (1.1.0)
13
- aws-partitions (1.391.0)
14
- aws-sdk-core (3.109.2)
10
+ addressable (2.8.1)
11
+ public_suffix (>= 2.0.2, < 6.0)
12
+ aws-eventstream (1.2.0)
13
+ aws-partitions (1.679.0)
14
+ aws-sdk-core (3.168.4)
15
15
  aws-eventstream (~> 1, >= 1.0.2)
16
- aws-partitions (~> 1, >= 1.239.0)
16
+ aws-partitions (~> 1, >= 1.651.0)
17
+ aws-sigv4 (~> 1.5)
18
+ jmespath (~> 1, >= 1.6.1)
19
+ aws-sdk-kms (1.61.0)
20
+ aws-sdk-core (~> 3, >= 3.165.0)
17
21
  aws-sigv4 (~> 1.1)
18
- jmespath (~> 1.0)
19
- aws-sdk-kms (1.39.0)
20
- aws-sdk-core (~> 3, >= 3.109.0)
21
- aws-sigv4 (~> 1.1)
22
- aws-sdk-s3 (1.84.1)
23
- aws-sdk-core (~> 3, >= 3.109.0)
22
+ aws-sdk-s3 (1.117.2)
23
+ aws-sdk-core (~> 3, >= 3.165.0)
24
24
  aws-sdk-kms (~> 1)
25
- aws-sigv4 (~> 1.1)
26
- aws-sigv4 (1.2.2)
25
+ aws-sigv4 (~> 1.4)
26
+ aws-sigv4 (1.5.2)
27
27
  aws-eventstream (~> 1, >= 1.0.2)
28
- crack (0.4.4)
28
+ crack (0.4.5)
29
+ rexml
29
30
  hashdiff (1.0.1)
30
- jmespath (1.4.0)
31
- minitest (5.14.2)
32
- public_suffix (4.0.6)
33
- rake (13.0.1)
34
- single_cov (1.6.0)
35
- vcr (6.0.0)
36
- webmock (3.9.5)
37
- addressable (>= 2.3.6)
31
+ jmespath (1.6.2)
32
+ minitest (5.16.3)
33
+ public_suffix (5.0.1)
34
+ rake (13.0.6)
35
+ rexml (3.2.5)
36
+ single_cov (1.7.0)
37
+ vcr (6.1.0)
38
+ webmock (3.18.1)
39
+ addressable (>= 2.8.0)
38
40
  crack (>= 0.3.2)
39
41
  hashdiff (>= 0.4.0, < 2.0.0)
40
42
 
data/file-manager.gemspec CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = "file-manager"
6
- spec.version = '0.6.0'
6
+ spec.version = '0.7.1'
7
7
  spec.authors = ["Francisco Barroso / Marlus Saraiva"]
8
8
  spec.email = ["franciscobarroso@grupofortes.com.br"]
9
9
  spec.description = 'File manager, access S3 or local'
@@ -32,6 +32,8 @@ class LocalFileManager < FileManager
32
32
  yield(temp_file)
33
33
  end
34
34
  @logger.puts 'done.'
35
+ rescue Errno::ENOENT
36
+ raise FileNotFoundError.new(full_file_name)
35
37
  end
36
38
 
37
39
  def list_files(prefix = '', file_extension = '*')
@@ -41,6 +41,8 @@ class S3FileManager < FileManager
41
41
  yield(temp_file)
42
42
  end
43
43
  logger.puts 'done.'
44
+ rescue Aws::S3::Errors::NoSuchKey
45
+ raise FileNotFoundError.new("#{bucket_name}/#{file_name}")
44
46
  end
45
47
 
46
48
  def list_files(prefix = '', file_extension = '*')
@@ -66,6 +66,7 @@ module FileManagerTest
66
66
  end
67
67
 
68
68
  @manager.delete_file 'temp_file/saved'
69
+ assert_raises(FileNotFoundError) { @manager.download_to_temp_file('temp_file/saved') {} }
69
70
  end
70
71
 
71
72
  def test_rename_file
@@ -10,5 +10,4 @@ class LocalFileManagerTest < Minitest::Test
10
10
  def setup
11
11
  @manager = LocalFileManager.new({root_path: Dir.mktmpdir + '/root_path/', silent: true})
12
12
  end
13
-
14
13
  end
@@ -10,5 +10,4 @@ class MemoryFileManagerTest < Minitest::Test
10
10
  def setup
11
11
  @manager = MemoryFileManager.new({})
12
12
  end
13
-
14
13
  end
@@ -23,5 +23,4 @@ class S3FileManagerTest < Minitest::Test
23
23
  silent: true
24
24
  )
25
25
  end
26
-
27
26
  end
@@ -20,13 +20,13 @@ http_interactions:
20
20
  Host:
21
21
  - file-manager-tests.s3.us-west-2.amazonaws.com
22
22
  X-Amz-Date:
23
- - 20201111T144040Z
23
+ - 20201124T145029Z
24
24
  X-Amz-Content-Sha256:
25
25
  - ed7002b439e9ac845f22357d822bac1444730fbdb6016d3ec9432297b9ec9f73
26
26
  Authorization:
27
- - AWS4-HMAC-SHA256 Credential=AKIAJ73G6IOWSUPCKP5A/20201111/us-west-2/s3/aws4_request,
27
+ - AWS4-HMAC-SHA256 Credential=AKIAJ73G6IOWSUPCKP5A/20201124/us-west-2/s3/aws4_request,
28
28
  SignedHeaders=content-md5;host;user-agent;x-amz-content-sha256;x-amz-date,
29
- Signature=6bacc791a90a0b2053983d6074292bacae3feb963f5f248972dfeb8ce49af257
29
+ Signature=1553631fdede92e7c00cdfc3c2695fddd968619d76c58a3aedb4ec3d2af6216d
30
30
  Content-Length:
31
31
  - '7'
32
32
  Accept:
@@ -37,11 +37,11 @@ http_interactions:
37
37
  message: OK
38
38
  headers:
39
39
  X-Amz-Id-2:
40
- - v7pIH4x9r0GjI9FlS7UH+lLgWxMtGr6So7K1oM9VmZhtudDxVA4LjtHZgKXV4kafyBADrtiHxBE=
40
+ - M+sMGbF/0sv9rsxptZZE54Y3+E7Zr0lLMs2jmlBLlykPHYQFuxqRCL5/SXOKPyC+6eFW8WdJhpo=
41
41
  X-Amz-Request-Id:
42
- - '088B960103233B1F'
42
+ - E2ED2A94148D8A42
43
43
  Date:
44
- - Wed, 11 Nov 2020 14:40:42 GMT
44
+ - Tue, 24 Nov 2020 14:50:30 GMT
45
45
  Etag:
46
46
  - '"9a0364b9e99bb480dd25e1f0284c8555"'
47
47
  Content-Length:
@@ -51,7 +51,7 @@ http_interactions:
51
51
  body:
52
52
  encoding: UTF-8
53
53
  string: ''
54
- recorded_at: Wed, 11 Nov 2020 14:40:41 GMT
54
+ recorded_at: Tue, 24 Nov 2020 14:50:30 GMT
55
55
  - request:
56
56
  method: get
57
57
  uri: https://file-manager-tests.s3.us-west-2.amazonaws.com/temp_file/saved
@@ -68,12 +68,12 @@ http_interactions:
68
68
  Host:
69
69
  - file-manager-tests.s3.us-west-2.amazonaws.com
70
70
  X-Amz-Date:
71
- - 20201111T144041Z
71
+ - 20201124T145030Z
72
72
  X-Amz-Content-Sha256:
73
73
  - e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
74
74
  Authorization:
75
- - AWS4-HMAC-SHA256 Credential=AKIAJ73G6IOWSUPCKP5A/20201111/us-west-2/s3/aws4_request,
76
- SignedHeaders=host;user-agent;x-amz-content-sha256;x-amz-date, Signature=173b4dcf56de977f8f97febd9b76233a3ed1b14b7fe82095b9fc3219e6891e42
75
+ - AWS4-HMAC-SHA256 Credential=AKIAJ73G6IOWSUPCKP5A/20201124/us-west-2/s3/aws4_request,
76
+ SignedHeaders=host;user-agent;x-amz-content-sha256;x-amz-date, Signature=3553a99ec17f350f66cd836de1c4232204bb6880ee0225d11eef0d96cc077a0e
77
77
  Content-Length:
78
78
  - '0'
79
79
  Accept:
@@ -84,13 +84,13 @@ http_interactions:
84
84
  message: OK
85
85
  headers:
86
86
  X-Amz-Id-2:
87
- - oxm7JHj66N9Et/3UhmG/ZDSCTTA6LxHCIeEyE9NVF5+pbk1wdUK2vqtpT3x8+GvGQn9tBIL0u+8=
87
+ - 66mnB4P9tZ5nspyQ91ANVbtwvcgI156GsyxjMURwCFU35qeTq4co1NdqLZCg39tcH3r54+ljkwU=
88
88
  X-Amz-Request-Id:
89
- - 6978EECB4E579781
89
+ - CFEFB83676E3AD41
90
90
  Date:
91
- - Wed, 11 Nov 2020 14:40:42 GMT
91
+ - Tue, 24 Nov 2020 14:50:31 GMT
92
92
  Last-Modified:
93
- - Wed, 11 Nov 2020 14:40:42 GMT
93
+ - Tue, 24 Nov 2020 14:50:30 GMT
94
94
  Etag:
95
95
  - '"9a0364b9e99bb480dd25e1f0284c8555"'
96
96
  Accept-Ranges:
@@ -104,7 +104,7 @@ http_interactions:
104
104
  body:
105
105
  encoding: UTF-8
106
106
  string: content
107
- recorded_at: Wed, 11 Nov 2020 14:40:42 GMT
107
+ recorded_at: Tue, 24 Nov 2020 14:50:30 GMT
108
108
  - request:
109
109
  method: get
110
110
  uri: https://file-manager-tests.s3.us-west-2.amazonaws.com/temp_file/saved
@@ -121,12 +121,12 @@ http_interactions:
121
121
  Host:
122
122
  - file-manager-tests.s3.us-west-2.amazonaws.com
123
123
  X-Amz-Date:
124
- - 20201111T144042Z
124
+ - 20201124T145030Z
125
125
  X-Amz-Content-Sha256:
126
126
  - e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
127
127
  Authorization:
128
- - AWS4-HMAC-SHA256 Credential=AKIAJ73G6IOWSUPCKP5A/20201111/us-west-2/s3/aws4_request,
129
- SignedHeaders=host;user-agent;x-amz-content-sha256;x-amz-date, Signature=5a3fe2bc32b36b964cdfbd439ddfc6e66b582525fe726f8f04f55da49830071c
128
+ - AWS4-HMAC-SHA256 Credential=AKIAJ73G6IOWSUPCKP5A/20201124/us-west-2/s3/aws4_request,
129
+ SignedHeaders=host;user-agent;x-amz-content-sha256;x-amz-date, Signature=3553a99ec17f350f66cd836de1c4232204bb6880ee0225d11eef0d96cc077a0e
130
130
  Content-Length:
131
131
  - '0'
132
132
  Accept:
@@ -137,13 +137,13 @@ http_interactions:
137
137
  message: OK
138
138
  headers:
139
139
  X-Amz-Id-2:
140
- - U0XDHBcTlMiOjJwClNfEJYHQpD7oIb1wcRu03gOB7xUugVY1DtWGBlULOQfEa2m93N040h+0tMA=
140
+ - s31pm0mfwgROmbOaNEzb6u1AWjGhnLB7PBfgNfZp0AZ/gA6I4wb6TZ/ZOArBdfqkEhLGlpuXQ8U=
141
141
  X-Amz-Request-Id:
142
- - 58144A9FA1068710
142
+ - AB6B9F1835ABBBB4
143
143
  Date:
144
- - Wed, 11 Nov 2020 14:40:43 GMT
144
+ - Tue, 24 Nov 2020 14:50:32 GMT
145
145
  Last-Modified:
146
- - Wed, 11 Nov 2020 14:40:42 GMT
146
+ - Tue, 24 Nov 2020 14:50:30 GMT
147
147
  Etag:
148
148
  - '"9a0364b9e99bb480dd25e1f0284c8555"'
149
149
  Accept-Ranges:
@@ -157,7 +157,7 @@ http_interactions:
157
157
  body:
158
158
  encoding: UTF-8
159
159
  string: content
160
- recorded_at: Wed, 11 Nov 2020 14:40:42 GMT
160
+ recorded_at: Tue, 24 Nov 2020 14:50:31 GMT
161
161
  - request:
162
162
  method: delete
163
163
  uri: https://file-manager-tests.s3.us-west-2.amazonaws.com/temp_file/saved
@@ -174,12 +174,12 @@ http_interactions:
174
174
  Host:
175
175
  - file-manager-tests.s3.us-west-2.amazonaws.com
176
176
  X-Amz-Date:
177
- - 20201111T144042Z
177
+ - 20201124T145031Z
178
178
  X-Amz-Content-Sha256:
179
179
  - e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
180
180
  Authorization:
181
- - AWS4-HMAC-SHA256 Credential=AKIAJ73G6IOWSUPCKP5A/20201111/us-west-2/s3/aws4_request,
182
- SignedHeaders=host;user-agent;x-amz-content-sha256;x-amz-date, Signature=30f9e796026f3aacfd9f266a32e79c6c8a886af4f1abcc1b9fb8eef0885e8042
181
+ - AWS4-HMAC-SHA256 Credential=AKIAJ73G6IOWSUPCKP5A/20201124/us-west-2/s3/aws4_request,
182
+ SignedHeaders=host;user-agent;x-amz-content-sha256;x-amz-date, Signature=ea30154941154ad4249905230d8fac332aec2dcbb81302d1bc607616c0a0caf3
183
183
  Content-Length:
184
184
  - '0'
185
185
  Accept:
@@ -190,15 +190,64 @@ http_interactions:
190
190
  message: No Content
191
191
  headers:
192
192
  X-Amz-Id-2:
193
- - udv2xypDIi4J4u8Z4G1z3H3lDcOre4IY/osPzB68iLB53a86Dg3/0fu32JaJ62V9SLO02FLz7yo=
193
+ - JFGwdnwwfZkQ3RZMgmgrspZEyv/F7lNEMgynTh5CezJGG8in7MMAXOPLWipSp4cA41S4L2zOiu4=
194
194
  X-Amz-Request-Id:
195
- - 9QEW5WDRAZDVBXDG
195
+ - F24A51B9E5B403A8
196
196
  Date:
197
- - Wed, 11 Nov 2020 14:40:44 GMT
197
+ - Tue, 24 Nov 2020 14:50:33 GMT
198
198
  Server:
199
199
  - AmazonS3
200
200
  body:
201
201
  encoding: UTF-8
202
202
  string: ''
203
- recorded_at: Wed, 11 Nov 2020 14:40:43 GMT
203
+ recorded_at: Tue, 24 Nov 2020 14:50:32 GMT
204
+ - request:
205
+ method: get
206
+ uri: https://file-manager-tests.s3.us-west-2.amazonaws.com/temp_file/saved
207
+ body:
208
+ encoding: UTF-8
209
+ string: ''
210
+ headers:
211
+ Content-Type:
212
+ - ''
213
+ Accept-Encoding:
214
+ - ''
215
+ User-Agent:
216
+ - aws-sdk-ruby3/3.109.2 ruby/2.5.3 x86_64-linux aws-sdk-s3/1.84.1
217
+ Host:
218
+ - file-manager-tests.s3.us-west-2.amazonaws.com
219
+ X-Amz-Date:
220
+ - 20201124T145032Z
221
+ X-Amz-Content-Sha256:
222
+ - e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
223
+ Authorization:
224
+ - AWS4-HMAC-SHA256 Credential=AKIAJ73G6IOWSUPCKP5A/20201124/us-west-2/s3/aws4_request,
225
+ SignedHeaders=host;user-agent;x-amz-content-sha256;x-amz-date, Signature=e0d987aab7932cf51f4fba7447e5cf057a5a78e4737c477e6e0ce1bed651d99a
226
+ Content-Length:
227
+ - '0'
228
+ Accept:
229
+ - "*/*"
230
+ response:
231
+ status:
232
+ code: 404
233
+ message: Not Found
234
+ headers:
235
+ X-Amz-Request-Id:
236
+ - '09FAB9D7EA1E6425'
237
+ X-Amz-Id-2:
238
+ - lUWz95OFeBVsoYoLv0UDvqIvcW+mmS8b6NdfpdVukU+VCDC+A5xS1XGkPq+YxO3Es/nfuus/kow=
239
+ Content-Type:
240
+ - application/xml
241
+ Transfer-Encoding:
242
+ - chunked
243
+ Date:
244
+ - Tue, 24 Nov 2020 14:50:32 GMT
245
+ Server:
246
+ - AmazonS3
247
+ body:
248
+ encoding: UTF-8
249
+ string: |-
250
+ <?xml version="1.0" encoding="UTF-8"?>
251
+ <Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>temp_file/saved</Key><RequestId>09FAB9D7EA1E6425</RequestId><HostId>lUWz95OFeBVsoYoLv0UDvqIvcW+mmS8b6NdfpdVukU+VCDC+A5xS1XGkPq+YxO3Es/nfuus/kow=</HostId></Error>
252
+ recorded_at: Tue, 24 Nov 2020 14:50:32 GMT
204
253
  recorded_with: VCR 6.0.0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: file-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francisco Barroso / Marlus Saraiva
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-18 00:00:00.000000000 Z
11
+ date: 2022-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3
@@ -132,7 +132,7 @@ files:
132
132
  homepage: https://github.com/fortesinformatica/file-manager
133
133
  licenses: []
134
134
  metadata: {}
135
- post_install_message:
135
+ post_install_message:
136
136
  rdoc_options: []
137
137
  require_paths:
138
138
  - lib
@@ -147,8 +147,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  - !ruby/object:Gem::Version
148
148
  version: '0'
149
149
  requirements: []
150
- rubygems_version: 3.0.2
151
- signing_key:
150
+ rubygems_version: 3.3.8
151
+ signing_key:
152
152
  specification_version: 4
153
153
  summary: File manager, access S3 or local
154
154
  test_files: