eco-helpers 2.0.24 → 2.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +89 -6
- data/lib/eco/api/common.rb +0 -1
- data/lib/eco/api/common/loaders.rb +2 -0
- data/lib/eco/api/common/loaders/base.rb +58 -0
- data/lib/eco/api/common/loaders/case_base.rb +33 -0
- data/lib/eco/api/common/loaders/error_handler.rb +2 -2
- data/lib/eco/api/common/loaders/parser.rb +30 -5
- data/lib/eco/api/common/loaders/policy.rb +1 -1
- data/lib/eco/api/common/loaders/use_case.rb +1 -1
- data/lib/eco/api/common/people/default_parsers/csv_parser.rb +129 -1
- data/lib/eco/api/common/people/entries.rb +83 -14
- data/lib/eco/api/common/people/entry_factory.rb +11 -10
- data/lib/eco/api/common/people/person_attribute_parser.rb +8 -0
- data/lib/eco/api/common/people/person_entry.rb +7 -6
- data/lib/eco/api/common/people/person_entry_attribute_mapper.rb +55 -16
- data/lib/eco/api/common/people/person_factory.rb +4 -2
- data/lib/eco/api/common/people/person_parser.rb +7 -1
- data/lib/eco/api/common/people/supervisor_helpers.rb +1 -1
- data/lib/eco/api/common/version_patches/ecoportal_api/external_person.rb +0 -8
- data/lib/eco/api/common/version_patches/ecoportal_api/internal_person.rb +0 -8
- data/lib/eco/api/microcases/set_core_with_supervisor.rb +4 -2
- data/lib/eco/api/microcases/set_supervisor.rb +29 -8
- data/lib/eco/api/microcases/with_each.rb +7 -3
- data/lib/eco/api/microcases/with_each_starter.rb +3 -2
- data/lib/eco/api/organization/people.rb +7 -1
- data/lib/eco/api/session.rb +7 -2
- data/lib/eco/api/session/batch.rb +1 -1
- data/lib/eco/api/session/batch/job.rb +9 -1
- data/lib/eco/api/usecases/default_cases/create_case.rb +10 -1
- data/lib/eco/api/usecases/default_cases/create_details_case.rb +10 -1
- data/lib/eco/api/usecases/default_cases/create_details_with_supervisor_case.rb +10 -1
- data/lib/eco/api/usecases/default_cases/hris_case.rb +25 -1
- data/lib/eco/api/usecases/default_cases/to_csv_case.rb +1 -37
- data/lib/eco/api/usecases/default_cases/to_csv_detailed_case.rb +42 -0
- data/lib/eco/api/usecases/default_cases/upsert_case.rb +10 -1
- data/lib/eco/cli/config/default/input.rb +2 -2
- data/lib/eco/cli/config/default/options.rb +29 -8
- data/lib/eco/cli/config/default/usecases.rb +16 -0
- data/lib/eco/cli/config/default/workflow.rb +7 -4
- data/lib/eco/cli/config/filters.rb +6 -2
- data/lib/eco/cli/config/filters/input_filters.rb +3 -2
- data/lib/eco/cli/config/filters/people_filters.rb +3 -2
- data/lib/eco/cli/config/help.rb +1 -1
- data/lib/eco/cli/config/options_set.rb +6 -4
- data/lib/eco/cli/config/use_cases.rb +6 -3
- data/lib/eco/csv.rb +2 -0
- data/lib/eco/language/models/collection.rb +5 -2
- data/lib/eco/version.rb +1 -1
- metadata +3 -2
- data/lib/eco/api/common/base_loader.rb +0 -72
@@ -7,16 +7,20 @@ module Eco
|
|
7
7
|
# @param entries [Eco::API::Common::People::Entries] the input entries with the data.
|
8
8
|
# @param people [Eco::API::Organization::People] target existing _People_ of the current update.
|
9
9
|
# @param options [Hash] the options.
|
10
|
+
# @param append_created [Boolean] whether or not a new person will be added to the `people` object.
|
10
11
|
# @yield [entry, person] gives each entry, and the paired person thereof (new or existing).
|
11
12
|
# @yieldparam entry [PersonEntry] the input entry with the data we should set on person.
|
12
13
|
# @yieldparam person [Ecoportal::API::V1::Person] the found person that matches `entry`, or a new person otherwise.
|
13
14
|
# @return [Eco::API::Organization::People] all the people, including new and existing ones.
|
14
|
-
def with_each(entries, people, options)
|
15
|
+
def with_each(entries, people, options, append_created: true)
|
15
16
|
@_skip_all_multiple_results = false
|
17
|
+
people_copy = people.newFrom(people.to_a)
|
16
18
|
entries.each_with_object([]) do |entry, scoped|
|
17
19
|
begin
|
18
|
-
unless person =
|
19
|
-
person = session.new_person
|
20
|
+
unless person = people_copy.find(entry, strict: micro.strict_search?(options))
|
21
|
+
person = session.new_person.tap do |person|
|
22
|
+
people << person if append_created
|
23
|
+
end
|
20
24
|
end
|
21
25
|
rescue Eco::API::Organization::People::MultipleSearchResults => e
|
22
26
|
unless @_skip_all_multiple_results
|
@@ -8,13 +8,14 @@ module Eco
|
|
8
8
|
# @param people [Eco::API::Organization::People] target existing _People_ of the current update.
|
9
9
|
# @param options [Hash] the options.
|
10
10
|
# @param log_present [Boolean] log error message if an `entry` has match in `people`.
|
11
|
+
# @param append_created [Boolean] whether or not a new person will be added to the `people` object.
|
11
12
|
# @yield [entry, person] gives each **new** `person` of `entries` that is not present in `people`.
|
12
13
|
# @yieldparam entry [PersonEntry] the input entry with the data we should set on person.
|
13
14
|
# @yieldparam person [Ecoportal::API::V1::Person] the **new** person.
|
14
15
|
# @return [Eco::API::Organization::People] the starters.
|
15
|
-
def with_each_starter(entries, people, options, log_present: false)
|
16
|
+
def with_each_starter(entries, people, options, log_present: false, append_created: true)
|
16
17
|
starters = []
|
17
|
-
micro.with_each(entries, people, options) do |entry, person|
|
18
|
+
micro.with_each(entries, people, options, append_created: append_created) do |entry, person|
|
18
19
|
if !person.new?
|
19
20
|
if log_present
|
20
21
|
session.logger.error("This person (id: '#{person.id}') already exists: #{entry.to_s(:identify)}")
|
@@ -210,6 +210,12 @@ module Eco
|
|
210
210
|
to_h(:supervisor_id)
|
211
211
|
end
|
212
212
|
|
213
|
+
def group_by_schema
|
214
|
+
to_h do |person|
|
215
|
+
person.details && person.details.schema_id
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
213
219
|
def to_h(attr = "id")
|
214
220
|
super(attr || "id")
|
215
221
|
end
|
@@ -252,7 +258,7 @@ module Eco
|
|
252
258
|
|
253
259
|
def init_caches
|
254
260
|
return if @caches_init
|
255
|
-
@by_id = to_h
|
261
|
+
@by_id = no_nil_key(to_h)
|
256
262
|
@by_external_id = no_nil_key(to_h('external_id'))
|
257
263
|
@by_users_email = no_nil_key(existing_users.to_h('email'))
|
258
264
|
@by_non_users_email = no_nil_key(non_users.to_h('email'))
|
data/lib/eco/api/session.rb
CHANGED
@@ -153,9 +153,14 @@ module Eco
|
|
153
153
|
# Generates an entries collection from a csv input file.
|
154
154
|
# @see Eco::API::Common::People::EntryFactory#entries
|
155
155
|
# @param file [String] file to generate the entries from.
|
156
|
+
# @param (see Eco::API::Session#entries)
|
156
157
|
# @return [Eco::API::Common::People::Entries] collection of entries.
|
157
|
-
def csv_entries(file)
|
158
|
-
|
158
|
+
def csv_entries(file, **kargs)
|
159
|
+
kargs.merge!({
|
160
|
+
file: file,
|
161
|
+
format: :csv
|
162
|
+
})
|
163
|
+
return entries(**kargs)
|
159
164
|
end
|
160
165
|
|
161
166
|
# Generates the collection of entries that should be discarded from an update.
|
@@ -137,7 +137,7 @@ module Eco
|
|
137
137
|
rescue error_type => e
|
138
138
|
raise unless retries_left > 0
|
139
139
|
explanation = "Batch TimeOut. You have #{retries_left} retries left."
|
140
|
-
prompt_user("Do you want to retry (y/N)?",
|
140
|
+
prompt_user(" Do you want to retry (y/N)?", default: "Y", explanation: explanation, timeout: 10) do |response|
|
141
141
|
if response.upcase.start_with?("Y")
|
142
142
|
offer_retry_on(error_type, retries_left - 1, &block)
|
143
143
|
else
|
@@ -253,7 +253,7 @@ module Eco
|
|
253
253
|
def api_included(full_queue)
|
254
254
|
return full_queue if type == :create
|
255
255
|
return full_queue unless excluded = session.config.people.api_excluded
|
256
|
-
if options.dig(:include, :
|
256
|
+
if options.dig(:include, :excluded, :only)
|
257
257
|
full_queue.select {|entry| excluded.call(entry, session, options, self)}
|
258
258
|
elsif options.dig(:include, :excluded)
|
259
259
|
full_queue
|
@@ -304,6 +304,9 @@ module Eco
|
|
304
304
|
if !simulate && status
|
305
305
|
status.queue.map do |entry|
|
306
306
|
if status.success?(entry)
|
307
|
+
if type == :create && entry.respond_to?(:id=)
|
308
|
+
entry.id = status[entry].body["id"]
|
309
|
+
end
|
307
310
|
entry.consolidate! if entry.respond_to?(:consolidate!)
|
308
311
|
#else # do not entry.reset! (keep track on changes still)
|
309
312
|
end
|
@@ -324,7 +327,12 @@ module Eco
|
|
324
327
|
end
|
325
328
|
end
|
326
329
|
elsif simulate
|
330
|
+
fake_id = 111111111111111111111111
|
327
331
|
queue.map do |entry|
|
332
|
+
if type == :create && entry.respond_to?(:id=)
|
333
|
+
entry.id = fake_id.to_s
|
334
|
+
fake_id += 1
|
335
|
+
end
|
328
336
|
entry.consolidate! if entry.respond_to?(:consolidate!)
|
329
337
|
end
|
330
338
|
end
|
@@ -2,12 +2,15 @@ class Eco::API::UseCases::DefaultCases::CreateCase < Eco::API::Common::Loaders::
|
|
2
2
|
name "create"
|
3
3
|
type :sync
|
4
4
|
|
5
|
+
attr_reader :options
|
6
|
+
|
5
7
|
def main(entries, people, session, options, usecase)
|
8
|
+
options = @options
|
6
9
|
micro = session.micro
|
7
10
|
creation = session.new_job("main", "create", :create, usecase)
|
8
11
|
supers = session.new_job("post", "supers", :update, usecase, :core)
|
9
12
|
|
10
|
-
micro.with_each_starter(entries, people, options, log_present: true) do |entry, person|
|
13
|
+
micro.with_each_starter(entries, people, options, log_present: true, append_created: append_created) do |entry, person|
|
11
14
|
creation.add(person)
|
12
15
|
micro.set_core_with_supervisor(entry, person, people, supers, options)
|
13
16
|
entry.set_details(person) unless options.dig(:exclude, :details)
|
@@ -15,4 +18,10 @@ class Eco::API::UseCases::DefaultCases::CreateCase < Eco::API::Common::Loaders::
|
|
15
18
|
end
|
16
19
|
end
|
17
20
|
|
21
|
+
private
|
22
|
+
|
23
|
+
def append_created
|
24
|
+
options.dig(:people, :append_created)
|
25
|
+
end
|
26
|
+
|
18
27
|
end
|
@@ -2,15 +2,24 @@ class Eco::API::UseCases::DefaultCases::CreateDetailsCase < Eco::API::Common::Lo
|
|
2
2
|
name "create-details"
|
3
3
|
type :sync
|
4
4
|
|
5
|
+
attr_reader :options
|
6
|
+
|
5
7
|
def main(entries, people, session, options, usecase)
|
8
|
+
@options = options
|
6
9
|
micro = session.micro
|
7
10
|
creation = session.new_job("main", "create", :create, usecase)
|
8
11
|
|
9
|
-
micro.with_each_starter(entries, people, options, log_present: true) do |entry, person|
|
12
|
+
micro.with_each_starter(entries, people, options, log_present: true, append_created: append_created) do |entry, person|
|
10
13
|
creation.add(person)
|
11
14
|
micro.set_core(entry, person, options)
|
12
15
|
entry.set_details(person) unless options.dig(:exclude, :details)
|
13
16
|
end
|
14
17
|
end
|
15
18
|
|
19
|
+
private
|
20
|
+
|
21
|
+
def append_created
|
22
|
+
options.dig(:people, :append_created)
|
23
|
+
end
|
24
|
+
|
16
25
|
end
|
@@ -2,16 +2,25 @@ class Eco::API::UseCases::DefaultCases::CreateDetailsWithSupervisorCase < Eco::A
|
|
2
2
|
name "create-details-with-supervisor"
|
3
3
|
type :sync
|
4
4
|
|
5
|
+
attr_reader :options
|
6
|
+
|
5
7
|
def main(entries, people, session, options, usecase)
|
8
|
+
@options = options
|
6
9
|
micro = session.micro
|
7
10
|
creation = session.new_job("main", "create", :create, usecase)
|
8
11
|
supers = session.new_job("post", "supers", :update, usecase, :core)
|
9
12
|
|
10
|
-
micro.with_each_starter(entries, people, options, log_present: true) do |entry, person|
|
13
|
+
micro.with_each_starter(entries, people, options, log_present: true, append_created: append_created) do |entry, person|
|
11
14
|
creation.add(person)
|
12
15
|
micro.set_core_with_supervisor(entry, person, people, supers, options)
|
13
16
|
entry.set_details(person) unless options.dig(:exclude, :details)
|
14
17
|
end
|
15
18
|
end
|
16
19
|
|
20
|
+
private
|
21
|
+
|
22
|
+
def append_created
|
23
|
+
options.dig(:people, :append_created)
|
24
|
+
end
|
25
|
+
|
17
26
|
end
|
@@ -3,8 +3,11 @@ class Eco::API::UseCases::DefaultCases::HrisCase < Eco::API::Common::Loaders::Us
|
|
3
3
|
type :sync
|
4
4
|
|
5
5
|
attr_reader :creation, :update, :supers, :leavers
|
6
|
+
attr_reader :people, :session, :options
|
6
7
|
|
7
8
|
def main(entries, people, session, options, usecase)
|
9
|
+
@session = session; @options = options; @people = people
|
10
|
+
require_only_one_schema!
|
8
11
|
micro = session.micro
|
9
12
|
@creation = session.new_job("main", "create", :create, usecase)
|
10
13
|
@update = session.new_job("main", "update", :update, usecase)
|
@@ -15,7 +18,7 @@ class Eco::API::UseCases::DefaultCases::HrisCase < Eco::API::Common::Loaders::Us
|
|
15
18
|
leavers.add(person, &method(:leavers_callback))
|
16
19
|
end
|
17
20
|
|
18
|
-
micro.with_each(entries, people, options) do |entry, person|
|
21
|
+
micro.with_each(entries, people, options, append_created: append_created) do |entry, person|
|
19
22
|
person.new? ? creation.add(person) : update.add(person)
|
20
23
|
micro.set_core_with_supervisor(entry, person, people, supers, options)
|
21
24
|
entry.set_details(person) unless options.dig(:exclude, :details)
|
@@ -25,9 +28,30 @@ class Eco::API::UseCases::DefaultCases::HrisCase < Eco::API::Common::Loaders::Us
|
|
25
28
|
|
26
29
|
private
|
27
30
|
|
31
|
+
def append_created
|
32
|
+
options.dig(:people, :append_created)
|
33
|
+
end
|
34
|
+
|
28
35
|
def leavers_callback(person)
|
29
36
|
person.supervisor_id = nil
|
30
37
|
person.account = nil if person.account
|
31
38
|
end
|
32
39
|
|
40
|
+
def require_only_one_schema!
|
41
|
+
unless schema_id = options.dig(:people, :filter, :details, :schema_id)
|
42
|
+
active_schema = session.schema
|
43
|
+
other_schemas = session.schemas.map(&:id) - [active_schema.id]
|
44
|
+
other_people = people.group_by_schema.values_at(*other_schemas).map(&:to_a).flatten
|
45
|
+
if other_people.length > 3
|
46
|
+
msg = "There are #{other_people.length} people in schemas other than #{active_schema.name}."
|
47
|
+
msg << " Please, use the filter option '-schema_id SchemaName' for the 'hris' case to only include those of that schema"
|
48
|
+
msg << " in the current update. The HRIS case identifies people that are not in the file as leavers"
|
49
|
+
msg << " (as it will remove the account of all the people of other schemas if they are not in the input file)."
|
50
|
+
msg << "\n For example: -schema-id '#{active_schema.name.downcase}'"
|
51
|
+
logger.error(msg)
|
52
|
+
raise msg
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
33
57
|
end
|
@@ -125,43 +125,7 @@ class Eco::API::UseCases::DefaultCases::ToCsvCase < Eco::API::Common::Loaders::U
|
|
125
125
|
"id" => "ecoPortal ID",
|
126
126
|
"external_id" => "Reference ID (ext_id)",
|
127
127
|
"login_provider_ids" => "Login Methods",
|
128
|
-
"landing_page_id" => "Landing Page ID"
|
129
|
-
"show_sidebar" => "(pref) Sidebar Open?",
|
130
|
-
"show_shortcuts" => "(pref) Link to Registers?",
|
131
|
-
"show_coming_soon" => "(pref) Coming Soon List?",
|
132
|
-
"show_recently_visited_forms" => "(pref) Recently Visited Forms List?",
|
133
|
-
"show_tasks" => "(pref) Tasks List?",
|
134
|
-
"show_task_bubbles" => "(pref) Task Count Bubbles",
|
135
|
-
"kiosk_enabled" => "Kiosk User?",
|
136
|
-
"freemium" => "Freemium User?",
|
137
|
-
"files" => "(able) on Files",
|
138
|
-
"reports" => "(able) on Report Structures",
|
139
|
-
"data" => "(able) on Data (hours, datasets)",
|
140
|
-
"organization" => "(able) on Organization Config",
|
141
|
-
"pages" => "(able) on Page/Entries",
|
142
|
-
"page_editor" => "(able) page Editor Level",
|
143
|
-
"registers" => "(able) on Registers",
|
144
|
-
"tasks" => "(able) on Tasks",
|
145
|
-
"person_core" => "(able) on People",
|
146
|
-
"person_core_create" => "(able) Create People?",
|
147
|
-
"person_core_edit" => "(able) Edit People?",
|
148
|
-
"person_details" => "(able) on People Schema Details",
|
149
|
-
"person_account" => "(able) on Users",
|
150
|
-
"person_abilities" => "(able) on Users' Abilities",
|
151
|
-
"custom_files" => "(min) on Files",
|
152
|
-
"custom_reports" => "(min) on Report Structures",
|
153
|
-
"custom_data" => "(min) on Data (hours, datasets)",
|
154
|
-
"custom_organization" => "(min) on Organization Config",
|
155
|
-
"custom_pages" => "(min) on Page/Entries",
|
156
|
-
"custom_page_editor" => "(min) page Editor Level",
|
157
|
-
"custom_registers" => "(min) on Registers",
|
158
|
-
"custom_tasks" => "(min) on Tasks",
|
159
|
-
"custom_person_core" => "(min) on People",
|
160
|
-
"custom_person_core_create" => "(min) Create People?",
|
161
|
-
"custom_person_core_edit" => "(min) Edit People?",
|
162
|
-
"custom_person_details" => "(min) on People Schema Details",
|
163
|
-
"custom_person_account" => "(min) on Users",
|
164
|
-
"custom_person_abilities" => "(min) on Users' Abilities"
|
128
|
+
"landing_page_id" => "Landing Page ID"
|
165
129
|
}
|
166
130
|
end
|
167
131
|
|
@@ -75,4 +75,46 @@ class Eco::API::UseCases::DefaultCases::ToCsvDetailedCase < Eco::API::UseCases::
|
|
75
75
|
]
|
76
76
|
end
|
77
77
|
|
78
|
+
def nice_header_maps
|
79
|
+
@nice_header_maps ||= super.merge({
|
80
|
+
"landing_page_id" => "Landing Page ID",
|
81
|
+
"show_sidebar" => "(pref) Sidebar Open?",
|
82
|
+
"show_shortcuts" => "(pref) Link to Registers?",
|
83
|
+
"show_coming_soon" => "(pref) Coming Soon List?",
|
84
|
+
"show_recently_visited_forms" => "(pref) Recently Visited Forms List?",
|
85
|
+
"show_tasks" => "(pref) Tasks List?",
|
86
|
+
"show_task_bubbles" => "(pref) Task Count Bubbles",
|
87
|
+
"kiosk_enabled" => "Kiosk User?",
|
88
|
+
"freemium" => "Freemium User?",
|
89
|
+
"files" => "(able) on Files",
|
90
|
+
"reports" => "(able) on Report Structures",
|
91
|
+
"data" => "(able) on Data (hours, datasets)",
|
92
|
+
"organization" => "(able) on Organization Config",
|
93
|
+
"pages" => "(able) on Page/Entries",
|
94
|
+
"page_editor" => "(able) page Editor Level",
|
95
|
+
"registers" => "(able) on Registers",
|
96
|
+
"tasks" => "(able) on Tasks",
|
97
|
+
"person_core" => "(able) on People",
|
98
|
+
"person_core_create" => "(able) Create People?",
|
99
|
+
"person_core_edit" => "(able) Edit People?",
|
100
|
+
"person_details" => "(able) on People Schema Details",
|
101
|
+
"person_account" => "(able) on Users",
|
102
|
+
"person_abilities" => "(able) on Users' Abilities",
|
103
|
+
"custom_files" => "(min) on Files",
|
104
|
+
"custom_reports" => "(min) on Report Structures",
|
105
|
+
"custom_data" => "(min) on Data (hours, datasets)",
|
106
|
+
"custom_organization" => "(min) on Organization Config",
|
107
|
+
"custom_pages" => "(min) on Page/Entries",
|
108
|
+
"custom_page_editor" => "(min) page Editor Level",
|
109
|
+
"custom_registers" => "(min) on Registers",
|
110
|
+
"custom_tasks" => "(min) on Tasks",
|
111
|
+
"custom_person_core" => "(min) on People",
|
112
|
+
"custom_person_core_create" => "(min) Create People?",
|
113
|
+
"custom_person_core_edit" => "(min) Edit People?",
|
114
|
+
"custom_person_details" => "(min) on People Schema Details",
|
115
|
+
"custom_person_account" => "(min) on Users",
|
116
|
+
"custom_person_abilities" => "(min) on Users' Abilities"
|
117
|
+
})
|
118
|
+
end
|
119
|
+
|
78
120
|
end
|
@@ -2,13 +2,16 @@ class Eco::API::UseCases::DefaultCases::UpsertCase < Eco::API::Common::Loaders::
|
|
2
2
|
name "upsert"
|
3
3
|
type :sync
|
4
4
|
|
5
|
+
attr_reader :options
|
6
|
+
|
5
7
|
def main(entries, people, session, options, usecase)
|
8
|
+
@options = options
|
6
9
|
micro = session.micro
|
7
10
|
creation = session.new_job("main", "create", :create, usecase)
|
8
11
|
update = session.new_job("main", "update", :update, usecase)
|
9
12
|
supers = session.new_job("post", "supers", :update, usecase, :core)
|
10
13
|
|
11
|
-
micro.with_each(entries, people, options) do |entry, person|
|
14
|
+
micro.with_each(entries, people, options, append_created: append_created) do |entry, person|
|
12
15
|
person.new? ? creation.add(person) : update.add(person)
|
13
16
|
micro.set_core_with_supervisor(entry, person, people, supers, options)
|
14
17
|
entry.set_details(person) unless options.dig(:exclude, :details)
|
@@ -16,4 +19,10 @@ class Eco::API::UseCases::DefaultCases::UpsertCase < Eco::API::Common::Loaders::
|
|
16
19
|
end
|
17
20
|
end
|
18
21
|
|
22
|
+
private
|
23
|
+
|
24
|
+
def append_created
|
25
|
+
options.dig(:people, :append_created)
|
26
|
+
end
|
27
|
+
|
19
28
|
end
|
@@ -65,8 +65,8 @@ ASSETS.cli.config do |cnf|
|
|
65
65
|
input = [file].flatten.reduce(Eco::API::Organization::People.new([])) do |people, file|
|
66
66
|
people.merge(JSON.parse(File.read(file)))
|
67
67
|
end
|
68
|
-
else
|
69
|
-
input = session.csv_entries(file)
|
68
|
+
else # :csv
|
69
|
+
input = session.csv_entries(file, check_headers: true)
|
70
70
|
end
|
71
71
|
end
|
72
72
|
input
|
@@ -1,19 +1,35 @@
|
|
1
1
|
ASSETS.cli.config do |cnf|
|
2
2
|
cnf.options_set do |options_set, options|
|
3
3
|
options_set.add("--help", "Offers a HELP") do |options, sesssion|
|
4
|
-
conf
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
conf = ASSETS.cli.config
|
5
|
+
active = Proc.new do |opt|
|
6
|
+
if there = SCR.get_arg(opt)
|
7
|
+
refine = SCR.get_arg(opt, with_param: true)
|
8
|
+
end
|
9
|
+
refine || there
|
10
|
+
end
|
11
|
+
|
12
|
+
if hpf = active.call("-filters")
|
13
|
+
puts conf.people_filters.help(refine: hpf)
|
14
|
+
end
|
15
|
+
if hif = active.call("-input-filters")
|
16
|
+
puts conf.input_filters.help(refine: hif)
|
17
|
+
end
|
18
|
+
if ho = active.call("-options")
|
19
|
+
puts conf.options_set.help(refine: ho)
|
20
|
+
end
|
21
|
+
if huc = active.call("-usecases")
|
22
|
+
puts conf.usecases.help(refine: huc)
|
23
|
+
end
|
9
24
|
puts [
|
10
25
|
"Please specify one of the below:",
|
11
26
|
" -filters to display available filters on people",
|
12
27
|
" -input-filters to display available filters on input data",
|
13
28
|
" -options to dislpay available options",
|
14
29
|
" -usecases to display available usecases",
|
15
|
-
"",
|
16
|
-
"You may specify the usecase to know its specific options by:
|
30
|
+
"TIPS:",
|
31
|
+
" * You may specify the usecase to know its specific options by: -usecase_name --help -options",
|
32
|
+
" * You may specify a refinement to show specific information only: --help -usecases tags"
|
17
33
|
].join("\n") unless hpf || hif || ho || huc
|
18
34
|
exit
|
19
35
|
end
|
@@ -87,6 +103,11 @@ ASSETS.cli.config do |cnf|
|
|
87
103
|
session.config.dry_run!
|
88
104
|
end
|
89
105
|
|
106
|
+
desc = "Runs runs post_launch cases even if in dry-run"
|
107
|
+
options_set.add("-run-postlaunch", desc) do |options, session|
|
108
|
+
options.deep_merge!(post_launch: {run: true})
|
109
|
+
end
|
110
|
+
|
90
111
|
desc = "(careful with this option) This will include everybody as part of the update (including those that are api excluded). "
|
91
112
|
desc += "Only launch with this option when only api excluded people are included in your update."
|
92
113
|
options_set.add("-include-excluded", desc) do |options|
|
@@ -95,7 +116,7 @@ ASSETS.cli.config do |cnf|
|
|
95
116
|
|
96
117
|
desc = "Includes in API updates ONLY people that evaluate true as people excluded from periodic upates."
|
97
118
|
options_set.add("-include-only-excluded", desc) do |options|
|
98
|
-
options.deep_merge!(include: {
|
119
|
+
options.deep_merge!(include: {excluded: {only: true}})
|
99
120
|
end
|
100
121
|
|
101
122
|
desc = "Ignores threshold limitations on requests for this session (skip batch belt)"
|