pathway 1.0.0 → 1.2.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/.github/workflows/tests.yml +2 -2
- data/CHANGELOG.md +17 -0
- data/bin/bundle +109 -0
- data/bin/byebug +13 -3
- data/bin/coderay +27 -0
- data/bin/erb +27 -0
- data/bin/htmldiff +27 -0
- data/bin/irb +27 -0
- data/bin/ldiff +27 -0
- data/bin/pry +27 -0
- data/bin/rake +13 -3
- data/bin/rbs +27 -0
- data/bin/rdbg +27 -0
- data/bin/rdoc +27 -0
- data/bin/ri +27 -0
- data/bin/rspec +13 -3
- data/bin/ruby-lsp +27 -0
- data/bin/ruby-lsp-check +27 -0
- data/bin/ruby-lsp-launcher +27 -0
- data/bin/ruby-lsp-test-exec +27 -0
- data/bin/sequel +27 -0
- data/bin/yard +27 -0
- data/bin/yardoc +27 -0
- data/bin/yri +27 -0
- data/lib/pathway/plugins/dry_validation.rb +10 -19
- data/lib/pathway/plugins/responder.rb +2 -2
- data/lib/pathway/plugins/sequel_models.rb +31 -21
- data/lib/pathway/result.rb +2 -2
- data/lib/pathway/version.rb +1 -1
- data/lib/pathway.rb +30 -15
- data/pathway.gemspec +2 -2
- metadata +25 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a13868cae6ff80203b023cdb1444609565f0004f0a2cab229997c01cbaa3aaa5
|
|
4
|
+
data.tar.gz: c22500510ef22c61cf9e11beba23455287b38539f35c21a3e9c082f498e7ba0b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 00012d3079c7487ca627bebcb24b5164dd08012082f40d7765bb0bb23a2e0210a9583ea18fa71fdd5f2c69be93d171459fe9ad5f159250bc46c67425fe7b4dd3
|
|
7
|
+
data.tar.gz: 2c9557ffc6243159ff110a2e91d6017646020e05f990a1b3158ee46ccb1b2948993c085b06051a5eb9ea1eaa36ef3fb86b4858725fbb4966a9a2797bf0abf58e
|
data/.github/workflows/tests.yml
CHANGED
|
@@ -11,7 +11,7 @@ jobs:
|
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
12
|
strategy:
|
|
13
13
|
matrix:
|
|
14
|
-
ruby-version: [3.
|
|
14
|
+
ruby-version: [3.2, 3.3, 3.4]
|
|
15
15
|
steps:
|
|
16
16
|
- uses: actions/checkout@v3
|
|
17
17
|
- name: Set up Ruby
|
|
@@ -23,7 +23,7 @@ jobs:
|
|
|
23
23
|
- name: Run tests
|
|
24
24
|
run: bundle exec rake
|
|
25
25
|
- name: Coveralls GitHub Action
|
|
26
|
-
if: matrix.ruby-version == '3.
|
|
26
|
+
if: matrix.ruby-version == '3.4'
|
|
27
27
|
uses: coverallsapp/github-action@v2
|
|
28
28
|
with:
|
|
29
29
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## [1.2.0] - 2025-11-16
|
|
2
|
+
### Deprecated
|
|
3
|
+
- Deprecate passing a block to the step method using `DSLMethods#step`
|
|
4
|
+
- Deprecate passing a block to the step method using `DSLMethods#set`
|
|
5
|
+
- Deprecate `DSLMethods#map`
|
|
6
|
+
### Changed
|
|
7
|
+
- Removed deprecated `:auto_wire_options` option from `:dry_validation` plugin
|
|
8
|
+
|
|
9
|
+
## [1.1.0] - 2025-05-30
|
|
10
|
+
### Added
|
|
11
|
+
- Added `:if` and `:unless` options for `:transaction` and `:after_commit` methods at `:sequel_models` plugin
|
|
12
|
+
- Added `:after_rollback` method at `:sequel_models` plugin
|
|
13
|
+
### Fixed
|
|
14
|
+
- Fixed bug where setting a callback inside an `around` block could unexpectedly change the operation's result
|
|
15
|
+
### Changed
|
|
16
|
+
- Removed support for `Ruby` 3.1
|
|
17
|
+
|
|
1
18
|
## [1.0.0] - 2025-05-19
|
|
2
19
|
### Changed
|
|
3
20
|
- Removed support for `Ruby` versions older than 3.0
|
data/bin/bundle
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'bundle' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
require "rubygems"
|
|
12
|
+
|
|
13
|
+
m = Module.new do
|
|
14
|
+
module_function
|
|
15
|
+
|
|
16
|
+
def invoked_as_script?
|
|
17
|
+
File.expand_path($0) == File.expand_path(__FILE__)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def env_var_version
|
|
21
|
+
ENV["BUNDLER_VERSION"]
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def cli_arg_version
|
|
25
|
+
return unless invoked_as_script? # don't want to hijack other binstubs
|
|
26
|
+
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
|
27
|
+
bundler_version = nil
|
|
28
|
+
update_index = nil
|
|
29
|
+
ARGV.each_with_index do |a, i|
|
|
30
|
+
if update_index && update_index.succ == i && a.match?(Gem::Version::ANCHORED_VERSION_PATTERN)
|
|
31
|
+
bundler_version = a
|
|
32
|
+
end
|
|
33
|
+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
|
34
|
+
bundler_version = $1
|
|
35
|
+
update_index = i
|
|
36
|
+
end
|
|
37
|
+
bundler_version
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def gemfile
|
|
41
|
+
gemfile = ENV["BUNDLE_GEMFILE"]
|
|
42
|
+
return gemfile if gemfile && !gemfile.empty?
|
|
43
|
+
|
|
44
|
+
File.expand_path("../Gemfile", __dir__)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def lockfile
|
|
48
|
+
lockfile =
|
|
49
|
+
case File.basename(gemfile)
|
|
50
|
+
when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
|
|
51
|
+
else "#{gemfile}.lock"
|
|
52
|
+
end
|
|
53
|
+
File.expand_path(lockfile)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def lockfile_version
|
|
57
|
+
return unless File.file?(lockfile)
|
|
58
|
+
lockfile_contents = File.read(lockfile)
|
|
59
|
+
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
|
60
|
+
Regexp.last_match(1)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def bundler_requirement
|
|
64
|
+
@bundler_requirement ||=
|
|
65
|
+
env_var_version ||
|
|
66
|
+
cli_arg_version ||
|
|
67
|
+
bundler_requirement_for(lockfile_version)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def bundler_requirement_for(version)
|
|
71
|
+
return "#{Gem::Requirement.default}.a" unless version
|
|
72
|
+
|
|
73
|
+
bundler_gem_version = Gem::Version.new(version)
|
|
74
|
+
|
|
75
|
+
bundler_gem_version.approximate_recommendation
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def load_bundler!
|
|
79
|
+
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
|
80
|
+
|
|
81
|
+
activate_bundler
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def activate_bundler
|
|
85
|
+
gem_error = activation_error_handling do
|
|
86
|
+
gem "bundler", bundler_requirement
|
|
87
|
+
end
|
|
88
|
+
return if gem_error.nil?
|
|
89
|
+
require_error = activation_error_handling do
|
|
90
|
+
require "bundler/version"
|
|
91
|
+
end
|
|
92
|
+
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
|
93
|
+
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
|
94
|
+
exit 42
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def activation_error_handling
|
|
98
|
+
yield
|
|
99
|
+
nil
|
|
100
|
+
rescue StandardError, LoadError => e
|
|
101
|
+
e
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
m.load_bundler!
|
|
106
|
+
|
|
107
|
+
if m.invoked_as_script?
|
|
108
|
+
load Gem.bin_path("bundler", "bundle")
|
|
109
|
+
end
|
data/bin/byebug
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# frozen_string_literal: true
|
|
3
|
+
|
|
3
4
|
#
|
|
4
5
|
# This file was generated by Bundler.
|
|
5
6
|
#
|
|
@@ -7,9 +8,18 @@
|
|
|
7
8
|
# this file is here to facilitate running it.
|
|
8
9
|
#
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
13
23
|
|
|
14
24
|
require "rubygems"
|
|
15
25
|
require "bundler/setup"
|
data/bin/coderay
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'coderay' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
require "rubygems"
|
|
25
|
+
require "bundler/setup"
|
|
26
|
+
|
|
27
|
+
load Gem.bin_path("coderay", "coderay")
|
data/bin/erb
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'erb' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
require "rubygems"
|
|
25
|
+
require "bundler/setup"
|
|
26
|
+
|
|
27
|
+
load Gem.bin_path("erb", "erb")
|
data/bin/htmldiff
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'htmldiff' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
require "rubygems"
|
|
25
|
+
require "bundler/setup"
|
|
26
|
+
|
|
27
|
+
load Gem.bin_path("diff-lcs", "htmldiff")
|
data/bin/irb
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'irb' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
require "rubygems"
|
|
25
|
+
require "bundler/setup"
|
|
26
|
+
|
|
27
|
+
load Gem.bin_path("irb", "irb")
|
data/bin/ldiff
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'ldiff' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
require "rubygems"
|
|
25
|
+
require "bundler/setup"
|
|
26
|
+
|
|
27
|
+
load Gem.bin_path("diff-lcs", "ldiff")
|
data/bin/pry
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'pry' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
require "rubygems"
|
|
25
|
+
require "bundler/setup"
|
|
26
|
+
|
|
27
|
+
load Gem.bin_path("pry", "pry")
|
data/bin/rake
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# frozen_string_literal: true
|
|
3
|
+
|
|
3
4
|
#
|
|
4
5
|
# This file was generated by Bundler.
|
|
5
6
|
#
|
|
@@ -7,9 +8,18 @@
|
|
|
7
8
|
# this file is here to facilitate running it.
|
|
8
9
|
#
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
13
23
|
|
|
14
24
|
require "rubygems"
|
|
15
25
|
require "bundler/setup"
|
data/bin/rbs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'rbs' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
require "rubygems"
|
|
25
|
+
require "bundler/setup"
|
|
26
|
+
|
|
27
|
+
load Gem.bin_path("rbs", "rbs")
|
data/bin/rdbg
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'rdbg' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
require "rubygems"
|
|
25
|
+
require "bundler/setup"
|
|
26
|
+
|
|
27
|
+
load Gem.bin_path("debug", "rdbg")
|
data/bin/rdoc
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'rdoc' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
require "rubygems"
|
|
25
|
+
require "bundler/setup"
|
|
26
|
+
|
|
27
|
+
load Gem.bin_path("rdoc", "rdoc")
|
data/bin/ri
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'ri' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
require "rubygems"
|
|
25
|
+
require "bundler/setup"
|
|
26
|
+
|
|
27
|
+
load Gem.bin_path("rdoc", "ri")
|
data/bin/rspec
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# frozen_string_literal: true
|
|
3
|
+
|
|
3
4
|
#
|
|
4
5
|
# This file was generated by Bundler.
|
|
5
6
|
#
|
|
@@ -7,9 +8,18 @@
|
|
|
7
8
|
# this file is here to facilitate running it.
|
|
8
9
|
#
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
13
23
|
|
|
14
24
|
require "rubygems"
|
|
15
25
|
require "bundler/setup"
|
data/bin/ruby-lsp
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'ruby-lsp' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
require "rubygems"
|
|
25
|
+
require "bundler/setup"
|
|
26
|
+
|
|
27
|
+
load Gem.bin_path("ruby-lsp", "ruby-lsp")
|
data/bin/ruby-lsp-check
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'ruby-lsp-check' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
require "rubygems"
|
|
25
|
+
require "bundler/setup"
|
|
26
|
+
|
|
27
|
+
load Gem.bin_path("ruby-lsp", "ruby-lsp-check")
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'ruby-lsp-launcher' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
require "rubygems"
|
|
25
|
+
require "bundler/setup"
|
|
26
|
+
|
|
27
|
+
load Gem.bin_path("ruby-lsp", "ruby-lsp-launcher")
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'ruby-lsp-test-exec' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
require "rubygems"
|
|
25
|
+
require "bundler/setup"
|
|
26
|
+
|
|
27
|
+
load Gem.bin_path("ruby-lsp", "ruby-lsp-test-exec")
|
data/bin/sequel
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'sequel' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
require "rubygems"
|
|
25
|
+
require "bundler/setup"
|
|
26
|
+
|
|
27
|
+
load Gem.bin_path("sequel", "sequel")
|
data/bin/yard
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'yard' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
require "rubygems"
|
|
25
|
+
require "bundler/setup"
|
|
26
|
+
|
|
27
|
+
load Gem.bin_path("yard", "yard")
|
data/bin/yardoc
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'yardoc' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
require "rubygems"
|
|
25
|
+
require "bundler/setup"
|
|
26
|
+
|
|
27
|
+
load Gem.bin_path("yard", "yardoc")
|
data/bin/yri
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'yri' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
|
12
|
+
|
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
|
14
|
+
|
|
15
|
+
if File.file?(bundle_binstub)
|
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
|
17
|
+
load(bundle_binstub)
|
|
18
|
+
else
|
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
require "rubygems"
|
|
25
|
+
require "bundler/setup"
|
|
26
|
+
|
|
27
|
+
load Gem.bin_path("yard", "yri")
|
|
@@ -9,13 +9,10 @@ module Pathway
|
|
|
9
9
|
attr_reader :contract_class, :contract_options
|
|
10
10
|
attr_accessor :auto_wire
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
alias_method :auto_wire_options=, :auto_wire=
|
|
14
|
-
|
|
15
|
-
def contract(base = nil, &block)
|
|
12
|
+
def contract(base = nil, &)
|
|
16
13
|
if block_given?
|
|
17
14
|
base ||= _base_contract
|
|
18
|
-
self.contract_class = Class.new(base, &
|
|
15
|
+
self.contract_class = Class.new(base, &)
|
|
19
16
|
elsif base
|
|
20
17
|
self.contract_class = base
|
|
21
18
|
else
|
|
@@ -23,8 +20,8 @@ module Pathway
|
|
|
23
20
|
end
|
|
24
21
|
end
|
|
25
22
|
|
|
26
|
-
def params(
|
|
27
|
-
contract { params(
|
|
23
|
+
def params(...)
|
|
24
|
+
contract { params(...) }
|
|
28
25
|
end
|
|
29
26
|
|
|
30
27
|
def contract_class= klass
|
|
@@ -33,8 +30,8 @@ module Pathway
|
|
|
33
30
|
@builded_contract = @contract_options.empty? && klass.schema ? klass.new : nil
|
|
34
31
|
end
|
|
35
32
|
|
|
36
|
-
def build_contract(**
|
|
37
|
-
@builded_contract || contract_class.new(**
|
|
33
|
+
def build_contract(**)
|
|
34
|
+
@builded_contract || contract_class.new(**)
|
|
38
35
|
end
|
|
39
36
|
|
|
40
37
|
def inherited(subclass)
|
|
@@ -53,7 +50,7 @@ module Pathway
|
|
|
53
50
|
module InstanceMethods
|
|
54
51
|
extend Forwardable
|
|
55
52
|
|
|
56
|
-
delegate %i[build_contract contract_options
|
|
53
|
+
delegate %i[build_contract contract_options auto_wire] => 'self.class'
|
|
57
54
|
alias_method :contract, :build_contract
|
|
58
55
|
|
|
59
56
|
def validate(state, with: nil)
|
|
@@ -65,20 +62,14 @@ module Pathway
|
|
|
65
62
|
.then { |params| state.update(params:) }
|
|
66
63
|
end
|
|
67
64
|
|
|
68
|
-
def validate_with(input, **
|
|
69
|
-
result = contract(**
|
|
65
|
+
def validate_with(input, **)
|
|
66
|
+
result = contract(**).call(input)
|
|
70
67
|
|
|
71
68
|
result.success? ? wrap(result.values.to_h) : error(:validation, details: result.errors.to_h)
|
|
72
69
|
end
|
|
73
70
|
end
|
|
74
71
|
|
|
75
|
-
def self.apply(operation,
|
|
76
|
-
#:nocov:
|
|
77
|
-
unless auto_wire_options_was_not_used
|
|
78
|
-
warn "[DEPRECATION] `auto_wire_options` is deprecated. Please use `auto_wire` instead"
|
|
79
|
-
end
|
|
80
|
-
#:nocov:
|
|
81
|
-
|
|
72
|
+
def self.apply(operation, auto_wire: false)
|
|
82
73
|
operation.auto_wire = auto_wire
|
|
83
74
|
operation.contract_class = Dry::Validation::Contract
|
|
84
75
|
end
|
|
@@ -6,33 +6,43 @@ module Pathway
|
|
|
6
6
|
module Plugins
|
|
7
7
|
module SequelModels
|
|
8
8
|
module DSLMethods
|
|
9
|
-
def transaction(step_name = nil, &
|
|
10
|
-
|
|
9
|
+
def transaction(step_name = nil, if: nil, unless: nil, &steps)
|
|
10
|
+
_with_db_steps(steps, step_name, *_opts_if_unless(binding)) do |runner|
|
|
11
|
+
db.transaction(savepoint: true) do
|
|
12
|
+
raise Sequel::Rollback if runner.call.failure?
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
11
16
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
db.transaction(savepoint: true) do
|
|
17
|
-
raise Sequel::Rollback if runner.call.failure?
|
|
18
|
-
end
|
|
19
|
-
}, &dsl_bl)
|
|
17
|
+
def after_commit(step_name = nil, if: nil, unless: nil, &steps)
|
|
18
|
+
_with_db_steps(steps, step_name, *_opts_if_unless(binding)) do |runner, state|
|
|
19
|
+
dsl_copy = _dsl_for(state)
|
|
20
|
+
db.after_commit { runner.call(dsl_copy) }
|
|
20
21
|
end
|
|
21
22
|
end
|
|
22
23
|
|
|
23
|
-
def
|
|
24
|
-
|
|
24
|
+
def after_rollback(step_name = nil, if: nil, unless: nil, &steps)
|
|
25
|
+
_with_db_steps(steps, step_name, *_opts_if_unless(binding)) do |runner, state|
|
|
26
|
+
dsl_copy = _dsl_for(state)
|
|
27
|
+
db.after_rollback(savepoint: true) { runner.call(dsl_copy) }
|
|
28
|
+
end
|
|
29
|
+
end
|
|
25
30
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
around(->(runner, state) {
|
|
30
|
-
dsl_copy = self.class::DSL.new(State.new(self, state.to_h.dup), self)
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def _opts_if_unless(bg) = %i[if unless].map { bg.local_variable_get(_1) }
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
def _with_db_steps(steps, step_name=nil, if_cond=nil, unless_cond=nil, &db_logic)
|
|
36
|
+
raise ArgumentError, 'options :if and :unless are mutually exclusive' if if_cond && unless_cond
|
|
37
|
+
raise ArgumentError, 'must provide either a step or a block but not both' if !!step_name == !!steps
|
|
38
|
+
steps ||= proc { step step_name }
|
|
39
|
+
|
|
40
|
+
if if_cond
|
|
41
|
+
if_true(if_cond) { _with_db_steps(steps, &db_logic) }
|
|
42
|
+
elsif unless_cond
|
|
43
|
+
if_false(unless_cond) { _with_db_steps(steps, &db_logic) }
|
|
44
|
+
else
|
|
45
|
+
around(db_logic, &steps)
|
|
36
46
|
end
|
|
37
47
|
end
|
|
38
48
|
end
|
data/lib/pathway/result.rb
CHANGED
data/lib/pathway/version.rb
CHANGED
data/lib/pathway.rb
CHANGED
|
@@ -101,11 +101,10 @@ module Pathway
|
|
|
101
101
|
|
|
102
102
|
alias_method :result_at, :result_key=
|
|
103
103
|
|
|
104
|
-
def process(&
|
|
105
|
-
dsl = self::DSL
|
|
104
|
+
def process(&steps)
|
|
106
105
|
define_method(:call) do |input|
|
|
107
|
-
|
|
108
|
-
.run(&
|
|
106
|
+
_dsl_for(input:)
|
|
107
|
+
.run(&steps)
|
|
109
108
|
.then(&:result)
|
|
110
109
|
end
|
|
111
110
|
end
|
|
@@ -135,6 +134,10 @@ module Pathway
|
|
|
135
134
|
def wrap_if_present(value, type: :not_found, message: nil, details: {})
|
|
136
135
|
value.nil? ? error(type, message:, details:) : success(value)
|
|
137
136
|
end
|
|
137
|
+
|
|
138
|
+
private
|
|
139
|
+
|
|
140
|
+
def _dsl_for(vals) = self.class::DSL.new(State.new(self, vals), self)
|
|
138
141
|
end
|
|
139
142
|
|
|
140
143
|
def self.apply(klass)
|
|
@@ -147,19 +150,29 @@ module Pathway
|
|
|
147
150
|
@result, @operation = wrap(state), operation
|
|
148
151
|
end
|
|
149
152
|
|
|
150
|
-
def run(&
|
|
151
|
-
instance_eval(&
|
|
153
|
+
def run(&steps)
|
|
154
|
+
instance_eval(&steps)
|
|
152
155
|
@result
|
|
153
156
|
end
|
|
154
157
|
|
|
155
158
|
# Execute step and preserve the former state
|
|
156
159
|
def step(callable,...)
|
|
160
|
+
#:nocov:
|
|
161
|
+
if block_given?
|
|
162
|
+
warn "[DEPRECATION] Passing a block to the step method using `DSLMethods#step` is deprecated"
|
|
163
|
+
end
|
|
164
|
+
#:nocov:
|
|
157
165
|
bl = _callable(callable)
|
|
158
166
|
@result = @result.tee { |state| bl.call(state,...) }
|
|
159
167
|
end
|
|
160
168
|
|
|
161
169
|
# Execute step and modify the former state setting the key
|
|
162
170
|
def set(callable, *args, to: @operation.result_key, **kwargs, &bl)
|
|
171
|
+
#:nocov:
|
|
172
|
+
if block_given?
|
|
173
|
+
warn "[DEPRECATION] Passing a block to the step method using `DSLMethods#set` is deprecated"
|
|
174
|
+
end
|
|
175
|
+
#:nocov:
|
|
163
176
|
bl = _callable(callable)
|
|
164
177
|
|
|
165
178
|
@result = @result.then do |state|
|
|
@@ -170,26 +183,28 @@ module Pathway
|
|
|
170
183
|
|
|
171
184
|
# Execute step and replace the current state completely
|
|
172
185
|
def map(callable,...)
|
|
186
|
+
#:nocov:
|
|
187
|
+
warn "[DEPRECATION] `Pathway::DSLMethods#map` has been deprecated, use `step` instead"
|
|
188
|
+
#:nocov:
|
|
173
189
|
bl = _callable(callable)
|
|
174
190
|
@result = @result.then { |state| bl.call(state,...) }
|
|
175
191
|
end
|
|
176
192
|
|
|
177
|
-
def around(execution_strategy, &
|
|
193
|
+
def around(execution_strategy, &steps)
|
|
178
194
|
@result.then do |state|
|
|
179
|
-
|
|
195
|
+
steps_runner = ->(dsl = self) { dsl.run(&steps) }
|
|
180
196
|
|
|
181
|
-
_callable(execution_strategy).call(
|
|
197
|
+
_callable(execution_strategy).call(steps_runner, state)
|
|
182
198
|
end
|
|
183
199
|
end
|
|
184
200
|
|
|
185
|
-
def if_true(cond, &
|
|
201
|
+
def if_true(cond, &steps)
|
|
186
202
|
cond = _callable(cond)
|
|
187
|
-
around(->(
|
|
203
|
+
around(->(runner, state) { runner.call if cond.call(state) }, &steps)
|
|
188
204
|
end
|
|
189
205
|
|
|
190
|
-
def if_false(cond, &
|
|
191
|
-
|
|
192
|
-
if_true(->(state) { !cond.call(state) }, &dsl_block)
|
|
206
|
+
def if_false(cond, &steps)
|
|
207
|
+
if_true(_callable(cond) >> :!.to_proc, &steps)
|
|
193
208
|
end
|
|
194
209
|
|
|
195
210
|
alias_method :sequence, :around
|
|
@@ -201,7 +216,7 @@ module Pathway
|
|
|
201
216
|
|
|
202
217
|
def _callable(callable)
|
|
203
218
|
case callable
|
|
204
|
-
when Proc
|
|
219
|
+
when Proc # unless (callable.binding rescue nil)&.receiver == @operation
|
|
205
220
|
->(*args, **kwargs) { @operation.instance_exec(*args, **kwargs, &callable) }
|
|
206
221
|
when Symbol
|
|
207
222
|
->(*args, **kwargs) { @operation.send(callable, *args, **kwargs) }
|
data/pathway.gemspec
CHANGED
|
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
|
27
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
28
28
|
spec.require_paths = ["lib"]
|
|
29
29
|
|
|
30
|
-
spec.required_ruby_version = ">= 3.
|
|
30
|
+
spec.required_ruby_version = ">= 3.2.0"
|
|
31
31
|
|
|
32
32
|
spec.add_dependency "dry-inflector", ">= 0.1.0"
|
|
33
33
|
spec.add_dependency "contextualizer", "~> 0.1.0"
|
|
@@ -40,8 +40,8 @@ Gem::Specification.new do |spec|
|
|
|
40
40
|
spec.add_development_dependency "simplecov-lcov", '~> 0.8.0'
|
|
41
41
|
spec.add_development_dependency "simplecov"
|
|
42
42
|
spec.add_development_dependency "pry"
|
|
43
|
+
spec.add_development_dependency "reline"
|
|
43
44
|
spec.add_development_dependency "byebug"
|
|
44
45
|
spec.add_development_dependency "pry-byebug"
|
|
45
46
|
spec.add_development_dependency "pry-doc"
|
|
46
|
-
spec.add_development_dependency "pry-stack"
|
|
47
47
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pathway
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pablo Herrero
|
|
@@ -150,7 +150,7 @@ dependencies:
|
|
|
150
150
|
- !ruby/object:Gem::Version
|
|
151
151
|
version: '0'
|
|
152
152
|
- !ruby/object:Gem::Dependency
|
|
153
|
-
name:
|
|
153
|
+
name: reline
|
|
154
154
|
requirement: !ruby/object:Gem::Requirement
|
|
155
155
|
requirements:
|
|
156
156
|
- - ">="
|
|
@@ -164,7 +164,7 @@ dependencies:
|
|
|
164
164
|
- !ruby/object:Gem::Version
|
|
165
165
|
version: '0'
|
|
166
166
|
- !ruby/object:Gem::Dependency
|
|
167
|
-
name:
|
|
167
|
+
name: byebug
|
|
168
168
|
requirement: !ruby/object:Gem::Requirement
|
|
169
169
|
requirements:
|
|
170
170
|
- - ">="
|
|
@@ -178,7 +178,7 @@ dependencies:
|
|
|
178
178
|
- !ruby/object:Gem::Version
|
|
179
179
|
version: '0'
|
|
180
180
|
- !ruby/object:Gem::Dependency
|
|
181
|
-
name: pry-
|
|
181
|
+
name: pry-byebug
|
|
182
182
|
requirement: !ruby/object:Gem::Requirement
|
|
183
183
|
requirements:
|
|
184
184
|
- - ">="
|
|
@@ -192,7 +192,7 @@ dependencies:
|
|
|
192
192
|
- !ruby/object:Gem::Version
|
|
193
193
|
version: '0'
|
|
194
194
|
- !ruby/object:Gem::Dependency
|
|
195
|
-
name: pry-
|
|
195
|
+
name: pry-doc
|
|
196
196
|
requirement: !ruby/object:Gem::Requirement
|
|
197
197
|
requirements:
|
|
198
198
|
- - ">="
|
|
@@ -220,11 +220,30 @@ files:
|
|
|
220
220
|
- LICENSE.txt
|
|
221
221
|
- README.md
|
|
222
222
|
- Rakefile
|
|
223
|
+
- bin/bundle
|
|
223
224
|
- bin/byebug
|
|
225
|
+
- bin/coderay
|
|
224
226
|
- bin/console
|
|
227
|
+
- bin/erb
|
|
228
|
+
- bin/htmldiff
|
|
229
|
+
- bin/irb
|
|
230
|
+
- bin/ldiff
|
|
231
|
+
- bin/pry
|
|
225
232
|
- bin/rake
|
|
233
|
+
- bin/rbs
|
|
234
|
+
- bin/rdbg
|
|
235
|
+
- bin/rdoc
|
|
236
|
+
- bin/ri
|
|
226
237
|
- bin/rspec
|
|
238
|
+
- bin/ruby-lsp
|
|
239
|
+
- bin/ruby-lsp-check
|
|
240
|
+
- bin/ruby-lsp-launcher
|
|
241
|
+
- bin/ruby-lsp-test-exec
|
|
242
|
+
- bin/sequel
|
|
227
243
|
- bin/setup
|
|
244
|
+
- bin/yard
|
|
245
|
+
- bin/yardoc
|
|
246
|
+
- bin/yri
|
|
228
247
|
- lib/pathway.rb
|
|
229
248
|
- lib/pathway/plugins/auto_deconstruct_state.rb
|
|
230
249
|
- lib/pathway/plugins/dry_validation.rb
|
|
@@ -256,7 +275,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
256
275
|
requirements:
|
|
257
276
|
- - ">="
|
|
258
277
|
- !ruby/object:Gem::Version
|
|
259
|
-
version: 3.
|
|
278
|
+
version: 3.2.0
|
|
260
279
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
261
280
|
requirements:
|
|
262
281
|
- - ">="
|