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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc09be062809a2afe5a1874e1da97c15be0353059116e2932d8224d0857b3899
4
- data.tar.gz: dbc788f70ba9f95bfa700c790aff1a1c2313b2802b58417e4598314263c2af6a
3
+ metadata.gz: a13868cae6ff80203b023cdb1444609565f0004f0a2cab229997c01cbaa3aaa5
4
+ data.tar.gz: c22500510ef22c61cf9e11beba23455287b38539f35c21a3e9c082f498e7ba0b
5
5
  SHA512:
6
- metadata.gz: e39b0e7702a87427d242f722deb03ccf18186bb47e271a1fbb2c218bd1bde948db7fece51805a2b8de0c3f232273f624dd4c28cf743a50aa83bf00262c161cf2
7
- data.tar.gz: 2b528a4f6c8f8172294265fafe0e3751c62a3412bc67a2deeef09f124dd38a419302502e7c7be77ead661088b3ccb54c2eb0f35c65e848a0e5947117470d294f
6
+ metadata.gz: 00012d3079c7487ca627bebcb24b5164dd08012082f40d7765bb0bb23a2e0210a9583ea18fa71fdd5f2c69be93d171459fe9ad5f159250bc46c67425fe7b4dd3
7
+ data.tar.gz: 2c9557ffc6243159ff110a2e91d6017646020e05f990a1b3158ee46ccb1b2948993c085b06051a5eb9ea1eaa36ef3fb86b4858725fbb4966a9a2797bf0abf58e
@@ -11,7 +11,7 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- ruby-version: [3.1, 3.2, 3.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.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
- require "pathname"
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
- Pathname.new(__FILE__).realpath)
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
- require "pathname"
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
- Pathname.new(__FILE__).realpath)
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
- require "pathname"
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
- Pathname.new(__FILE__).realpath)
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")
@@ -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
- alias_method :auto_wire_options, :auto_wire
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, &block)
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(*args, **kwargs, &block)
27
- contract { params(*args, **kwargs, &block) }
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(**opts)
37
- @builded_contract || contract_class.new(**opts)
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 auto_wire_options auto_wire] => 'self.class'
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, **opts)
69
- result = contract(**opts).call(input)
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, auto_wire_options: (auto_wire_options_was_not_used=true; false), auto_wire: auto_wire_options)
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
@@ -11,8 +11,8 @@ module Pathway
11
11
  end
12
12
 
13
13
  class Responder
14
- def self.respond(result, &bl)
15
- r = new(result, &bl)
14
+ def self.respond(...)
15
+ r = new(...)
16
16
  r.respond
17
17
  end
18
18
 
@@ -6,33 +6,43 @@ module Pathway
6
6
  module Plugins
7
7
  module SequelModels
8
8
  module DSLMethods
9
- def transaction(step_name = nil, &dsl_bl)
10
- raise 'must provide a step or a block but not both' if !step_name.nil? == block_given?
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
- if step_name
13
- transaction { step step_name }
14
- else
15
- around(->(runner, _) {
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 after_commit(step_name = nil, &dsl_bl)
24
- raise 'must provide a step or a block but not both' if !step_name.nil? == block_given?
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
- if step_name
27
- after_commit { step step_name }
28
- else
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
- db.after_commit do
33
- runner.call(dsl_copy)
34
- end
35
- }, &dsl_bl)
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
@@ -13,8 +13,8 @@ module Pathway
13
13
  result(block_given? ? yield(value): bl.call(value))
14
14
  end
15
15
 
16
- def tee(bl=nil, &block)
17
- follow = self.then(bl, &block)
16
+ def tee(...)
17
+ follow = self.then(...)
18
18
  follow.failure? ? follow : self
19
19
  end
20
20
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pathway
4
- VERSION = '1.0.0'
4
+ VERSION = '1.2.0'
5
5
  end
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(&bl)
105
- dsl = self::DSL
104
+ def process(&steps)
106
105
  define_method(:call) do |input|
107
- dsl.new(State.new(self, input:), self)
108
- .run(&bl)
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(&bl)
151
- instance_eval(&bl)
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, &dsl_block)
193
+ def around(execution_strategy, &steps)
178
194
  @result.then do |state|
179
- dsl_runner = ->(dsl = self) { @result = dsl.run(&dsl_block) }
195
+ steps_runner = ->(dsl = self) { dsl.run(&steps) }
180
196
 
181
- _callable(execution_strategy).call(dsl_runner, state)
197
+ _callable(execution_strategy).call(steps_runner, state)
182
198
  end
183
199
  end
184
200
 
185
- def if_true(cond, &dsl_block)
201
+ def if_true(cond, &steps)
186
202
  cond = _callable(cond)
187
- around(->(dsl_runner, state) { dsl_runner.call if cond.call(state) }, &dsl_block)
203
+ around(->(runner, state) { runner.call if cond.call(state) }, &steps)
188
204
  end
189
205
 
190
- def if_false(cond, &dsl_block)
191
- cond = _callable(cond)
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.1.0"
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.0.0
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: byebug
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: pry-byebug
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-doc
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-stack
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.1.0
278
+ version: 3.2.0
260
279
  required_rubygems_version: !ruby/object:Gem::Requirement
261
280
  requirements:
262
281
  - - ">="