standard-procedure-plumbing 0.4.6 → 0.5.1

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: 82a3aa2f2a6718e748faf14e12dcf8df50928cfcdb19bf75641731e38122c694
4
- data.tar.gz: d13610908d60830323e6921f77628c73ce9920475086a1475f21323def38f3a3
3
+ metadata.gz: 2faeb187ecbed96767befe2d2108e62e79d9b80517d81a86b6e2078ef17da226
4
+ data.tar.gz: b1f66ca28aecbd68e167a289c42e87cf4e768fb94ab6cc7f4ef5148dfc41fa7e
5
5
  SHA512:
6
- metadata.gz: e54c7820faf040901935c80797d737cc89dd1b6c7da873621361295446b35d2dab4987dee6ee423086a9dc3a7b6fb3ce20f699a5ff92edf1c7673ef071f089f9
7
- data.tar.gz: f47b41311a3aa11fc38479d98f0fc11ce1f370f23ceea127ac44462ea7bf148c66d190662dcd05d50f955cab117b9802cd4d8bb639d747a91db8136bcda16e43
6
+ metadata.gz: 5b6d1e1401ca3acc40d412143c2835e1f84433bc07e8ebda19a5f9af27e4d6fd4d088cdf6a7e68aa1a1841159a6c3c721cda069883a5ba05b6797005e1c805a5
7
+ data.tar.gz: 1a268b957386d9f2ae2596a4924865ee646dc4baf7312c2d50dea51da98e0e3340aa1decffdbcf4307906fcfe43dffdabbfaab7f71f33636f7c8aed99877e526
data/README.md CHANGED
@@ -41,9 +41,14 @@ require 'plumbing'
41
41
  Plumbing.config mode: :async
42
42
  ```
43
43
 
44
+ ## Development
44
45
 
46
+ ### To Do
45
47
 
46
- ## Development
48
+ - [ ] Add a debouncing filter for pipes
49
+ - [ ] Pass the mode as a block parameter in `Plumbing::Spec.modes`
50
+ - [ ] Move Plumbing::Actor::Transporter to Plumbing::Transporter ?? (planning to use it outside of Plumbing so would make sense not to imply it is tied to Actors)
51
+ - [X] Ensure transporters deal with GlobalID models not being found / errors when unpacking
47
52
 
48
53
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
49
54
 
@@ -51,7 +56,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
51
56
 
52
57
  ## Contributing
53
58
 
54
- Bug reports and pull requests are welcome on GitHub at https://github.com/standard_procedure/plumbing. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/standard_procedure/plumbing/blob/main/CODE_OF_CONDUCT.md).
59
+ Bug reports and pull requests are welcome on GitHub at <https://github.com/standard_procedure/plumbing>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/standard_procedure/plumbing/blob/main/CODE_OF_CONDUCT.md).
55
60
 
56
61
  ## Code of Conduct
57
62
 
@@ -55,6 +55,9 @@ module Plumbing
55
55
 
56
56
  def unpack_string argument
57
57
  argument.start_with?("gid://") ? GlobalID::Locator.locate(argument) : argument
58
+ rescue => ex
59
+ Plumbing.config.logger.error "!!!! #{self.class}##{__callee__} - #{argument} => #{ex}"
60
+ argument
58
61
  end
59
62
  end
60
63
  end
@@ -86,7 +86,7 @@ module Plumbing
86
86
  instance_eval(&)
87
87
  nil
88
88
  rescue => ex
89
- Plumbing.config.logger.error { "!!!! #{self.class}#perform_safely => #{ex}" }
89
+ Plumbing.config.logger.error { "!!!! #{self.class}##{__callee__} => #{ex}" }
90
90
  nil
91
91
  end
92
92
  end
data/lib/plumbing/pipe.rb CHANGED
@@ -9,12 +9,12 @@ module Plumbing
9
9
  # @param event_name [String] representing the type of event this is
10
10
  # @param data [Hash] representing the event-specific data to be passed to the observers
11
11
  def notify event_name, **data
12
- Plumbing.config.logger.debug { "-> #{self.class}#notify #{event_name}" }
12
+ Plumbing.config.logger.debug { "-> #{self.class}##{__callee__} #{event_name}" }
13
13
  observers.each do |observer|
14
- Plumbing.config.logger.debug { "===> #{self.class}#dispatch #{event_name}(#{data}) to #{observer}" }
14
+ Plumbing.config.logger.debug { "===> #{self.class}#call #{event_name}(#{data}) to #{observer}" }
15
15
  observer.call event_name, data
16
16
  rescue => ex
17
- Plumbing.config.logger.error { "!!!! #{self.class}#dispatch #{event_name} => #{ex}" }
17
+ Plumbing.config.logger.error { "!!!! #{self.class}##{__callee__} #{event_name} => #{ex}" }
18
18
  ex
19
19
  end
20
20
  end
@@ -58,6 +58,5 @@ module Plumbing
58
58
 
59
59
  require_relative "pipe/filter"
60
60
  require_relative "pipe/junction"
61
-
62
61
  end
63
62
  end
@@ -1,5 +1,5 @@
1
1
  module Plumbing
2
- class Pipeline
2
+ module Pipeline
3
3
  # Validate input and output data with pre and post conditions or [Dry::Validation::Contract]s
4
4
  module Contracts
5
5
  # @param name [Symbol] the name of the precondition
@@ -41,7 +41,11 @@ module Plumbing
41
41
  end
42
42
 
43
43
  def validate_preconditions_for input
44
- failed_preconditions = pre_conditions.select { |name, validator| !validator.as(Callable).call(input) }
44
+ failed_preconditions = pre_conditions.select do |name, validator|
45
+ !validator.as(Callable).call(input)
46
+ rescue
47
+ true
48
+ end
45
49
  raise PreConditionError, failed_preconditions.keys.join(", ") if failed_preconditions.any?
46
50
  input
47
51
  end
@@ -1,5 +1,5 @@
1
1
  module Plumbing
2
- class Pipeline
2
+ module Pipeline
3
3
  # Defining the operations that will be performed on the input data
4
4
  module Operations
5
5
  # Add an operation to the pipeline
@@ -1,11 +1,13 @@
1
- require_relative "pipeline/contracts"
2
- require_relative "pipeline/operations"
3
-
4
1
  module Plumbing
2
+ require_relative "pipeline/contracts"
3
+ require_relative "pipeline/operations"
4
+
5
5
  # A chain of operations that are executed in sequence
6
- class Pipeline
7
- extend Plumbing::Pipeline::Contracts
8
- extend Plumbing::Pipeline::Operations
6
+ module Pipeline
7
+ def self.included base
8
+ base.extend Plumbing::Pipeline::Contracts
9
+ base.extend Plumbing::Pipeline::Operations
10
+ end
9
11
 
10
12
  # Start the pipeline operation with the given input
11
13
  # @param input [Object] the input data to be processed
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Plumbing
4
- VERSION = "0.4.6"
4
+ VERSION = "0.5.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standard-procedure-plumbing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rahoul Baruah
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-20 00:00:00.000000000 Z
11
+ date: 2024-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: globalid
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  requirements: []
84
- rubygems_version: 3.5.17
84
+ rubygems_version: 3.5.20
85
85
  signing_key:
86
86
  specification_version: 4
87
87
  summary: Plumbing - various pipelines for your ruby application