etna 0.1.38 → 0.1.39
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/etna/clients/metis/client.rb +36 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c21212f38bbad3cf757eb84a9e453428c9d0b6f195fd34eb81f98aeff2746490
|
4
|
+
data.tar.gz: 3581821244c087cbbfbac162f9a5c61911e06ab64923c603a144d36ca3bedff0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3289530a2e874d2b79b0da66ea787e30b335b7a60626e4b67f1be9919067d4b79752db4e878ca8851dbce6c68a1e59a573bcbc60314bb7a35268cd37cc2eeaae
|
7
|
+
data.tar.gz: 2758348f253992e08fbf589d2b5444844becf69e179872c630804a7e8885568189168edd056c56beabe4ed5dc3e0905f46c51595896bd7bdd1255fbe4ece71ec
|
@@ -228,14 +228,44 @@ module Etna
|
|
228
228
|
end
|
229
229
|
|
230
230
|
folder_contents.files.all.each do |file|
|
231
|
-
|
232
|
-
|
231
|
+
# If file exists in destination, delete the older file.
|
232
|
+
list_dest_folder_request = Etna::Clients::Metis::ListFolderRequest.new(
|
233
|
+
bucket_name: dest_bucket,
|
233
234
|
project_name: project_name,
|
234
|
-
|
235
|
-
new_bucket_name: dest_bucket,
|
236
|
-
new_file_path: file.file_path,
|
237
|
-
create_parent: true)
|
235
|
+
folder_path: ::File.dirname(file.file_path)
|
238
236
|
)
|
237
|
+
|
238
|
+
dest_file = list_folder(list_dest_folder_request).files.all.find { |f| f.file_name == file.file_name }
|
239
|
+
|
240
|
+
should_rename = true
|
241
|
+
if (dest_file && file.updated_at <= dest_file.updated_at)
|
242
|
+
# Delete source file if it's out of date
|
243
|
+
delete_file(Etna::Clients::Metis::DeleteFileRequest.new(
|
244
|
+
bucket_name: source_bucket,
|
245
|
+
project_name: project_name,
|
246
|
+
file_path: file.file_path,
|
247
|
+
))
|
248
|
+
|
249
|
+
should_rename = false
|
250
|
+
elsif (dest_file && file.updated_at > dest_file.updated_at)
|
251
|
+
# Delete dest file if it's out of date
|
252
|
+
delete_file(Etna::Clients::Metis::DeleteFileRequest.new(
|
253
|
+
bucket_name: dest_bucket,
|
254
|
+
project_name: project_name,
|
255
|
+
file_path: dest_file.file_path,
|
256
|
+
))
|
257
|
+
end
|
258
|
+
|
259
|
+
if should_rename
|
260
|
+
rename_file(Etna::Clients::Metis::RenameFileRequest.new(
|
261
|
+
bucket_name: source_bucket,
|
262
|
+
project_name: project_name,
|
263
|
+
file_path: file.file_path,
|
264
|
+
new_bucket_name: dest_bucket,
|
265
|
+
new_file_path: file.file_path,
|
266
|
+
create_parent: true)
|
267
|
+
)
|
268
|
+
end
|
239
269
|
end
|
240
270
|
|
241
271
|
# Now delete the source folder
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: etna
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.39
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saurabh Asthana
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|