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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f95391a7c8c39954f8ffb8bbaa8c06294bd28c3553e595d4f91e3b44a109b3ee
4
- data.tar.gz: 22118f62ae34e871d6258a59111614e83643d6557bde5cb1fb5381edff2fcab5
3
+ metadata.gz: 106b1a46d50cb3c4c01ec2e10a8c052990c383fba98e04ded0fe5699fc34cc0d
4
+ data.tar.gz: f700e70d0c8323abc370ce9c8fd990d93950af649d909f5b363f945cd4ac495f
5
5
  SHA512:
6
- metadata.gz: 942055689e4836b0556f9b1d1b2aa010b5391c322a3948598047be7ee1b06c83e19bb026efd90f6388aed035a2c37784a26350fa991fe28cf53a7d7f91c4cf9f
7
- data.tar.gz: 971070c4f8eec9bede60e354926a7114107b68cd2ead43083c319f7de709b62dd5013294344e105e64965598865cc8d91185462e5a15c880eefee051ca9ffdd3
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
@@ -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
@@ -1,4 +1,4 @@
1
- ruby '2.5.1'
1
+ ruby '2.5.7'
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
@@ -107,7 +107,7 @@ module Pathway
107
107
  alias :wrap :result
108
108
 
109
109
  def call(*)
110
- fail "must implement at subclass"
110
+ fail 'must implement at subclass'
111
111
  end
112
112
 
113
113
  def error(type, message: nil, details: nil)
@@ -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 >= Gem::Version.new('0.12')
80
- DefaultFormClass = Dry::Validation::Schema::Params
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.Params(_form_class(base), _form_opts(opts), &block)
87
+ Dry::Validation.Form(_form_class(base), _form_opts(opts), &block)
86
88
  end
87
89
  end
88
- else
89
- DefaultFormClass = Dry::Validation::Schema::Form
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.Form(_form_class(base), _form_opts(opts), &block)
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
- around(-> steps, _ {
9
- db.transaction(savepoint: true) do
10
- raise Sequel::Rollback if steps.call.failure?
11
- end
12
- }, &bl)
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
- around(-> steps, state {
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
- db.after_commit do
20
- steps.call(dsl)
21
- end
22
- }, &bl)
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
- "fail" + (@type ? " with :#@type error" : '')
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
- "Expected failed operation to " +
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
- "Did not to expected operation to fail but it did"
54
+ 'Did not to expected operation to fail but it did'
55
55
  end
56
56
 
57
57
  def failure?
@@ -1,3 +1,3 @@
1
1
  module Pathway
2
- VERSION = '0.9.1'
2
+ VERSION = '0.10.0'
3
3
  end
@@ -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", "~> 0.11"
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.9.1
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-02-19 00:00:00.000000000 Z
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
- rubyforge_project:
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.