flows 0.2.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/{build.yml → test.yml} +5 -10
  3. data/.gitignore +9 -1
  4. data/.mdlrc +1 -1
  5. data/.reek.yml +54 -0
  6. data/.rubocop.yml +26 -7
  7. data/.rubocop_todo.yml +27 -0
  8. data/.ruby-version +1 -1
  9. data/.yardopts +1 -0
  10. data/CHANGELOG.md +81 -0
  11. data/Gemfile +0 -6
  12. data/README.md +167 -363
  13. data/Rakefile +35 -1
  14. data/bin/.rubocop.yml +5 -0
  15. data/bin/all_the_errors +55 -0
  16. data/bin/benchmark +73 -105
  17. data/bin/benchmark_cli/compare.rb +118 -0
  18. data/bin/benchmark_cli/compare/a_plus_b.rb +22 -0
  19. data/bin/benchmark_cli/compare/base.rb +45 -0
  20. data/bin/benchmark_cli/compare/command.rb +47 -0
  21. data/bin/benchmark_cli/compare/ten_steps.rb +22 -0
  22. data/bin/benchmark_cli/examples.rb +23 -0
  23. data/bin/benchmark_cli/examples/.rubocop.yml +22 -0
  24. data/bin/benchmark_cli/examples/a_plus_b/dry_do.rb +23 -0
  25. data/bin/benchmark_cli/examples/a_plus_b/dry_transaction.rb +17 -0
  26. data/bin/benchmark_cli/examples/a_plus_b/flows_do.rb +22 -0
  27. data/bin/benchmark_cli/examples/a_plus_b/flows_railway.rb +13 -0
  28. data/bin/benchmark_cli/examples/a_plus_b/flows_scp.rb +13 -0
  29. data/bin/benchmark_cli/examples/a_plus_b/flows_scp_mut.rb +13 -0
  30. data/bin/benchmark_cli/examples/a_plus_b/flows_scp_oc.rb +21 -0
  31. data/bin/benchmark_cli/examples/a_plus_b/trailblazer.rb +15 -0
  32. data/bin/benchmark_cli/examples/ten_steps/dry_do.rb +70 -0
  33. data/bin/benchmark_cli/examples/ten_steps/dry_transaction.rb +64 -0
  34. data/bin/benchmark_cli/examples/ten_steps/flows_do.rb +69 -0
  35. data/bin/benchmark_cli/examples/ten_steps/flows_railway.rb +58 -0
  36. data/bin/benchmark_cli/examples/ten_steps/flows_scp.rb +58 -0
  37. data/bin/benchmark_cli/examples/ten_steps/flows_scp_mut.rb +58 -0
  38. data/bin/benchmark_cli/examples/ten_steps/flows_scp_oc.rb +66 -0
  39. data/bin/benchmark_cli/examples/ten_steps/trailblazer.rb +60 -0
  40. data/bin/benchmark_cli/helpers.rb +12 -0
  41. data/bin/benchmark_cli/ruby.rb +15 -0
  42. data/bin/benchmark_cli/ruby/command.rb +38 -0
  43. data/bin/benchmark_cli/ruby/method_exec.rb +71 -0
  44. data/bin/benchmark_cli/ruby/self_class.rb +69 -0
  45. data/bin/benchmark_cli/ruby/structs.rb +90 -0
  46. data/bin/console +1 -0
  47. data/bin/docserver +7 -0
  48. data/bin/errors +138 -0
  49. data/bin/errors_cli/contract_error_demo.rb +49 -0
  50. data/bin/errors_cli/di_error_demo.rb +38 -0
  51. data/bin/errors_cli/flow_error_demo.rb +22 -0
  52. data/bin/errors_cli/flows_router_error_demo.rb +15 -0
  53. data/bin/errors_cli/interface_error_demo.rb +17 -0
  54. data/bin/errors_cli/oc_error_demo.rb +40 -0
  55. data/bin/errors_cli/railway_error_demo.rb +10 -0
  56. data/bin/errors_cli/result_error_demo.rb +13 -0
  57. data/bin/errors_cli/scp_error_demo.rb +17 -0
  58. data/docs/README.md +3 -187
  59. data/docs/_sidebar.md +0 -24
  60. data/docs/index.html +1 -1
  61. data/flows.gemspec +27 -2
  62. data/forspell.dict +9 -0
  63. data/lefthook.yml +9 -0
  64. data/lib/flows.rb +11 -5
  65. data/lib/flows/contract.rb +402 -0
  66. data/lib/flows/contract/array.rb +55 -0
  67. data/lib/flows/contract/case_eq.rb +43 -0
  68. data/lib/flows/contract/compose.rb +77 -0
  69. data/lib/flows/contract/either.rb +53 -0
  70. data/lib/flows/contract/error.rb +24 -0
  71. data/lib/flows/contract/hash.rb +75 -0
  72. data/lib/flows/contract/hash_of.rb +70 -0
  73. data/lib/flows/contract/helpers.rb +22 -0
  74. data/lib/flows/contract/predicate.rb +34 -0
  75. data/lib/flows/contract/transformer.rb +50 -0
  76. data/lib/flows/contract/tuple.rb +70 -0
  77. data/lib/flows/flow.rb +96 -7
  78. data/lib/flows/flow/errors.rb +29 -0
  79. data/lib/flows/flow/node.rb +132 -0
  80. data/lib/flows/flow/router.rb +29 -0
  81. data/lib/flows/flow/router/custom.rb +59 -0
  82. data/lib/flows/flow/router/errors.rb +11 -0
  83. data/lib/flows/flow/router/simple.rb +25 -0
  84. data/lib/flows/plugin.rb +15 -0
  85. data/lib/flows/plugin/dependency_injector.rb +170 -0
  86. data/lib/flows/plugin/dependency_injector/dependency.rb +24 -0
  87. data/lib/flows/plugin/dependency_injector/dependency_definition.rb +16 -0
  88. data/lib/flows/plugin/dependency_injector/dependency_list.rb +55 -0
  89. data/lib/flows/plugin/dependency_injector/errors.rb +58 -0
  90. data/lib/flows/plugin/implicit_init.rb +45 -0
  91. data/lib/flows/plugin/interface.rb +84 -0
  92. data/lib/flows/plugin/output_contract.rb +85 -0
  93. data/lib/flows/plugin/output_contract/dsl.rb +48 -0
  94. data/lib/flows/plugin/output_contract/errors.rb +74 -0
  95. data/lib/flows/plugin/output_contract/wrapper.rb +55 -0
  96. data/lib/flows/plugin/profiler.rb +114 -0
  97. data/lib/flows/plugin/profiler/injector.rb +35 -0
  98. data/lib/flows/plugin/profiler/report.rb +48 -0
  99. data/lib/flows/plugin/profiler/report/events.rb +43 -0
  100. data/lib/flows/plugin/profiler/report/flat.rb +41 -0
  101. data/lib/flows/plugin/profiler/report/flat/method_report.rb +80 -0
  102. data/lib/flows/plugin/profiler/report/raw.rb +15 -0
  103. data/lib/flows/plugin/profiler/report/tree.rb +98 -0
  104. data/lib/flows/plugin/profiler/report/tree/calculated_node.rb +116 -0
  105. data/lib/flows/plugin/profiler/report/tree/node.rb +34 -0
  106. data/lib/flows/plugin/profiler/wrapper.rb +53 -0
  107. data/lib/flows/railway.rb +140 -34
  108. data/lib/flows/railway/dsl.rb +8 -18
  109. data/lib/flows/railway/errors.rb +8 -12
  110. data/lib/flows/railway/step.rb +24 -0
  111. data/lib/flows/railway/step_list.rb +38 -0
  112. data/lib/flows/result.rb +188 -2
  113. data/lib/flows/result/do.rb +158 -16
  114. data/lib/flows/result/err.rb +12 -6
  115. data/lib/flows/result/errors.rb +29 -17
  116. data/lib/flows/result/helpers.rb +25 -3
  117. data/lib/flows/result/ok.rb +12 -6
  118. data/lib/flows/shared_context_pipeline.rb +342 -0
  119. data/lib/flows/shared_context_pipeline/dsl.rb +12 -0
  120. data/lib/flows/shared_context_pipeline/dsl/callbacks.rb +35 -0
  121. data/lib/flows/shared_context_pipeline/dsl/tracks.rb +52 -0
  122. data/lib/flows/shared_context_pipeline/errors.rb +17 -0
  123. data/lib/flows/shared_context_pipeline/mutation_step.rb +30 -0
  124. data/lib/flows/shared_context_pipeline/router_definition.rb +21 -0
  125. data/lib/flows/shared_context_pipeline/step.rb +55 -0
  126. data/lib/flows/shared_context_pipeline/track.rb +54 -0
  127. data/lib/flows/shared_context_pipeline/track_list.rb +51 -0
  128. data/lib/flows/shared_context_pipeline/wrap.rb +73 -0
  129. data/lib/flows/util.rb +17 -0
  130. data/lib/flows/util/inheritable_singleton_vars.rb +86 -0
  131. data/lib/flows/util/inheritable_singleton_vars/dup_strategy.rb +100 -0
  132. data/lib/flows/util/inheritable_singleton_vars/isolation_strategy.rb +91 -0
  133. data/lib/flows/util/prepend_to_class.rb +191 -0
  134. data/lib/flows/version.rb +1 -1
  135. metadata +253 -38
  136. data/Gemfile.lock +0 -174
  137. data/bin/demo +0 -66
  138. data/bin/examples.rb +0 -195
  139. data/bin/profile_10steps +0 -106
  140. data/bin/ruby_benchmarks +0 -26
  141. data/docs/CNAME +0 -1
  142. data/docs/contributing/benchmarks_profiling.md +0 -3
  143. data/docs/contributing/local_development.md +0 -3
  144. data/docs/flow/direct_usage.md +0 -3
  145. data/docs/flow/general_idea.md +0 -3
  146. data/docs/operation/basic_usage.md +0 -1
  147. data/docs/operation/inject_steps.md +0 -3
  148. data/docs/operation/lambda_steps.md +0 -3
  149. data/docs/operation/result_shapes.md +0 -3
  150. data/docs/operation/routing_tracks.md +0 -3
  151. data/docs/operation/wrapping_steps.md +0 -3
  152. data/docs/overview/performance.md +0 -336
  153. data/docs/railway/basic_usage.md +0 -232
  154. data/docs/result_objects/basic_usage.md +0 -196
  155. data/docs/result_objects/do_notation.md +0 -139
  156. data/lib/flows/node.rb +0 -27
  157. data/lib/flows/operation.rb +0 -52
  158. data/lib/flows/operation/builder.rb +0 -130
  159. data/lib/flows/operation/builder/build_router.rb +0 -37
  160. data/lib/flows/operation/dsl.rb +0 -93
  161. data/lib/flows/operation/errors.rb +0 -75
  162. data/lib/flows/operation/executor.rb +0 -78
  163. data/lib/flows/railway/builder.rb +0 -68
  164. data/lib/flows/railway/executor.rb +0 -23
  165. data/lib/flows/result_router.rb +0 -14
  166. data/lib/flows/router.rb +0 -22
@@ -0,0 +1,40 @@
1
+ module OCErrorDemo
2
+ class WithoutContract
3
+ include Flows::Plugin::OutputContract
4
+ end
5
+
6
+ class WithContract
7
+ include Flows::Plugin::OutputContract
8
+
9
+ success_with :ok do
10
+ hash_of(
11
+ x: Integer,
12
+ y: Integer
13
+ )
14
+ end
15
+
16
+ def call(result)
17
+ result
18
+ end
19
+ end
20
+
21
+ class << self
22
+ include Flows::Result::Helpers
23
+
24
+ def no_contract
25
+ WithoutContract.new
26
+ end
27
+
28
+ def contract_error
29
+ WithContract.new.call(ok(z: 100))
30
+ end
31
+
32
+ def status_error
33
+ WithContract.new.call(ok(:unexpeted_status, x: 1, y: 2))
34
+ end
35
+
36
+ def result_type_error
37
+ WithContract.new.call(z: 100)
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,10 @@
1
+ module RailwayErrorDemo
2
+ class MyRailway < ::Flows::Railway
3
+ end
4
+
5
+ class << self
6
+ def call
7
+ MyRailway.new
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ module ResultErrorDemo
2
+ class << self
3
+ include Flows::Result::Helpers
4
+
5
+ def success_access_error
6
+ ok(some: :data).error
7
+ end
8
+
9
+ def failure_access_error
10
+ err(some: :data).unwrap
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ module SCPErrorDemo
2
+ class MySCP < ::Flows::SharedContextPipeline; end
3
+
4
+ class NoImplSCP < ::Flows::SharedContextPipeline
5
+ step :hello
6
+ end
7
+
8
+ class << self
9
+ def no_steps
10
+ MySCP.new
11
+ end
12
+
13
+ def no_step_impl
14
+ NoImplSCP.new
15
+ end
16
+ end
17
+ end
@@ -1,197 +1,13 @@
1
1
  # Flows
2
2
 
3
- [![Build Status](https://github.com/ffloyd/flows/workflows/Build/badge.svg)](https://github.com/ffloyd/flows/actions)
3
+ [![Build Status](https://github.com/ffloyd/flows/workflows/Test/badge.svg)](https://github.com/ffloyd/flows/actions)
4
4
  [![codecov](https://codecov.io/gh/ffloyd/flows/branch/master/graph/badge.svg)](https://codecov.io/gh/ffloyd/flows)
5
5
  [![Gem Version](https://badge.fury.io/rb/flows.svg)](https://badge.fury.io/rb/flows)
6
6
 
7
7
  Small and fast ruby framework for implementing railway-like operations.
8
8
  By design it is close to [Trailblazer::Operation](http://trailblazer.to/gems/operation/2.0/) and [Dry::Transaction](https://dry-rb.org/gems/dry-transaction/),
9
- but has simpler and flexible DSLs for defining operations and matching results. Also `flows` is faster, see [Performance](overview/performance.md).
9
+ but has simpler and flexible DSLs for defining operations and matching results. Also `flows` is faster.
10
10
 
11
11
  `flows` has no production dependencies so it can be used with any framework and cannot bring dependency incompatibilities.
12
12
 
13
- ## Installation
14
-
15
- Add this line to your application's Gemfile:
16
-
17
- ```ruby
18
- gem 'flows'
19
- ```
20
-
21
- And then execute:
22
-
23
- ```sh
24
- bundle
25
- ```
26
-
27
- Or install it yourself as:
28
-
29
- ```sh
30
- gem install flows
31
- ```
32
-
33
- ## Flows::Result
34
-
35
- Wrap your data into Result Objects and use convenient matchers for making decisions:
36
-
37
- ```ruby
38
- class Example
39
- include Flows::Result::Helpers
40
-
41
- def divide(a, b)
42
- return err(:zero_division, msg: 'Division by zero is forbidden') if b.zero?
43
-
44
- result = a / b
45
-
46
- if result.negative?
47
- ok(:negative, div: result)
48
- else
49
- ok(:positive, div: result)
50
- end
51
- end
52
-
53
- def dispatch(result)
54
- case result
55
- when match_ok(:positive)
56
- puts 'Positive result: ' + result.unwrap[:div]
57
- when match_ok(:negative)
58
- puts 'Negative result: ' + result.unwrap[:div]
59
- when match_err
60
- raise result.error[:msg]
61
- end
62
- end
63
- end
64
-
65
- example = Example.new
66
-
67
- result = example.divide(4, 2)
68
-
69
- example.dispatch(result) # => Positive result: 2
70
- ```
71
-
72
- Features:
73
-
74
- * different classes for successful and failure results (`Flows::Result::Ok` and `Flows::Result::Err`)
75
- * each result has status (`:positive`, `:negative` and `:zero_division` in the provided example are result statuses)
76
- * convenient helpers for creating and matching Result Objects (`#ok`, `#err`, `#math_ok`, `#match_err`)
77
- * different data accessor for successful (`#unwrap`) and failure (`#error`) results (prevents using failure objects as successful ones)
78
- * Do Notation (like [this one](https://dry-rb.org/gems/dry-monads/1.0/do-notation/) but with a bit [different API](result_objects/do_notation.md))
79
- * result has metadata - this may be used for storing execution metadata (execution time, for example, or something for good error reporting)
80
-
81
- More details in a [Result Object Basic Usage Guide](result_objects/basic_usage.md).
82
-
83
- ## Flows::Railway
84
-
85
- Organize subsequent data transformations (result of a step becomes input for a next step or a final result):
86
-
87
- ```ruby
88
- class ExampleRailway
89
- include Flows::Railway
90
-
91
- step :validate
92
- step :add_10
93
- step :mul_2
94
-
95
- def validate(x:)
96
- return err(:invalid_type, msg: 'Invalid argument type') unless x.is_a?(Numeric)
97
-
98
- ok(x: x)
99
- end
100
-
101
- def add_10(x:)
102
- ok(x: x + 10)
103
- end
104
-
105
- def mul_2(x:)
106
- ok(x: x * 2)
107
- end
108
- end
109
-
110
- example = ExampleRailway.new
111
-
112
- example.call(x: 2)
113
- # => Flows::Result::Ok with data `{x: 24}`
114
-
115
- example.call(x: 'invalid')
116
- # => Flows::Result::Err with status `:invalid_type` and data `msg: 'Invalid argument type'`
117
- # methods `#add_10` and `#mul_2` not even executed
118
- # because Railway stops execution on a first failure result
119
- ```
120
-
121
- Features:
122
-
123
- * Good composition: `Railway` returns Result Object, step returns Result Object - so you may easily extract steps into separate `Railway`, etc.
124
- * Support for inheritance (child class may redefine steps or append new steps to the end of flow)
125
- * Less runtime overhead than in `Flows::Operaion`
126
- * Override steps implementations using dependency injection on initialization (`.new(deps: {...})`)
127
-
128
- More details in a [Railway Basic Usage Guide](railway/basic_usage.md).
129
-
130
- ## Flows::Operation
131
-
132
- If you can draw your business logic in BPMN - you can code it using Operations:
133
-
134
- ```ruby
135
- class ExampleOperation
136
- include Flows::Operation
137
-
138
- step :fetch_facebook_profile, routes(when_err => :handle_fetch_error)
139
- step :fetch_twitter_profile, routes(when_err => :handle_fetch_error)
140
- step :extract_person_data
141
-
142
- track :handle_fetch_error do
143
- step :track_fetch_error
144
- step :make_fetch_error
145
- end
146
-
147
- ok_shape :person
148
- err_shape :message
149
-
150
- def fetch_facebook_profile(email:, **)
151
- result = some_fb_fetcher(email)
152
- return err unless result
153
-
154
- ok(facebook_data: result)
155
- end
156
-
157
- def fetch_twitter_profile(email:, **)
158
- result = some_twitter_fetcher(email)
159
- return err unless result
160
-
161
- ok(twitter_data: result)
162
- end
163
-
164
- def extract_person_data(facebook_data:, twitter_data:, **)
165
- ok(person: facebook_data.merge(twitter_data))
166
- end
167
-
168
- def track_fetch_error(**)
169
- # send event to New Relic, etc.
170
- ok
171
- end
172
-
173
- def make_fetch_error(**)
174
- err(:fetch_error, message: 'Fetch error')
175
- end
176
- end
177
-
178
- operation = ExampleOperation.new
179
-
180
- operation.call(email: 'whatever@email.com')
181
- ```
182
-
183
- Features:
184
-
185
- * Superset of `Railway` - any Railway can be converted into Operation in a seconds
186
- * Result Shaping - return only data you need
187
- * Branching and Tracks - you may do even loops if you brave enough
188
- * Good Composition - because everything here returns Result Objects and receives keyword arguments (or hash) you may compose Operations and Railways without any additional effort. Generally speaking - Railway is a simplified operation.
189
-
190
- More details in a [Operation Basic Usage Guide](operation/basic_usage.md).
191
-
192
- ## Flows::Flow
193
-
194
- Railway and Operation use `Flows::Flow` under the hood to transform your step definitions into executable workflow.
195
- It's not recommended to use Flow in your business code but it's a good tool for building your own abstractions in yours libraries.
196
-
197
- More details [here](flow/general_idea.md).
13
+ Rest of the documentation will be here when v1.0.0 be released.
@@ -1,26 +1,2 @@
1
1
  * Overview
2
2
  * [Getting Started](README.md)
3
- * [Performance](overview/performance.md)
4
-
5
- * Result Objects
6
- * [Basic Usage](result_objects/basic_usage.md)
7
- * [Do Notation](result_objects/do_notation.md)
8
-
9
- * Railway
10
- * [Basic Usage](railway/basic_usage.md)
11
-
12
- * Operation
13
- * [Basics](operation/basic_usage.md)
14
- * [Result Shapes](operation/result_shapes.md)
15
- * [Routing & Tracks](operation/routing_tracks.md)
16
- * [Lambda Steps](operation/lambda_steps.md)
17
- * [Inject Steps](operation/inject_steps.md)
18
- * [Wrapping Steps](operation/wrapping_steps.md)
19
-
20
- * Flow
21
- * [General Idea](flow/general_idea.md)
22
- * [Direct Usage](flow/direct_usage.md)
23
-
24
- * Contributing
25
- * [Local Development](contributing/local_development.md)
26
- * [Benchmarks & Profiling](contributing/benchmarks_profiling.md)
@@ -2,7 +2,7 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
- <title>Flows</title>
5
+ <title>Flows - framework for your Business Logic Layer</title>
6
6
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
7
7
  <meta name="description" content="Flows documentation">
8
8
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
8
8
  spec.authors = ['Roman Kolesnev']
9
9
  spec.email = ['rvkolesnev@gmail.com']
10
10
 
11
- spec.summary = 'Ruby framework for building FSM-like data flows.'
11
+ spec.summary = 'Ruby framework for building your Business Logic Layer inside Rails and other frameworks.'
12
12
  spec.homepage = 'https://github.com/ffloyd/flows'
13
13
  spec.license = 'MIT'
14
14
 
@@ -21,27 +21,52 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ['lib']
23
23
 
24
+ spec.required_ruby_version = '>= 2.5'
25
+
26
+ # This library has no production dependencies.
27
+ # So, it will not block you from updating any dependencies in your project.
28
+ # So, don't add production dependencies.
29
+
30
+ # things that should be part of a standard library
24
31
  spec.add_development_dependency 'bundler', '~> 2.0'
25
- spec.add_development_dependency 'rake', '~> 10.0'
32
+ spec.add_development_dependency 'rake', '~> 13.0'
26
33
  spec.add_development_dependency 'rspec', '~> 3.0'
27
34
 
35
+ # Documentation is the key!
36
+ spec.add_development_dependency 'yard'
37
+
38
+ # linters to make code and documentation awesome
28
39
  spec.add_development_dependency 'forspell', '~> 0.0.8'
40
+ spec.add_development_dependency 'inch'
41
+ spec.add_development_dependency 'mdl'
42
+ spec.add_development_dependency 'reek'
29
43
  spec.add_development_dependency 'rubocop'
30
44
  spec.add_development_dependency 'rubocop-md'
31
45
  spec.add_development_dependency 'rubocop-performance'
32
46
  spec.add_development_dependency 'rubocop-rspec'
33
47
 
48
+ # let's make dubugging confortable
49
+ spec.add_development_dependency 'awesome_print'
34
50
  spec.add_development_dependency 'pry'
35
51
 
52
+ # 100% coverage does not mean that you cover everything,
53
+ # but 50% coverage means that you haven't covered half of the project.
36
54
  spec.add_development_dependency 'codecov'
37
55
  spec.add_development_dependency 'simplecov'
38
56
 
39
57
  # benchmarking tools
40
58
  spec.add_development_dependency 'benchmark-ips'
59
+ spec.add_development_dependency 'kalibera'
41
60
  spec.add_development_dependency 'ruby-prof'
42
61
  spec.add_development_dependency 'stackprof'
43
62
 
63
+ # make benchmark scripts a convinient CLI tool
64
+ spec.add_development_dependency 'gli'
65
+ spec.add_development_dependency 'rainbow'
66
+ spec.add_development_dependency 'warning' # to suppress some unhandable Ruby warnings during CLI execution
67
+
44
68
  # alternatives for comparison in benchmarking
69
+ spec.add_development_dependency 'dry-monads', '~> 1.3'
45
70
  spec.add_development_dependency 'dry-transaction'
46
71
  spec.add_development_dependency 'trailblazer-operation'
47
72
  end
@@ -6,3 +6,12 @@ linter
6
6
  linters
7
7
  matchers
8
8
  superset
9
+ lefthook
10
+ preprocessor
11
+ postprocessor
12
+ upcase
13
+ fixpoint
14
+ Megatron
15
+ homebrew
16
+ MDL
17
+ forspell
@@ -4,9 +4,18 @@ pre-commit:
4
4
  rubocop:
5
5
  glob: "{*.rb,*.md,*.gemspec,Gemfile,Rakefile}"
6
6
  run: bundle exec rubocop {staged_files}
7
+ reek:
8
+ glob: "*.rb"
9
+ exclude: "^spec|^bin"
10
+ run: bundle exec reek {staged_files}
7
11
  markdownlinter:
8
12
  glob: "*.md"
9
13
  run: bundle exec mdl {staged_files}
10
14
  forspell:
11
15
  glob: "{*.md,*.rb}"
12
16
  run: bundle exec forspell {staged_files}
17
+
18
+ pre-push:
19
+ commands:
20
+ test:
21
+ run: bundle exec rake
@@ -1,15 +1,21 @@
1
+ # Namespace for all the classes and modules of the library.
2
+ #
3
+ # @since 0.4.0
1
4
  module Flows
5
+ # Base class for all the library's errors.
6
+ #
7
+ # @since 0.4.0
2
8
  class Error < StandardError; end
3
9
  end
4
10
 
5
11
  require 'flows/version'
6
12
 
7
- require 'flows/router'
8
- require 'flows/result_router'
13
+ require 'flows/util'
14
+ require 'flows/plugin'
9
15
 
10
- require 'flows/node'
16
+ require 'flows/result'
17
+ require 'flows/contract'
11
18
  require 'flows/flow'
12
19
 
13
- require 'flows/result'
14
20
  require 'flows/railway'
15
- require 'flows/operation'
21
+ require 'flows/shared_context_pipeline'