eco-helpers 2.0.52 → 2.0.55
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4e49d95179b6066cd2729e64c1db009ed77de653c45a73eaebeab2387ae3bde
|
4
|
+
data.tar.gz: 746f3e6e1f8e17be778ec1c902a71810fa46c6439ea886449f2cf5dc7223d2b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88b70189433c7d4c71ea6b549e0eedbadafe9172bd8ea206d83e09f5bade447707f503e92b28f315e720e75743876f8aac480daf0ef5527d4525d17603e00bb2
|
7
|
+
data.tar.gz: d1d513c1c032101ab2aa9af5b1b41a542e99c0cb8312473c0b188698e855cdae965decda09134f01ec57123f2b518438dfe60c3a82265c2d93fdef51495ed0b3
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,34 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [2.0.
|
4
|
+
## [2.0.55] - 2022-04-xx
|
5
5
|
|
6
6
|
### Added
|
7
|
-
- `Eco::API::UseCases::DefaultCases::CleanUnknownTags` include `default_tag` refresh
|
8
|
-
|
9
7
|
### Changed
|
8
|
+
- `Eco::API::UseCases::DefaultCases::Samples::Sftp` should move the basename to Windows compatible chars.
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
|
12
|
+
## [2.0.54] - 2022-04-04
|
13
|
+
|
14
|
+
### Added
|
15
|
+
- `Eco::API::UseCases::DefaultCases::Samples::Sftp` should tell where the files went in the local.
|
16
|
+
|
17
|
+
|
18
|
+
## [2.0.53] - 2022-04-04
|
19
|
+
|
20
|
+
### Added
|
21
|
+
- `Eco::API::MicroCases#set_supervisor` prevent to set someone as supervisor of themselves.
|
22
|
+
- `Eco::API::UseCases::DefaultCases::Samples::Sftp` integration to modify the `source_folder`
|
23
|
+
|
24
|
+
### Changed
|
25
|
+
- upgrade `ecoportal-api` and `ecoportal-api-v2` dependencies
|
26
|
+
|
27
|
+
## [2.0.52] - 2022-03-04
|
28
|
+
|
29
|
+
### Added
|
30
|
+
- `Eco::API::UseCases::DefaultCases::CleanUnknownTags` include `default_tag` refresh
|
31
|
+
|
10
32
|
### Fixed
|
11
33
|
- `Eco::Data::Files::Directory#dir_files` to be returned in alphabetic order
|
12
34
|
|
data/eco-helpers.gemspec
CHANGED
@@ -30,8 +30,8 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency "yard", ">= 0.9.26", "< 0.10"
|
31
31
|
spec.add_development_dependency "redcarpet", ">= 3.5.1", "< 3.6"
|
32
32
|
|
33
|
-
spec.add_dependency 'ecoportal-api', '>= 0.8.
|
34
|
-
spec.add_dependency 'ecoportal-api-v2', '>= 0.8.
|
33
|
+
spec.add_dependency 'ecoportal-api', '>= 0.8.5', '< 0.9'
|
34
|
+
spec.add_dependency 'ecoportal-api-v2', '>= 0.8.26', '< 0.9'
|
35
35
|
spec.add_dependency 'aws-sdk-s3', '>= 1.83.0', '< 2'
|
36
36
|
spec.add_dependency 'aws-sdk-ses', '>= 1.36.0', '< 2'
|
37
37
|
spec.add_dependency 'dotenv', '>= 2.7.6', '< 2.8'
|
@@ -65,8 +65,11 @@ module Eco
|
|
65
65
|
# @param files [String, Array<String>] full path to remote file(s) to be downloaded
|
66
66
|
# @param local_folder [String] local destination folder (`"."` if not specified)
|
67
67
|
def download(files, local_folder: nil)
|
68
|
+
puts "Creating local files:"
|
68
69
|
[files].flatten.compact.map do |fullname|
|
69
|
-
|
70
|
+
basename = windows_basename(fullname)
|
71
|
+
dest_fullname = File.join(local_folder || ".", basename)
|
72
|
+
puts " • #{dest_fullname}"
|
70
73
|
sftp_session.download(fullname, dest_fullname)
|
71
74
|
end.each do |dw|
|
72
75
|
# run SSH event loop while dw.active?
|
@@ -76,6 +79,12 @@ module Eco
|
|
76
79
|
|
77
80
|
private
|
78
81
|
|
82
|
+
def windows_basename(remote_fullname)
|
83
|
+
parts = remote_fullname.split(/[\\\/]/).map {|node| node.gsub(/[<>:\\\/\|?*]/, '_')}
|
84
|
+
local_fullname = File.join(*parts)
|
85
|
+
File.basename(local_fullname)
|
86
|
+
end
|
87
|
+
|
79
88
|
def logger
|
80
89
|
@enviro&.logger || ::Logger.new(IO::NULL)
|
81
90
|
end
|
@@ -2,6 +2,8 @@ module Eco
|
|
2
2
|
module API
|
3
3
|
class MicroCases
|
4
4
|
# Unique access point to set the `supervisor_id` value on a person.
|
5
|
+
# @note
|
6
|
+
# - It prevents the basic cyclic supervisor case (supervisor to be supervisor of hemselves)
|
5
7
|
# @param person [Ecoportal::API::V1::Person] the person we want to update, carrying the changes to be done.
|
6
8
|
# @param sup_id [nil, String] the **supervisor id** we should set on the `person`.
|
7
9
|
# @param people [Eco::API::Organization::People] _People_ involved in the current update.
|
@@ -10,6 +12,7 @@ module Eco
|
|
10
12
|
# @yieldparam supervisor_id [String] the **unknown** `supervisor_id`.
|
11
13
|
def set_supervisor(person, sup_id, people, options)
|
12
14
|
unless options.dig(:exclude, :core) || options.dig(:exclude, :supervisor)
|
15
|
+
return false if sup_id && ((person.id == sup_id) || (person.external_id == sup_id))
|
13
16
|
cur_id = person.supervisor_id
|
14
17
|
cur_super = cur_id && with_supervisor(cur_id, people)
|
15
18
|
micro.with_supervisor(sup_id, people) do |new_super|
|
@@ -2,10 +2,10 @@ class Eco::API::UseCases::DefaultCases::Samples::Sftp < Eco::API::Common::Loader
|
|
2
2
|
name "sftp-sample"
|
3
3
|
type :other
|
4
4
|
|
5
|
-
attr_reader :session
|
5
|
+
attr_reader :session, :options
|
6
6
|
|
7
7
|
def main(session, options, usecase)
|
8
|
-
@session = session
|
8
|
+
@session = session; @options = options
|
9
9
|
options[:end_get] = false
|
10
10
|
raise "The SFTP is not configured" unless session.sftp?
|
11
11
|
case options.dig(:sftp, :command)
|
@@ -50,7 +50,7 @@ class Eco::API::UseCases::DefaultCases::Samples::Sftp < Eco::API::Common::Loader
|
|
50
50
|
with_remote_files.tap do |files|
|
51
51
|
unless files.empty?
|
52
52
|
file_names = files.map {|file| to_remote_path(file.name)}
|
53
|
-
puts "Getting the following files:"
|
53
|
+
puts "Getting the following files into the local folder '#{local_folder}':"
|
54
54
|
puts file_names
|
55
55
|
sftp.download(file_names, local_folder: local_folder)
|
56
56
|
end
|
@@ -92,7 +92,7 @@ class Eco::API::UseCases::DefaultCases::Samples::Sftp < Eco::API::Common::Loader
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def local_folder
|
95
|
-
"."
|
95
|
+
options.dig(:sftp, :local_folder) || "."
|
96
96
|
end
|
97
97
|
|
98
98
|
def remote_folder
|
data/lib/eco/version.rb
CHANGED
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.0.
|
4
|
+
version: 2.0.55
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
@@ -116,7 +116,7 @@ dependencies:
|
|
116
116
|
requirements:
|
117
117
|
- - ">="
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version: 0.8.
|
119
|
+
version: 0.8.5
|
120
120
|
- - "<"
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0.9'
|
@@ -126,7 +126,7 @@ dependencies:
|
|
126
126
|
requirements:
|
127
127
|
- - ">="
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version: 0.8.
|
129
|
+
version: 0.8.5
|
130
130
|
- - "<"
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0.9'
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
requirements:
|
137
137
|
- - ">="
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version: 0.8.
|
139
|
+
version: 0.8.26
|
140
140
|
- - "<"
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0.9'
|
@@ -146,7 +146,7 @@ dependencies:
|
|
146
146
|
requirements:
|
147
147
|
- - ">="
|
148
148
|
- !ruby/object:Gem::Version
|
149
|
-
version: 0.8.
|
149
|
+
version: 0.8.26
|
150
150
|
- - "<"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0.9'
|