eco-helpers 2.7.10 → 2.7.11

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: 1e9c00a0ecc4c1fb42d808e2df03a8618c7017be7a27e6319859bd7974b3638a
4
- data.tar.gz: f9e2452935fcfc3712e53b5e5731151f1ddf6a4f946f2e1c6f8c629f48e09e9e
3
+ metadata.gz: e3c92964baf09be5673e74f4a1762d03ce0efe159e7d6a2bc6da3839ac99f4f0
4
+ data.tar.gz: 26525ccfbdbb06f348d293a50a02de644f7a0a32f3f5285537c75d8d14fe3601
5
5
  SHA512:
6
- metadata.gz: 4e4595657f37f057269bbd38671858700bdcc22e2755e3b365bbe69e48e017e11974a8583b5e93c09c1abf90cd4f09c0ed8ac4a853be8d471c51719fa1500e71
7
- data.tar.gz: 0e3af7794e45e62fdbb2ba06340cc7b23ea88466670eb8b597c4e279556bb5cc59dfa5f8ff0f294f77d15dfd159819590cd2228d05fa19af8a2421d4b665fa72
6
+ metadata.gz: 7620a74731fbfc7d17d1b21f7930df4753003a919fa9d79550083002f454c57716cceab6afec8738d9a37e5b2cd749cd42541f0913286d66c1387b7b88b27c5e
7
+ data.tar.gz: 1db57df2c9a4b8e5863580524d34e655c92d5e4ddd15e6a8cacbe8b9e9e8af73ae2d3fb05fd1f4dc6de119c2ee5e20b3971b234c073910153aec5137807ef37b
data/CHANGELOG.md CHANGED
@@ -1,21 +1,23 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [2.7.12] - 2024-05-xx
5
4
 
6
- ### Added
7
- ### Changed
8
- ### Fixed
5
+ ## [2.7.11] - 2024-05-xx
9
6
 
10
- ## [2.7.11] - 2024-05-20
7
+ ### Added
8
+ ### Changed\
9
+ - `Eco::API::Common::Session::SFTP#download`
10
+ - It now returns the local filename(s) of the downloaded files.
11
+ - `Eco::API::UseCases::GraphQL::Utils#sftp_download_files`
12
+ - It now returns the local filename(s) of the downloaded files.
11
13
 
12
- ### Changed
13
- - Upgrade SFTP access
14
+ ### Fixed
14
15
 
15
- ## [2.7.10] - 2024-05-16
16
+ ## [2.7.10] - 2024-05-20
16
17
 
17
18
  ### Changed
18
19
  - Temporarily silent warnings on tracking id changes (apparently the tracking locations tree is not up to date with latest version and gives false warnings)
20
+ - Upgrade SFTP access
19
21
 
20
22
  ### Fixed
21
23
  - Remove enviro from tagtree download
@@ -74,15 +74,19 @@ module Eco
74
74
  # @see Net::SFTP::Operations::Download
75
75
  # @param files [String, Array<String>] full path to remote file(s) to be downloaded
76
76
  # @param local_folder [String] local destination folder (`"."` if not specified)
77
- def download(files, local_folder: nil)
77
+ # @return [Array<String>] list of created files
78
+ def download(files, local_folder: nil, &block)
78
79
  puts "Creating local files:"
80
+ created_files = []
79
81
  [files].flatten.compact.map do |fullname|
80
82
  basename = windows_basename(fullname)
81
83
  dest_fullname = File.join(local_folder || ".", basename)
82
84
  puts " • #{dest_fullname}"
85
+ created_files << dest_fullname
83
86
  sftp_session.download(fullname, dest_fullname)
84
87
  end.each(&:wait)
85
88
  # run SSH event loop while dw.active?
89
+ created_files.tap { created_files.each(&block) }
86
90
  end
87
91
 
88
92
  # Upload a file to the specific `remote_folder`
@@ -19,20 +19,20 @@ module Eco::API::UseCases::GraphQL::Utils
19
19
  end
20
20
  end
21
21
 
22
- def sftp_download_files(subfolder: remote_subfolder, pattern: nil, local_folder: self.local_folder)
23
- with_remote_files(subfolder: subfolder, pattern: pattern).tap do |files|
24
- next if files.empty?
25
- file_names = files.map {|file| to_remote_path(file.name, subfolder: subfolder)}
26
-
27
- log(:info) {
28
- msg = "Getting the following files into the local folder '#{local_folder}':\n"
29
- msg << " "
30
- msg << file_names.join("\n • ")
31
- msg
32
- }
33
-
34
- sftp.download(file_names, local_folder: local_folder)
35
- end
22
+ def sftp_download_files(subfolder: remote_subfolder, pattern: nil, local_folder: self.local_folder, &block)
23
+ remote_files = with_remote_files(subfolder: subfolder, pattern: pattern)
24
+ return [] if remote_files.empty?
25
+
26
+ file_names = remote_files.map {|file| to_remote_path(file.name, subfolder: subfolder)}
27
+
28
+ log(:info) {
29
+ msg = "Getting the following files into the local folder '#{local_folder}':\n"
30
+ msg << " • "
31
+ msg << file_names.join("\n • ")
32
+ msg
33
+ }
34
+
35
+ sftp.download(file_names, local_folder: local_folder, &block)
36
36
  end
37
37
 
38
38
  def sftp_move_file(source, dest)
data/lib/eco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = '2.7.10'.freeze
2
+ VERSION = '2.7.11'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eco-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.10
4
+ version: 2.7.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura