eco-helpers 2.0.38 → 2.0.39
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -2
- data/eco-helpers.gemspec +1 -1
- data/lib/eco/api/usecases/ooze_samples/ooze_base_case.rb +42 -0
- data/lib/eco/api/usecases/ooze_samples/ooze_update_case.rb +0 -39
- data/lib/eco/api/usecases/ooze_samples/register_update_case.rb +2 -2
- data/lib/eco/cli/config/default/workflow.rb +14 -5
- data/lib/eco/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84c964d986dd27f75c533dfcca194ca69354eeda318fe751f40db3f1276c4d69
|
4
|
+
data.tar.gz: 958a277abf32af125c768b17e5b6bf0791c6136658ebb1e0183f973b4b4b4839
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c704901e864a071f11b62a8e2ec4916f3cfb63fc6ebd87a92391339dfb559afe1e1f062c0234e2ffaa9a754a99eec978969447cdb19bbe49aa629aac040d7d80
|
7
|
+
data.tar.gz: 98348a3777cb58849a007b3e4487db3f270190c595c6dc8384e2b28a838f203332fe746a2429adb69cc32b3af62fb6048376e3606587a9ea9df548708321251a
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,19 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## [2.0.39] - 2021-09-07
|
5
|
+
|
6
|
+
### Added
|
7
|
+
### Changed
|
8
|
+
- `Eco::API::UseCases::OozeSamples::OozeBaseCase`
|
9
|
+
- Moved helpers from `Eco::API::UseCases::OozeSamples::OozeUpdateCase`
|
10
|
+
|
11
|
+
### Fixed
|
12
|
+
- `Eco::API::UseCases::OozeSamples::RegisterUpdateCase`
|
13
|
+
- fix launch condition to be `Y`
|
14
|
+
- fix `search` method call
|
15
|
+
- Changed the `workflow` to prevent re-cache of people when `people` was not used
|
16
|
+
|
4
17
|
## [2.0.38] - 2021-09-07
|
5
18
|
|
6
19
|
### Added
|
@@ -12,8 +25,6 @@ All notable changes to this project will be documented in this file.
|
|
12
25
|
### Changed
|
13
26
|
- Changed the `workflow` to prevent re-cache of people when `people` was not used
|
14
27
|
|
15
|
-
### Fixed
|
16
|
-
|
17
28
|
## [2.0.37] - 2021-09-03
|
18
29
|
|
19
30
|
### Added
|
data/eco-helpers.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_development_dependency "redcarpet", ">= 3.5.1", "< 3.6"
|
32
32
|
|
33
33
|
spec.add_dependency 'ecoportal-api', '>= 0.8.3', '< 0.9'
|
34
|
-
spec.add_dependency 'ecoportal-api-v2', '>= 0.8.
|
34
|
+
spec.add_dependency 'ecoportal-api-v2', '>= 0.8.14', '< 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'
|
@@ -26,6 +26,48 @@ class Eco::API::UseCases::OozeSamples::OozeBaseCase < Eco::API::Common::Loaders:
|
|
26
26
|
update_ooze(ooze)
|
27
27
|
end
|
28
28
|
|
29
|
+
protected
|
30
|
+
|
31
|
+
def add_field(name, type, section, after: nil, before: nil, side: :left)
|
32
|
+
unless section.is_a?(Ecoportal::API::V2::Page::Section)
|
33
|
+
raise "You need to specify a section for a new field. Given: #{section.class}"
|
34
|
+
end
|
35
|
+
target.components.add(label: name, type: type) do |field|
|
36
|
+
section.add_component(field, after: after, before: before, side: side)
|
37
|
+
end.tap do |field|
|
38
|
+
yield(field) if block_given?
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def with_fields(type: nil, label: nil)
|
43
|
+
flds = target.components
|
44
|
+
flds = flds.get_by_type(type) if type
|
45
|
+
flds = flds.select do |fld|
|
46
|
+
value = (label == :unnamed) ? nil : label
|
47
|
+
!label || same_string?(fld.label, value)
|
48
|
+
end.each do |field|
|
49
|
+
yield(field) if block_given?
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def with_sections(type: nil, heading: nil)
|
54
|
+
secs = target.sections
|
55
|
+
secs = secs.get_by_type(type) if type
|
56
|
+
secs = secs.select do |sec|
|
57
|
+
value = (heading == :unnamed) ? nil : heading
|
58
|
+
!heading || same_string?(sec.heading, value)
|
59
|
+
end.each do |sec|
|
60
|
+
yield(sec) if block_given?
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def with_stage(name:)
|
65
|
+
if stage = target.stages.get_by_name(name)
|
66
|
+
yield(stage) if block_given?
|
67
|
+
end
|
68
|
+
stage
|
69
|
+
end
|
70
|
+
|
29
71
|
private
|
30
72
|
|
31
73
|
# Hook method to use before the target is switched
|
@@ -4,44 +4,6 @@ class Eco::API::UseCases::OozeSamples::OozeUpdateCase < Eco::API::UseCases::Ooze
|
|
4
4
|
|
5
5
|
private
|
6
6
|
|
7
|
-
def with_fields(type: nil, label: nil)
|
8
|
-
flds = target.components
|
9
|
-
flds = flds.get_by_type(type) if type
|
10
|
-
flds = flds.select do |fld|
|
11
|
-
value = (label == :unnamed) ? nil : label
|
12
|
-
!label || same_string?(fld.label, value)
|
13
|
-
end.each do |field|
|
14
|
-
yield(field) if block_given?
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def with_sections(type: nil, heading: nil)
|
19
|
-
secs = target.sections
|
20
|
-
secs = secs.get_by_type(type) if type
|
21
|
-
secs = secs.select do |sec|
|
22
|
-
value = (heading == :unnamed) ? nil : heading
|
23
|
-
!heading || same_string?(sec.heading, value)
|
24
|
-
end.each do |sec|
|
25
|
-
yield(sec) if block_given?
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def with_stage(name:)
|
30
|
-
if stage = target.stages.get_by_name(name)
|
31
|
-
yield(stage) if block_given?
|
32
|
-
end
|
33
|
-
stage
|
34
|
-
end
|
35
|
-
|
36
|
-
def add_field(name, type, section, after: nil, side: :left)
|
37
|
-
raise "You need to specify a section for a new field. Given: #{section.class}" unless section.is_a?(Ecoportal::API::V2::Page::Section)
|
38
|
-
target.components.add(label: name, type: type) do |field|
|
39
|
-
section.add_component(field, after: after, side: side)
|
40
|
-
end.tap do |field|
|
41
|
-
yield(field) if block_given?
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
7
|
def to_field(value)
|
46
8
|
fld = nil
|
47
9
|
fld ||= value if value.is_a?(Ecoportal::API::V2::Page::Component)
|
@@ -50,5 +12,4 @@ class Eco::API::UseCases::OozeSamples::OozeUpdateCase < Eco::API::UseCases::Ooze
|
|
50
12
|
#fld ||= value.reference if value.is_a?(Ecoportal::API::V2::Page::Force::Binding)
|
51
13
|
end
|
52
14
|
|
53
|
-
|
54
15
|
end
|
@@ -129,7 +129,7 @@ class Eco::API::UseCases::OozeSamples::RegisterUpdateCase < Eco::API::UseCases::
|
|
129
129
|
apiv2.registers.search(register_id, search_options.merge(only_first: true)).tap do |search_results|
|
130
130
|
str_results = "Total target entries: #{search_results.total} (out of #{search_results.total_before_filtering})"
|
131
131
|
session.prompt_user("Do you want to proceed (y/N):", explanation: str_results, default: "N", timeout: 10) do |res|
|
132
|
-
|
132
|
+
unless res.upcase.start_with?("Y")
|
133
133
|
puts "..."
|
134
134
|
logger.info "Aborting script..."
|
135
135
|
exit(0)
|
@@ -142,7 +142,7 @@ class Eco::API::UseCases::OozeSamples::RegisterUpdateCase < Eco::API::UseCases::
|
|
142
142
|
@search_options ||= {}.tap do |opts|
|
143
143
|
opts.merge!(sort: "created_at")
|
144
144
|
opts.merge!(dir: "asc")
|
145
|
-
opts.merge!(query:
|
145
|
+
opts.merge!(query: conf_search) if conf_search
|
146
146
|
opts.merge!(filters: conf_filters)
|
147
147
|
end
|
148
148
|
end
|
@@ -101,19 +101,28 @@ ASSETS.cli.config do |config|
|
|
101
101
|
get_people = io.options.dig(:people, :get)
|
102
102
|
partial_update = get_people && get_people.dig(:type) == :partial
|
103
103
|
run_it = !io.options[:dry_run] || io.options.dig(:post_launch, :run)
|
104
|
-
|
105
|
-
|
104
|
+
refresh_data = !io.options[:dry_run] && partial_update
|
105
|
+
if run_it
|
106
|
+
if refresh_data
|
106
107
|
# get target people afresh
|
107
108
|
people = io.session.micro.people_refresh(people: io.people, include_created: true)
|
108
109
|
io = io.base.new(people: people)
|
110
|
+
else
|
111
|
+
msg = "Although there are post_launch cases, data will not be refreshed before their run"
|
112
|
+
if io.options[:dry_run]
|
113
|
+
msg += ", because we are in dry-run (simulate)."
|
114
|
+
elsif !partial_update
|
115
|
+
msg += ", because it is not a partial update (-get-partial option not present)."
|
116
|
+
end
|
117
|
+
io.session.logger.warn(msg)
|
109
118
|
end
|
110
119
|
else
|
111
120
|
wf_post.skip!
|
112
121
|
msg = "Although there are post_launch cases, they will NOT be RUN"
|
113
|
-
if
|
114
|
-
msg+= ", because we are in dry-run (simulate)."
|
115
|
-
elsif !partial_update
|
122
|
+
if !partial_update
|
116
123
|
msg+= ", because it is not a partial update (-get-partial)"
|
124
|
+
elsif io.options[:dry_run]
|
125
|
+
msg+= ", because we are in dry-run (simulate)."
|
117
126
|
end
|
118
127
|
io.session.logger.info(msg)
|
119
128
|
end
|
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.39
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
requirements:
|
137
137
|
- - ">="
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version: 0.8.
|
139
|
+
version: 0.8.14
|
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.14
|
150
150
|
- - "<"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0.9'
|