eco-helpers 2.5.10 → 2.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -2
- data/CHANGELOG.md +132 -4
- data/README.md +5 -0
- data/eco-helpers.gemspec +20 -16
- data/lib/eco/api/common/class_helpers.rb +1 -1
- data/lib/eco/api/common/loaders/base.rb +2 -9
- data/lib/eco/api/common/loaders/case_base.rb +0 -2
- data/lib/eco/api/common/loaders/config/workflow/mailer.rb +78 -0
- data/lib/eco/api/common/loaders/config/workflow.rb +11 -0
- data/lib/eco/api/common/loaders/config.rb +29 -0
- data/lib/eco/api/common/loaders/error_handler.rb +0 -2
- data/lib/eco/api/common/loaders/parser.rb +0 -1
- data/lib/eco/api/common/loaders/policy.rb +0 -2
- data/lib/eco/api/common/loaders/use_case.rb +27 -1
- data/lib/eco/api/common/loaders.rb +1 -0
- data/lib/eco/api/common/people/default_parsers.rb +2 -2
- data/lib/eco/api/common/people/person_entry.rb +3 -0
- data/lib/eco/api/common/people/person_entry_attribute_mapper.rb +111 -16
- data/lib/eco/api/common/session/base_session.rb +4 -0
- data/lib/eco/api/common/session/environment.rb +4 -0
- data/lib/eco/api/common/session/mailer.rb +3 -1
- data/lib/eco/api/common/session/sftp.rb +1 -1
- data/lib/eco/api/common/version_patches/exception.rb +2 -2
- data/lib/eco/api/common/version_patches/ruby3/object.rb +18 -0
- data/lib/eco/api/common/version_patches/ruby3.rb +1 -0
- data/lib/eco/api/common/version_patches.rb +3 -0
- data/lib/eco/api/custom/config.rb +10 -0
- data/lib/eco/api/custom/mailer.rb +9 -0
- data/lib/eco/api/custom/namespace.rb +2 -0
- data/lib/eco/api/custom/workflow.rb +9 -0
- data/lib/eco/api/custom.rb +3 -0
- data/lib/eco/api/organization/tag_tree.rb +20 -23
- data/lib/eco/api/session/batch/base_policy.rb +13 -5
- data/lib/eco/api/session/batch/job.rb +14 -11
- data/lib/eco/api/session/batch/jobs.rb +2 -2
- data/lib/eco/api/session/batch/jobs_groups.rb +2 -2
- data/lib/eco/api/session/config/files.rb +2 -2
- data/lib/eco/api/session/config/people.rb +2 -2
- data/lib/eco/api/session/config/sftp.rb +4 -0
- data/lib/eco/api/session/config/tagtree.rb +9 -8
- data/lib/eco/api/session/config/workflow.rb +95 -58
- data/lib/eco/api/session/config.rb +9 -2
- data/lib/eco/api/session.rb +17 -2
- data/lib/eco/api/usecases/base_io.rb +50 -4
- data/lib/eco/api/usecases/cli/dsl.rb +94 -0
- data/lib/eco/api/usecases/cli/option.rb +19 -0
- data/lib/eco/api/usecases/cli.rb +13 -0
- data/lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb +29 -0
- data/lib/eco/api/usecases/{default_cases → default/locations}/codes_to_tags_case.rb +1 -1
- data/lib/eco/api/usecases/{default_cases → default/locations}/create_tag_paths_case.rb +1 -1
- data/lib/eco/api/usecases/{default_cases → default/locations}/csv_to_tree_case.rb +1 -1
- data/lib/eco/api/usecases/default/locations/tagtree_extract_case.rb +181 -0
- data/lib/eco/api/usecases/default/locations.rb +15 -0
- data/lib/eco/api/usecases/{default_cases → default/people}/analyse_people_case.rb +1 -1
- data/lib/eco/api/usecases/{default_cases → default/people}/change_email_case.rb +1 -1
- data/lib/eco/api/usecases/default/people/clean_unknown_tags_case.rb +66 -0
- data/lib/eco/api/usecases/{default_cases → default/people}/clear_abilities_case.rb +1 -1
- data/lib/eco/api/usecases/{default_cases → default/people}/org_data_convert_case.rb +1 -1
- data/lib/eco/api/usecases/{default_cases → default/people}/refresh_case.rb +1 -1
- data/lib/eco/api/usecases/{default_cases → default/people}/reinvite_sync_case.rb +1 -1
- data/lib/eco/api/usecases/{default_cases → default/people}/reinvite_trans_case.rb +1 -1
- data/lib/eco/api/usecases/default/people/reinvite_trans_cli.rb +5 -0
- data/lib/eco/api/usecases/{default_cases → default/people}/restore_db_case.rb +1 -1
- data/lib/eco/api/usecases/{default_cases → default/people}/set_default_tag_case.rb +1 -1
- data/lib/eco/api/usecases/{default_cases → default/people}/supers_cyclic_identify_case.rb +1 -1
- data/lib/eco/api/usecases/{default_cases → default/people}/supers_hierarchy_case.rb +1 -1
- data/lib/eco/api/usecases/{default_cases → default/people}/switch_supervisor_case.rb +1 -1
- data/lib/eco/api/usecases/{default_cases → default/people}/transfer_account_case.rb +1 -1
- data/lib/eco/api/usecases/default/people.rb +25 -0
- data/lib/eco/api/usecases/default.rb +16 -0
- data/lib/eco/api/usecases/default_cases/samples/cli/sftp_cli.rb +46 -0
- data/lib/eco/api/usecases/default_cases/samples/sftp_case.rb +21 -9
- data/lib/eco/api/usecases/default_cases.rb +2 -30
- data/lib/eco/api/usecases/graphql/helpers/location/base.rb +1 -2
- data/lib/eco/api/usecases/graphql/utils/sftp.rb +1 -1
- data/lib/eco/api/usecases/ooze_samples/register_update_case.rb +3 -3
- data/lib/eco/api/usecases/use_case.rb +31 -7
- data/lib/eco/api/usecases/use_case_chain.rb +2 -2
- data/lib/eco/api/usecases.rb +4 -1
- data/lib/eco/assets.rb +3 -5
- data/lib/eco/cli/config/filters/people_filters.rb +0 -1
- data/lib/eco/cli/config/filters.rb +2 -6
- data/lib/eco/cli/config/help.rb +0 -1
- data/lib/eco/cli/config/input.rb +0 -1
- data/lib/eco/cli/config/options_set.rb +3 -4
- data/lib/eco/cli/config/use_cases.rb +13 -6
- data/lib/eco/cli/config.rb +4 -5
- data/lib/eco/cli/scripting/args_helpers.rb +1 -1
- data/lib/eco/cli/scripting/argument.rb +0 -1
- data/lib/eco/cli/scripting/arguments.rb +0 -2
- data/lib/eco/cli.rb +0 -1
- data/lib/eco/{cli/config/default → cli_default}/input_filters.rb +0 -1
- data/lib/eco/{cli/config/default → cli_default}/people_filters.rb +0 -1
- data/lib/eco/{cli/config/default → cli_default}/usecases.rb +2 -52
- data/lib/eco/cli_default/workflow.rb +171 -0
- data/lib/eco/cli_default.rb +13 -0
- data/lib/eco/csv/table.rb +0 -1
- data/lib/eco/data/files/encoding.rb +1 -1
- data/lib/eco/data/files/helpers.rb +1 -1
- data/lib/eco/data/locations/convert.rb +8 -4
- data/lib/eco/data/locations/node_base/csv_convert.rb +4 -4
- data/lib/eco/data/locations/node_base/tag_validations.rb +19 -9
- data/lib/eco/data/locations/node_base/treeify.rb +193 -18
- data/lib/eco/data/locations/node_level.rb +1 -1
- data/lib/eco/data/locations/node_plain/parsing.rb +1 -1
- data/lib/eco/data/locations/node_plain/serial.rb +1 -1
- data/lib/eco/data/locations/node_plain.rb +4 -3
- data/lib/eco/data/mapper.rb +6 -1
- data/lib/eco/language/klass/when_inherited.rb +17 -0
- data/lib/eco/language/klass.rb +8 -0
- data/lib/eco/language/methods/delegate_missing.rb +28 -0
- data/lib/eco/language/methods/dsl_able.rb +25 -0
- data/lib/eco/language/methods.rb +9 -0
- data/lib/eco/language.rb +2 -0
- data/lib/eco/version.rb +1 -1
- metadata +169 -79
- data/lib/eco/api/usecases/default_cases/abstract_policygroup_abilities_case.rb +0 -160
- data/lib/eco/api/usecases/default_cases/append_usergroups_case.rb +0 -14
- data/lib/eco/api/usecases/default_cases/clean_unknown_tags_case.rb +0 -74
- data/lib/eco/api/usecases/default_cases/create_details_case.rb +0 -20
- data/lib/eco/api/usecases/default_cases/create_details_with_supervisor_case.rb +0 -21
- data/lib/eco/api/usecases/default_cases/email_as_id_case.rb +0 -12
- data/lib/eco/api/usecases/default_cases/new_email_case.rb +0 -13
- data/lib/eco/api/usecases/default_cases/new_id_case.rb +0 -12
- data/lib/eco/api/usecases/default_cases/remove_account_sync_case.rb +0 -10
- data/lib/eco/api/usecases/default_cases/remove_account_trans_case.rb +0 -16
- data/lib/eco/api/usecases/default_cases/reset_landing_page_case.rb +0 -18
- data/lib/eco/api/usecases/default_cases/set_supervisor_case.rb +0 -16
- data/lib/eco/api/usecases/default_cases/tagtree_case.rb +0 -42
- data/lib/eco/api/usecases/default_cases/update_details_case.rb +0 -15
- data/lib/eco/cli/config/default/workflow.rb +0 -188
- data/lib/eco/cli/config/default.rb +0 -16
- /data/lib/eco/{cli/config/default → cli_default}/input.rb +0 -0
- /data/lib/eco/{cli/config/default → cli_default}/options.rb +0 -0
- /data/lib/eco/{cli/config/default → cli_default}/people.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5b781e23d7538417c84762d636b8e10281adce9e5228cef561edf199aba5334
|
4
|
+
data.tar.gz: ab7284a1124a8bece11d8d72e8bdc2f532d746e1da3cfdc264270885d6f867d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb069c529b1f318f700672676178c52921b06dcaf2600c1b0f6c3ab5b388f781c17630a0ae4d0b815f206bc74cff8a528ab3f6df53ce5ea9068416b40174b3f2
|
7
|
+
data.tar.gz: 0fe617fa64e3bf666438ac6a8b6bf35eac83c9552280d16f9070443fe7e7b5e7e4c0e28185b5bcf853e6eac40fc465bb29d55c3112621b9d3d979dcac81436bc
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,140 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [2.
|
4
|
+
## [2.6.1] - 2024-02-11
|
5
|
+
|
6
|
+
### Added
|
7
|
+
- For use case `Eco::API::UseCases::Default::Locations::TagtreeExtract`
|
8
|
+
- New `-indent` option
|
9
|
+
- `Eco::API::UseCases::UseCase`
|
10
|
+
- Defines on loader object attr reader methods `people`, `input` and `usecase` unless they already exist.
|
11
|
+
- Some class / method helpers
|
12
|
+
- `Eco::Language::Methods::DelegateMissing` to redirect missing methods to one object
|
13
|
+
- `Eco::Language::Methods::DslAble` to allow direct method calls on blocks
|
14
|
+
- `Eco::Language::Klass:WhenInherited` to allow to defined a block that gets called when the class is inherited
|
15
|
+
- **DSL** capabilities (for block calls) for
|
16
|
+
- `Eco::API::Session::Batch::BasePolicy`
|
17
|
+
- `Eco::API::Session::Batch::Job`
|
18
|
+
- `api_excluded` block to be called in the Job's context
|
19
|
+
- `Eco::API::UseCases::BaseIO`
|
20
|
+
- This shortens code lines in workflow blocks
|
21
|
+
- `Eco::API::Session::Config::Workflow#run` has been adapted to boost the evalution of the workflow blocks within the context of the `BaseIO` that is carried throughout all the run process.
|
22
|
+
- **NEW** Loaders
|
23
|
+
- `Eco::API::Custom::Config` (**DSL** alike) allows to open up configuration via class
|
24
|
+
- Redirects to `Eco::API::Common::Loaders::Config`
|
25
|
+
- Re-usable sample child classes can created with the use of `config_block`, which in combination with `when_inherited` will load the basic config to custom config classes.
|
26
|
+
- `Eco::API::Custom::Workflow` (**DSL** alike) allows to open up workflow configurations via class
|
27
|
+
- Redirects to `Eco::API::Common::Loaders::Config::Workflow`
|
28
|
+
- `Eco::API::Custom::Mailer` (first **sample**) allows to just define some constants to modify the generic behaviour of this sample class you will want to inherit to enable mailing workflow.
|
29
|
+
- Redirects to `Eco::API::Common::Loaders::Config::Workflow::Mailer`
|
30
|
+
- `Eco::Assets#cli` able to yield the `cli` to a block
|
31
|
+
- `Eco::API::UseCases::BaseIO#process_case`
|
32
|
+
- **added method** `process_case`, which allows to pass the `io` itself as a paramter.
|
33
|
+
- When this is used, the `output` swap as `input` / `people` is performed (before and after).
|
34
|
+
|
35
|
+
### Changed
|
36
|
+
- **IMPORTANT** overriden `Object#inspect` to `to_s` to prevent recursive deep introspection of object internals on `MethodError`
|
37
|
+
- `Eco::API::Common::Loaders::CaseBase`
|
38
|
+
- **removed** attr `usecase`
|
39
|
+
- `Eco::API::UseCases::BaseIO`
|
40
|
+
- `output` can be set on initialization
|
41
|
+
- `#new` carries the `output` as well.
|
42
|
+
- `Eco::API::Session::Config::Workflow`
|
43
|
+
- `#run`
|
44
|
+
- workflow blocks don't require to explicitly return the `BaseIO` when there isn't any to return. It will just keep the `io` as it was before the call.
|
45
|
+
- also made it so the returned io is **always** an **instance of** `Eco::API::UseCases::BaseIO` (so it won't return an instance of a child class). This change can be considered a fix. **Aside note:** only possible now that `output` is carried on through objects of type (so there's there's no data loss in the calls chain) `Eco::API::UseCases::BaseIO` (i.e. `io.new`)
|
46
|
+
- `#for`
|
47
|
+
- **now** it only requires a `block` if no `key` is provided
|
48
|
+
- `Eco::Data::Locations::NodeBase::TagValidations`
|
49
|
+
- made module re-usable, by removing dependency on `clean_id` method.
|
50
|
+
- Improved the **patch** on exception that adds method `#patch_full_message`
|
51
|
+
- Parameter `trace_count` added (`default: -1` for full trace)
|
52
|
+
|
53
|
+
### Fixed
|
54
|
+
- `Eco::Data::Locations::NodeBase::Treeify`
|
55
|
+
- **bug** on strings and interpolation when building the warning/error messages
|
56
|
+
- **added** detection and _warnings_ for **unlinked parents**: as `get_children` is called from the top via `nil` (those that are top level nodes), and all the call chain to collect children goes through their `parent_id` relationship.
|
57
|
+
- If the input nodes had some where there's no direct link between `nil` and a node `id` that is a `parent_id`, `parents[node.id]` would never be called. Meaning that in an input with a list of nodes, there could be clusters of subtrees that do not add/link to the top level (`nil`).
|
58
|
+
- It now gathers those separated subtrees in an `Array` parameter called `unlinked_trees`
|
59
|
+
- `Eco::API::Session::Config::Workflow`
|
60
|
+
- Returning an `Eco::API::UseCases::BaseIO` from callbacks `before`, `after` and `run` would raise an `ArgumentError`.
|
61
|
+
- **Now** the original `io` is returned otherwise the returned value is a `BaseIO`
|
62
|
+
- `Eco::API::Session::Config::Workflow`
|
63
|
+
- **changed** `open` to alias method for `with` (open was clashing)
|
64
|
+
- `Eco::API::UseCases::GraphQL::Helpers::Location::Base`
|
65
|
+
- **removed** `enviro` param for org tagtree built
|
66
|
+
- `Eco::API::UseCases::Cli::DSL`
|
67
|
+
- `::callback` was not acting like a DSL method, which would just return `nil` always (lost `block`)
|
68
|
+
- CLI arguments are unique. If a Cli class has already been run, no need to re-run it. Cli class re-usability is still not in the pipeline, and therefore, it must be run only once.
|
69
|
+
- `Eco::Data::Locations::NodePlain`
|
70
|
+
- `serializer` referred to an non existing constant.
|
71
|
+
- **IMPORTANT** `parent_id` should be `cleaned` as well. Otherwise parents with an id cleanage don't match their children's `parent_id`
|
72
|
+
- `Eco::API::Common::ClassHelpers`
|
73
|
+
- `::inerited` method must call `super` to be able to chain other calls
|
74
|
+
- `Eco::API::Common::Session::Mailer`
|
75
|
+
- The logging message was not printing who the email was sent to.
|
76
|
+
|
77
|
+
## [2.6.0] - 2024-02-03
|
78
|
+
|
79
|
+
### Added
|
80
|
+
- New use case to `-export-tree` (**tagtree extract**)
|
81
|
+
- `Eco::API::UseCases::Default::Locations::TagtreeExtract`
|
82
|
+
- `Eco::API::UseCases::UseCase`
|
83
|
+
- added `#classed_definition` to expose the original class definition
|
84
|
+
- injected further parameter as instance variables to the original class definition on run-time.
|
85
|
+
- Expose `live_trees` retrieval:
|
86
|
+
- `Eco::API::Session#live_trees`
|
87
|
+
- `Eco::API::Session::Config#live_trees`
|
88
|
+
- Ability to CLI-integrate use cases and their options via class
|
89
|
+
- `Eco::API::UseCases::Cli`
|
90
|
+
- Added use case to extract live locations structure (`-export-tree`)
|
91
|
+
- `Eco::API::UseCases::GraphQL::Cases::TagtreeExtract`
|
92
|
+
- `#api?` method to check if an API version is available
|
93
|
+
- `Eco::API::Common::Session::Environment#api?`
|
94
|
+
- `Eco::API::Common::Session::BaseSession#api?`
|
95
|
+
- `Eco::API::Organization::TagTree#merge` the merge method for tagtrees
|
96
|
+
- It allows to have all structure nodes available to check if a tag belongs to them
|
97
|
+
- `Eco::API::Session::Config::Workflow`
|
98
|
+
- **added** `open` alias method for `for`
|
99
|
+
- `Eco::Data::Mapper#self_mapped?` to check if a value maps to itself
|
100
|
+
|
101
|
+
### Changed
|
102
|
+
- upgrade `ecoportal-api-graphql`, `ecoportal-api-v2` and `ecoportal-api`
|
103
|
+
- `Eco::API::Session#tagtree`: added parameters to be able to obtain:
|
104
|
+
- `:live` live trees if graphql api is available on the enviro
|
105
|
+
- `:merge` to merge all live trees if there isn't just one
|
106
|
+
- Tagtree retrieval: remove `enviro` param where there's no caching
|
107
|
+
- Removed also from `Eco::API::Organization::TagTree::new`
|
108
|
+
- Removed some use cases:
|
109
|
+
- `Eco::API::UseCases::DefaultCases::AbstractPolicyGroupAbilities`
|
110
|
+
- `Eco::API::UseCases::DefaultCases::AppendUsergroupsCase`
|
111
|
+
- `Eco::API::UseCases::DefaultCases::CreateDetailsCase`
|
112
|
+
- `Eco::API::UseCases::DefaultCases::CreateDetailsWithSupervisorCase`
|
113
|
+
- `Eco::API::UseCases::DefaultCases::EmailAsIdCase`
|
114
|
+
- `Eco::API::UseCases::DefaultCases::NewIdCase`
|
115
|
+
- `Eco::API::UseCases::DefaultCases::RemoveAccountSyncCase`
|
116
|
+
- `Eco::API::UseCases::DefaultCases::RemoveAccountTransCase`
|
117
|
+
- `Eco::API::UseCases::DefaultCases::NewEmailCase`
|
118
|
+
- `Eco::API::UseCases::DefaultCases::SetSupervisorCase`
|
119
|
+
- `Eco::API::UseCases::DefaultCases::TagTree`
|
120
|
+
- `Eco::API::UseCases::DefaultCases::UpdateDetailsCase`
|
121
|
+
- `Eco::API::UseCases::DefaultCases::ResetLandingPageCase`
|
122
|
+
- Moved some default use cases to new namespace `Eco::API::UseCases::Default`
|
123
|
+
|
124
|
+
### Fixed
|
125
|
+
- Compatibility with `ruby 3`
|
126
|
+
- replaced `Proc.new` (with no block) by `block` in methods
|
127
|
+
- replaced `File#exists?` by `File#exist?`
|
128
|
+
- call to method's `super` not specifying args, no longer passes keyed/named args via simple splat `*` (but only double splat `**`)
|
129
|
+
- limit `nokogiri` gem to prev `1.16` (as it requires ruby 3 from thereon)
|
130
|
+
- `Eco::API::Common::People::PersonEntryAttributeMapper`
|
131
|
+
- `#aliased_attrs` was missing internal attrs that have been mapped directly as external attrs (same ext attr name as int attr name)
|
132
|
+
|
133
|
+
## [2.5.10] - 2023-11-22
|
5
134
|
|
6
|
-
### Added
|
7
|
-
### Changed
|
8
135
|
### Fixed
|
9
|
-
|
136
|
+
- `Eco::API::UseCases::DefaultCases::ReinviteSyncCase` remove unnecessary additional parameters on call.
|
137
|
+
- `Eco::API::Session::Config::SFTP#enviro_subpaths` provided that a current workaround can be skipped
|
10
138
|
|
11
139
|
## [2.5.9] - 2023-09-05
|
12
140
|
|
data/README.md
CHANGED
data/eco-helpers.gemspec
CHANGED
@@ -24,24 +24,28 @@ Gem::Specification.new do |spec|
|
|
24
24
|
#spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
|
27
|
-
spec.add_development_dependency "bundler", ">= 2.4.
|
28
|
-
spec.add_development_dependency "rspec", ">= 3.
|
27
|
+
spec.add_development_dependency "bundler", ">= 2.4.12", "< 3"
|
28
|
+
spec.add_development_dependency "rspec", ">= 3.12.0", "< 4"
|
29
29
|
spec.add_development_dependency "rake", ">= 13.0.3", "< 14"
|
30
|
-
spec.add_development_dependency "yard", ">= 0.9.
|
31
|
-
spec.add_development_dependency "redcarpet", ">= 3.
|
30
|
+
spec.add_development_dependency "yard", ">= 0.9.34", "< 1"
|
31
|
+
spec.add_development_dependency "redcarpet", ">= 3.6.0", "< 4"
|
32
32
|
|
33
|
-
spec.add_dependency 'ecoportal-api',
|
34
|
-
spec.add_dependency 'ecoportal-api-v2',
|
35
|
-
spec.add_dependency 'ecoportal-api-graphql', '>= 0.3.
|
36
|
-
spec.add_dependency 'aws-sdk-s3', '>= 1.
|
37
|
-
spec.add_dependency 'aws-sdk-ses', '>= 1.
|
38
|
-
spec.add_dependency 'dotenv', '>= 2.
|
39
|
-
spec.add_dependency 'net-
|
40
|
-
spec.add_dependency '
|
33
|
+
spec.add_dependency 'ecoportal-api', '>= 0.9.6', '< 0.10'
|
34
|
+
spec.add_dependency 'ecoportal-api-v2', '>= 1.1.5', '< 1.2'
|
35
|
+
spec.add_dependency 'ecoportal-api-graphql', '>= 0.3.13', '< 0.4'
|
36
|
+
spec.add_dependency 'aws-sdk-s3', '>= 1.142.0', '< 2'
|
37
|
+
spec.add_dependency 'aws-sdk-ses', '>= 1.58.0', '< 2'
|
38
|
+
spec.add_dependency 'dotenv', '>= 2.8.1', '< 3'
|
39
|
+
spec.add_dependency 'net-ssh', '>= 7.2.1', '< 8'
|
40
|
+
spec.add_dependency 'net-sftp', '>= 4.0.0', '< 5'
|
41
|
+
spec.add_dependency 'hashdiff', '>= 1.1.0', '< 1.2'
|
41
42
|
spec.add_dependency 'fuzzy_match', '>= 2.1.0', '< 2.2'
|
42
|
-
spec.add_dependency 'amatch', '>= 0.4.
|
43
|
-
spec.add_dependency 'jaro_winkler', '>= 1.5.
|
44
|
-
spec.add_dependency '
|
43
|
+
spec.add_dependency 'amatch', '>= 0.4.1', '< 0.5'
|
44
|
+
spec.add_dependency 'jaro_winkler', '>= 1.5.6', '< 1.6'
|
45
|
+
spec.add_dependency 'nokogiri', '>= 1.13', '< 1.17'
|
46
|
+
spec.add_dependency 'roo', '>= 2.10.1', '< 2.11'
|
45
47
|
spec.add_dependency 'roo-xls', '>= 1.2.0', '< 1.3'
|
46
|
-
spec.add_dependency '
|
48
|
+
spec.add_dependency 'fast_excel', '>= 0.5.0', '< 0.6'
|
49
|
+
spec.add_dependency 'docx', '>= 0.8.0', '< 0.9'
|
50
|
+
spec.add_dependency 'rubyzip', '>= 2.3.2', '< 2.4'
|
47
51
|
end
|
@@ -129,13 +129,13 @@ module Eco
|
|
129
129
|
# - mutating methods would reflect the changes on other classes as well
|
130
130
|
# - therefore, `freeze` will be called on the values that are inherited.
|
131
131
|
def inherited(subclass)
|
132
|
+
super
|
132
133
|
inheritable_class_vars.each do |var|
|
133
134
|
instance_var = instance_variable_name(var)
|
134
135
|
value = instance_variable_get(instance_var)
|
135
136
|
subclass.instance_variable_set(instance_var, value.freeze)
|
136
137
|
end
|
137
138
|
end
|
138
|
-
|
139
139
|
end
|
140
140
|
end
|
141
141
|
end
|
@@ -30,10 +30,6 @@ module Eco
|
|
30
30
|
raise "You should implement this method"
|
31
31
|
end
|
32
32
|
|
33
|
-
def name
|
34
|
-
self.class.name
|
35
|
-
end
|
36
|
-
|
37
33
|
private
|
38
34
|
|
39
35
|
def session
|
@@ -54,11 +50,8 @@ module Eco
|
|
54
50
|
|
55
51
|
def abort(msg, raising: true)
|
56
52
|
logger.error(msg)
|
57
|
-
if raising
|
58
|
-
|
59
|
-
else
|
60
|
-
exit(1)
|
61
|
-
end
|
53
|
+
raise msg if raising
|
54
|
+
exit 1
|
62
55
|
end
|
63
56
|
end
|
64
57
|
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
class Eco::API::Common::Loaders::Workflow::Mailer < Eco::API::Common::Loaders::Workflow
|
2
|
+
ORG = 'your organization'.freeze
|
3
|
+
TRACE_COUNT = 3
|
4
|
+
|
5
|
+
inheritable_class_vars :config_block
|
6
|
+
|
7
|
+
config_block do
|
8
|
+
puts "running from class #{self}"
|
9
|
+
exception do |err, io|
|
10
|
+
self.error = err
|
11
|
+
log(:debug) { err.patch_full_message }
|
12
|
+
workflow.run(:close, io: io)
|
13
|
+
end
|
14
|
+
|
15
|
+
after(:close) do |_wf, io|
|
16
|
+
next if options.dig(:workflow, :no_email)
|
17
|
+
next unless session.mailer?
|
18
|
+
next if session.config.dry_run?
|
19
|
+
next unless session.config.run_mode_remote?
|
20
|
+
next unless some_update?(io) || error?
|
21
|
+
|
22
|
+
subject = base_subject
|
23
|
+
|
24
|
+
if session.job_groups.empty? && error?
|
25
|
+
subject = "#{subject} - Exception!"
|
26
|
+
session.mail(subject: subject, body: errors_n_warnings(io))
|
27
|
+
else
|
28
|
+
subject = "#{subject} & Errors" if session.job_groups.errors?
|
29
|
+
subject = "#{subject} - Exception!" if error?
|
30
|
+
|
31
|
+
msg = "#{session.summary}\n"
|
32
|
+
msg += errors_n_warnings(io)
|
33
|
+
|
34
|
+
session.mail(subject: subject, body: msg) unless msg.strip.empty?
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class << self
|
40
|
+
attr_accessor :error
|
41
|
+
|
42
|
+
def org_name
|
43
|
+
self::ORG
|
44
|
+
end
|
45
|
+
|
46
|
+
def base_subject
|
47
|
+
"#{org_name} (#{active_enviro}) at #{Time.now.iso8601}"
|
48
|
+
end
|
49
|
+
|
50
|
+
def some_update?(io)
|
51
|
+
cli.config.usecases.active(io: io).any? do |usecase, data|
|
52
|
+
[:transform, :sync].any? { |type| usecase.type == type }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def error?
|
57
|
+
!!error
|
58
|
+
end
|
59
|
+
|
60
|
+
def errors_n_warnings(io)
|
61
|
+
[error_message, log_err_n_warn(io)].join("\n")
|
62
|
+
end
|
63
|
+
|
64
|
+
def log_err_n_warn(io)
|
65
|
+
warn_errors = io.logger.cache.logs(level: [:error, :warn])
|
66
|
+
return if warn_errors.empty?
|
67
|
+
"WARNINGS & ERRORS:\n#{warn_errors.join('')}\n"
|
68
|
+
end
|
69
|
+
|
70
|
+
def error_message
|
71
|
+
error&.patch_full_message(trace_count: 3)
|
72
|
+
end
|
73
|
+
|
74
|
+
def trace_count
|
75
|
+
self::TRACE_COUNT
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class Eco::API::Common::Loaders::Config
|
2
|
+
extend Eco::API::Common::ClassHelpers
|
3
|
+
extend Eco::Language::Methods::DelegateMissing
|
4
|
+
inheritable_class_vars :delegate_missing_to
|
5
|
+
|
6
|
+
class << self
|
7
|
+
# To create samples of configurations
|
8
|
+
def config_block(&block)
|
9
|
+
return @config_block unless block_given?
|
10
|
+
@config_block = block
|
11
|
+
end
|
12
|
+
|
13
|
+
def config
|
14
|
+
ASSETS.config
|
15
|
+
end
|
16
|
+
|
17
|
+
def cli
|
18
|
+
ASSETS.cli
|
19
|
+
end
|
20
|
+
|
21
|
+
def active_enviro
|
22
|
+
config.active_enviro
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
delegate_missing_to :config
|
27
|
+
end
|
28
|
+
|
29
|
+
require_relative 'config/workflow'
|
@@ -3,7 +3,6 @@ module Eco
|
|
3
3
|
module Common
|
4
4
|
module Loaders
|
5
5
|
class Policy < Eco::API::Common::Loaders::CaseBase
|
6
|
-
|
7
6
|
def initialize(policies)
|
8
7
|
raise "Expected Eco::API::Policies. Given #{policies.class}" unless policies.is_a?(Eco::API::Policies)
|
9
8
|
policies.define(self.name, &self.method(:main))
|
@@ -17,7 +16,6 @@ module Eco
|
|
17
16
|
def main(people, session, options, policy, job)
|
18
17
|
raise "You should implement this method"
|
19
18
|
end
|
20
|
-
|
21
19
|
end
|
22
20
|
end
|
23
21
|
end
|
@@ -11,9 +11,31 @@ module Eco
|
|
11
11
|
end
|
12
12
|
@type = value
|
13
13
|
end
|
14
|
+
|
15
|
+
def cli!
|
16
|
+
cli&.apply!
|
17
|
+
end
|
18
|
+
|
19
|
+
def cli(cli_class = nil)
|
20
|
+
if cli_class.is_a?(Class)
|
21
|
+
raise ArgumentError, "cli_class should inherit from Eco::API::UseCases::Cli" unless cli_class < Eco::API::UseCases::Cli
|
22
|
+
@cli = cli_class
|
23
|
+
elsif cli_class.nil?
|
24
|
+
return @cli if instance_variable_defined?(:@cli) && !@cli.nil?
|
25
|
+
# try to see if it's namespaced after the use case it provisions cli integration
|
26
|
+
begin
|
27
|
+
try_class = [self.to_s, 'Cli'].join('::')
|
28
|
+
@cli = Kernel.const_get(try_class)
|
29
|
+
rescue NameError
|
30
|
+
nil
|
31
|
+
end
|
32
|
+
else
|
33
|
+
raise ArgumentError, "Expecting a class. Given: #{cli_class.class} object"
|
34
|
+
end
|
35
|
+
end
|
14
36
|
end
|
15
37
|
|
16
|
-
inheritable_class_vars :type
|
38
|
+
inheritable_class_vars :type, :cli
|
17
39
|
|
18
40
|
def initialize(usecases)
|
19
41
|
raise "Expected Eco::API::UseCases. Given #{usecases.class}" unless usecases.is_a?(Eco::API::UseCases)
|
@@ -33,6 +55,10 @@ module Eco
|
|
33
55
|
def type
|
34
56
|
self.class.type
|
35
57
|
end
|
58
|
+
|
59
|
+
def cli_apply!
|
60
|
+
self.class.cli!
|
61
|
+
end
|
36
62
|
end
|
37
63
|
end
|
38
64
|
end
|
@@ -3,6 +3,7 @@ module Eco
|
|
3
3
|
module Common
|
4
4
|
module People
|
5
5
|
class PersonEntry
|
6
|
+
DEBUG = false
|
6
7
|
|
7
8
|
# This class is meant to provide a common interface to access entries of source data that come in different formats.
|
8
9
|
# @note
|
@@ -37,6 +38,8 @@ module Eco
|
|
37
38
|
@mapped_entry = __mapped_entry(@internal_entry)
|
38
39
|
@external_entry = __external_entry(@mapped_entry)
|
39
40
|
end
|
41
|
+
|
42
|
+
(print_models; exit(1)) if DEBUG
|
40
43
|
end
|
41
44
|
|
42
45
|
# Generates a new entry
|