pathway 0.9.1 → 0.10.0
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/.circleci/config.yml +21 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/lib/pathway.rb +1 -1
- data/lib/pathway/plugins/dry_validation.rb +10 -6
- data/lib/pathway/plugins/sequel_models.rb +25 -13
- data/lib/pathway/rspec/matchers/fail_on.rb +3 -3
- data/lib/pathway/version.rb +1 -1
- data/pathway.gemspec +2 -2
- metadata +12 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 106b1a46d50cb3c4c01ec2e10a8c052990c383fba98e04ded0fe5699fc34cc0d
|
4
|
+
data.tar.gz: f700e70d0c8323abc370ce9c8fd990d93950af649d909f5b363f945cd4ac495f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f26b55deb5bb9eebd99cfde249326c8b4151389366975b7a34c5b8038fe519d59598fc5f4bfc5a02c5c45f698628ff0fd7c179efebf775c7887c6efc53c22c0
|
7
|
+
data.tar.gz: f18b3b945bd8fa15f2c06f25a6482a877b428828bf153a8241b4e7a031ca4cacddb8abde032c1232d23e7f73cac4cd48492ab05dfa8b0eb1a80377fe70003476
|
@@ -0,0 +1,21 @@
|
|
1
|
+
version: 2
|
2
|
+
jobs:
|
3
|
+
build:
|
4
|
+
working_directory: ~/pabloh/pathway
|
5
|
+
docker:
|
6
|
+
- image: circleci/ruby:2.5.7
|
7
|
+
steps:
|
8
|
+
- checkout
|
9
|
+
# Restore bundle cache
|
10
|
+
- type: cache-restore
|
11
|
+
key: pathway-{{ checksum "Gemfile.lock" }}
|
12
|
+
# Bundle install dependencies
|
13
|
+
- run: bundle install --path vendor/bundle
|
14
|
+
# Store bundle cache
|
15
|
+
- type: cache-save
|
16
|
+
key: pathway-{{ checksum "Gemfile.lock" }}
|
17
|
+
paths:
|
18
|
+
- vendor/bundle
|
19
|
+
# Run rspec
|
20
|
+
- type: shell
|
21
|
+
command: bundle exec rspec --format documentation --color --format progress spec
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## [0.10.0] - 2019-10-06
|
2
|
+
### Changed
|
3
|
+
- Restrict support for `dry-validation` from 0.11.0 up to (excluding) 1.0.0
|
4
|
+
- Changed behavior for `:transaction` step wrapper, on `:sequel_models` plugin, to allow to take a single step name instead of block.
|
5
|
+
- Changed behavior for `:after_commit` step wrapper, on `:sequel_models` plugin, to allow to take a single step name instead of block.
|
6
|
+
|
1
7
|
## [0.9.1] - 2019-02-18
|
2
8
|
### Changed
|
3
9
|
- Various improvements on documentation and gemspec.
|
data/Gemfile
CHANGED
data/lib/pathway.rb
CHANGED
@@ -76,24 +76,28 @@ module Pathway
|
|
76
76
|
operation.auto_wire_options = auto_wire_options
|
77
77
|
end
|
78
78
|
|
79
|
-
if Gem.loaded_specs['dry-validation'].version
|
80
|
-
|
79
|
+
if Gem.loaded_specs['dry-validation'].version < Gem::Version.new('0.11')
|
80
|
+
fail "unsupported dry-validation gem version"
|
81
|
+
elsif Gem.loaded_specs['dry-validation'].version < Gem::Version.new('0.12')
|
82
|
+
DefaultFormClass = Dry::Validation::Schema::Form
|
81
83
|
|
82
84
|
module ClassMethods
|
83
85
|
private
|
84
86
|
def _block_definition(base, opts, &block)
|
85
|
-
Dry::Validation.
|
87
|
+
Dry::Validation.Form(_form_class(base), _form_opts(opts), &block)
|
86
88
|
end
|
87
89
|
end
|
88
|
-
|
89
|
-
DefaultFormClass = Dry::Validation::Schema::
|
90
|
+
elsif Gem.loaded_specs['dry-validation'].version < Gem::Version.new('1.0')
|
91
|
+
DefaultFormClass = Dry::Validation::Schema::Params
|
90
92
|
|
91
93
|
module ClassMethods
|
92
94
|
private
|
93
95
|
def _block_definition(base, opts, &block)
|
94
|
-
Dry::Validation.
|
96
|
+
Dry::Validation.Params(_form_class(base), _form_opts(opts), &block)
|
95
97
|
end
|
96
98
|
end
|
99
|
+
else
|
100
|
+
fail 'unsupported dry-validation gem version'
|
97
101
|
end
|
98
102
|
end
|
99
103
|
end
|
@@ -4,22 +4,34 @@ module Pathway
|
|
4
4
|
module Plugins
|
5
5
|
module SequelModels
|
6
6
|
module DSLMethods
|
7
|
-
def transaction(&bl)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
def transaction(step_name = nil, &bl)
|
8
|
+
fail 'must provide a step or a block but not both' if !step_name.nil? == block_given?
|
9
|
+
|
10
|
+
if step_name
|
11
|
+
transaction { step step_name }
|
12
|
+
else
|
13
|
+
around(-> steps, _ {
|
14
|
+
db.transaction(savepoint: true) do
|
15
|
+
raise Sequel::Rollback if steps.call.failure?
|
16
|
+
end
|
17
|
+
}, &bl)
|
18
|
+
end
|
13
19
|
end
|
14
20
|
|
15
|
-
def after_commit(&bl)
|
16
|
-
|
17
|
-
dsl = self.class::DSL.new(State.new(self, state.to_h.dup), self)
|
21
|
+
def after_commit(step_name = nil, &bl)
|
22
|
+
fail 'must provide a step or a block but not both' if !step_name.nil? == block_given?
|
18
23
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
24
|
+
if step_name
|
25
|
+
after_commit { step step_name }
|
26
|
+
else
|
27
|
+
around(-> steps, state {
|
28
|
+
dsl = self.class::DSL.new(State.new(self, state.to_h.dup), self)
|
29
|
+
|
30
|
+
db.after_commit do
|
31
|
+
steps.call(dsl)
|
32
|
+
end
|
33
|
+
}, &bl)
|
34
|
+
end
|
23
35
|
end
|
24
36
|
end
|
25
37
|
|
@@ -38,20 +38,20 @@ RSpec::Matchers.define :fail_on do |input|
|
|
38
38
|
alias :and_details :details
|
39
39
|
|
40
40
|
description do
|
41
|
-
|
41
|
+
'fail' + (@type ? " with :#@type error" : '')
|
42
42
|
end
|
43
43
|
|
44
44
|
failure_message do
|
45
45
|
if !failure?
|
46
46
|
"Expected operation to fail but it didn't"
|
47
47
|
else
|
48
|
-
|
48
|
+
'Expected failed operation to ' +
|
49
49
|
as_sentence(failure_descriptions, connector: '; ', last_connector: '; and ')
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
failure_message_when_negated do
|
54
|
-
|
54
|
+
'Did not to expected operation to fail but it did'
|
55
55
|
end
|
56
56
|
|
57
57
|
def failure?
|
data/lib/pathway/version.rb
CHANGED
data/pathway.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = "https://github.com/pabloh/pathway"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
|
-
spec.metadata
|
17
|
+
spec.metadata = {
|
18
18
|
"bug_tracker_uri" => "https://github.com/pabloh/pathway/issues",
|
19
19
|
"source_code_uri" => "https://github.com/pabloh/pathway",
|
20
20
|
}
|
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_dependency "dry-inflector", ">= 0.1.0"
|
32
32
|
spec.add_dependency "contextualizer", "~> 0.0.4"
|
33
33
|
|
34
|
-
spec.add_development_dependency "dry-validation", "
|
34
|
+
spec.add_development_dependency "dry-validation", ">= 0.11", "< 1.0"
|
35
35
|
spec.add_development_dependency "bundler", ">= 1.14.0"
|
36
36
|
spec.add_development_dependency "sequel", "~> 4.46.0"
|
37
37
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pathway
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pablo Herrero
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-inflector
|
@@ -42,16 +42,22 @@ dependencies:
|
|
42
42
|
name: dry-validation
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0.11'
|
48
|
+
- - "<"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '1.0'
|
48
51
|
type: :development
|
49
52
|
prerelease: false
|
50
53
|
version_requirements: !ruby/object:Gem::Requirement
|
51
54
|
requirements:
|
52
|
-
- - "
|
55
|
+
- - ">="
|
53
56
|
- !ruby/object:Gem::Version
|
54
57
|
version: '0.11'
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.0'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: bundler
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,6 +177,7 @@ executables: []
|
|
171
177
|
extensions: []
|
172
178
|
extra_rdoc_files: []
|
173
179
|
files:
|
180
|
+
- ".circleci/config.yml"
|
174
181
|
- ".gitignore"
|
175
182
|
- ".rspec"
|
176
183
|
- CHANGELOG.md
|
@@ -221,8 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
228
|
- !ruby/object:Gem::Version
|
222
229
|
version: '0'
|
223
230
|
requirements: []
|
224
|
-
|
225
|
-
rubygems_version: 2.7.7
|
231
|
+
rubygems_version: 3.0.6
|
226
232
|
signing_key:
|
227
233
|
specification_version: 4
|
228
234
|
summary: Define your business logic in simple steps.
|