eco-helpers 2.6.0 → 2.6.1

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +72 -4
  3. data/README.md +5 -0
  4. data/eco-helpers.gemspec +1 -1
  5. data/lib/eco/api/common/class_helpers.rb +1 -1
  6. data/lib/eco/api/common/loaders/case_base.rb +0 -2
  7. data/lib/eco/api/common/loaders/config/workflow/mailer.rb +78 -0
  8. data/lib/eco/api/common/loaders/config/workflow.rb +11 -0
  9. data/lib/eco/api/common/loaders/config.rb +29 -0
  10. data/lib/eco/api/common/loaders/error_handler.rb +0 -2
  11. data/lib/eco/api/common/loaders/parser.rb +0 -1
  12. data/lib/eco/api/common/loaders/policy.rb +0 -2
  13. data/lib/eco/api/common/loaders.rb +1 -0
  14. data/lib/eco/api/common/session/mailer.rb +3 -1
  15. data/lib/eco/api/common/version_patches/exception.rb +2 -2
  16. data/lib/eco/api/common/version_patches/ruby3/object.rb +18 -0
  17. data/lib/eco/api/common/version_patches/ruby3.rb +1 -0
  18. data/lib/eco/api/common/version_patches.rb +3 -0
  19. data/lib/eco/api/custom/config.rb +10 -0
  20. data/lib/eco/api/custom/mailer.rb +9 -0
  21. data/lib/eco/api/custom/namespace.rb +2 -0
  22. data/lib/eco/api/custom/workflow.rb +9 -0
  23. data/lib/eco/api/custom.rb +3 -0
  24. data/lib/eco/api/session/batch/base_policy.rb +13 -5
  25. data/lib/eco/api/session/batch/job.rb +10 -7
  26. data/lib/eco/api/session/config/workflow.rb +94 -58
  27. data/lib/eco/api/session/config.rb +2 -2
  28. data/lib/eco/api/usecases/base_io.rb +50 -4
  29. data/lib/eco/api/usecases/cli/dsl.rb +23 -13
  30. data/lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb +5 -0
  31. data/lib/eco/api/usecases/default/locations/tagtree_extract_case.rb +12 -4
  32. data/lib/eco/api/usecases/graphql/helpers/location/base.rb +1 -2
  33. data/lib/eco/api/usecases/ooze_samples/register_update_case.rb +3 -3
  34. data/lib/eco/api/usecases/use_case.rb +12 -2
  35. data/lib/eco/assets.rb +2 -2
  36. data/lib/eco/cli_default/workflow.rb +102 -120
  37. data/lib/eco/data/locations/node_base/tag_validations.rb +19 -9
  38. data/lib/eco/data/locations/node_base/treeify.rb +193 -18
  39. data/lib/eco/data/locations/node_level.rb +1 -1
  40. data/lib/eco/data/locations/node_plain/parsing.rb +1 -1
  41. data/lib/eco/data/locations/node_plain/serial.rb +1 -1
  42. data/lib/eco/data/locations/node_plain.rb +4 -3
  43. data/lib/eco/language/klass/when_inherited.rb +17 -0
  44. data/lib/eco/language/klass.rb +8 -0
  45. data/lib/eco/language/methods/delegate_missing.rb +28 -0
  46. data/lib/eco/language/methods/dsl_able.rb +25 -0
  47. data/lib/eco/language/methods.rb +9 -0
  48. data/lib/eco/language.rb +2 -0
  49. data/lib/eco/version.rb +1 -1
  50. metadata +16 -3
@@ -15,7 +15,7 @@ module Eco::Data::Locations
15
15
  PROP_ATTRS = ALL_ATTRS - ADDITIONAL_ATTRS
16
16
 
17
17
  def id
18
- clean_id(super)
18
+ clean_id(super, ref: "(Row: #{self.row_num}) ")
19
19
  end
20
20
  # backwards compatibility
21
21
  alias_method :tag, :id
@@ -24,8 +24,9 @@ module Eco::Data::Locations
24
24
  super || self.id
25
25
  end
26
26
 
27
- def parentId
28
- self.parent_id
27
+ def parent_id
28
+ clean_id(super, notify: false, ref: "(Row: #{self.row_num} - parent_id) ")
29
29
  end
30
+ alias_method :parentId, :parent_id
30
31
  end
31
32
  end
@@ -0,0 +1,17 @@
1
+ module Eco
2
+ module Language
3
+ module Klass
4
+ module WhenInherited
5
+ def inherited(subclass)
6
+ super
7
+ subclass.instance_exec(&when_inherited)
8
+ end
9
+
10
+ def when_inherited(&block)
11
+ return @when_inherited unless block_given?
12
+ @when_inherited = block
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,8 @@
1
+ module Eco
2
+ module Language
3
+ module Klass
4
+ end
5
+ end
6
+ end
7
+
8
+ require_relative 'klass/when_inherited'
@@ -0,0 +1,28 @@
1
+ module Eco
2
+ module Language
3
+ module Methods
4
+ module DelegateMissing
5
+ def delegate_missing_to(meth)
6
+ @delegate_missing_to = meth
7
+ end
8
+
9
+ def method_missing(method_name, *args, **kargs, &block)
10
+ super unless receiver = object_missing_delegated_to
11
+ receiver.send(method_name, *args, **kargs, &block)
12
+ end
13
+
14
+ def respond_to_missing?(method_name, include_private = false)
15
+ super
16
+ end
17
+
18
+ private
19
+
20
+ # retrieve the delegate_missing_to object
21
+ def object_missing_delegated_to
22
+ return nil unless @delegate_missing_to
23
+ self.method(@delegate_missing_to).call
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,25 @@
1
+ module Eco
2
+ module Language
3
+ module Methods
4
+ module DslAble
5
+ # It runs the `block` within this object context
6
+ # @note if the object misses any method, redirects the method to the
7
+ # original evaluate caller.
8
+ def evaluate(*args, **kargs, &block)
9
+ return unless block_given?
10
+ @self_before_evaluate = eval "self", block.binding
11
+ instance_exec(*args, **kargs, &block).tap do
12
+ @self_before_evaluate = nil
13
+ end
14
+ end
15
+
16
+ # When it's the case, redirect to the original `evaluate` caller
17
+ # @see https://www.dan-manges.com/blog/ruby-dsls-instance-eval-with-delegation
18
+ def method_missing(method, *args, **kargs, &block)
19
+ super unless @self_before_evaluate
20
+ @self_before_evaluate.send(method, *args, **kargs, &block)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,9 @@
1
+ module Eco
2
+ module Language
3
+ module Methods
4
+ end
5
+ end
6
+ end
7
+
8
+ require_relative 'methods/dsl_able'
9
+ require_relative 'methods/delegate_missing'
data/lib/eco/language.rb CHANGED
@@ -3,6 +3,8 @@ module Eco
3
3
  end
4
4
  end
5
5
 
6
+ require_relative 'language/klass'
7
+ require_relative 'language/methods'
6
8
  require_relative 'language/models'
7
9
  require_relative 'language/auxiliar_logger'
8
10
  require_relative 'language/basic_logger'
data/lib/eco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = "2.6.0"
2
+ VERSION = "2.6.1"
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.6.0
4
+ version: 2.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura
@@ -359,7 +359,7 @@ dependencies:
359
359
  version: '1.13'
360
360
  - - "<"
361
361
  - !ruby/object:Gem::Version
362
- version: '1.16'
362
+ version: '1.17'
363
363
  type: :runtime
364
364
  prerelease: false
365
365
  version_requirements: !ruby/object:Gem::Requirement
@@ -369,7 +369,7 @@ dependencies:
369
369
  version: '1.13'
370
370
  - - "<"
371
371
  - !ruby/object:Gem::Version
372
- version: '1.16'
372
+ version: '1.17'
373
373
  - !ruby/object:Gem::Dependency
374
374
  name: roo
375
375
  requirement: !ruby/object:Gem::Requirement
@@ -496,6 +496,9 @@ files:
496
496
  - lib/eco/api/common/loaders.rb
497
497
  - lib/eco/api/common/loaders/base.rb
498
498
  - lib/eco/api/common/loaders/case_base.rb
499
+ - lib/eco/api/common/loaders/config.rb
500
+ - lib/eco/api/common/loaders/config/workflow.rb
501
+ - lib/eco/api/common/loaders/config/workflow/mailer.rb
499
502
  - lib/eco/api/common/loaders/error_handler.rb
500
503
  - lib/eco/api/common/loaders/parser.rb
501
504
  - lib/eco/api/common/loaders/policy.rb
@@ -542,12 +545,17 @@ files:
542
545
  - lib/eco/api/common/version_patches/hash.rb
543
546
  - lib/eco/api/common/version_patches/hash/deep_merge.rb
544
547
  - lib/eco/api/common/version_patches/object.rb
548
+ - lib/eco/api/common/version_patches/ruby3.rb
549
+ - lib/eco/api/common/version_patches/ruby3/object.rb
545
550
  - lib/eco/api/custom.rb
551
+ - lib/eco/api/custom/config.rb
546
552
  - lib/eco/api/custom/error_handler.rb
553
+ - lib/eco/api/custom/mailer.rb
547
554
  - lib/eco/api/custom/namespace.rb
548
555
  - lib/eco/api/custom/parser.rb
549
556
  - lib/eco/api/custom/policy.rb
550
557
  - lib/eco/api/custom/use_case.rb
558
+ - lib/eco/api/custom/workflow.rb
551
559
  - lib/eco/api/error.rb
552
560
  - lib/eco/api/error/handler.rb
553
561
  - lib/eco/api/error/handlers.rb
@@ -781,8 +789,13 @@ files:
781
789
  - lib/eco/language/curry.rb
782
790
  - lib/eco/language/hash_transform.rb
783
791
  - lib/eco/language/hash_transform_modifier.rb
792
+ - lib/eco/language/klass.rb
793
+ - lib/eco/language/klass/when_inherited.rb
784
794
  - lib/eco/language/match.rb
785
795
  - lib/eco/language/match_modifier.rb
796
+ - lib/eco/language/methods.rb
797
+ - lib/eco/language/methods/delegate_missing.rb
798
+ - lib/eco/language/methods/dsl_able.rb
786
799
  - lib/eco/language/models.rb
787
800
  - lib/eco/language/models/class_helpers.rb
788
801
  - lib/eco/language/models/collection.rb