pathway 1.0.0 → 1.1.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: 72fdb918cf09f7e3121e4d745362485a23f5cac7939ff7b466cba0ff1dd5f5a7
4
+ data.tar.gz: edbe3a656d48496b67c793fb143c7b99860e8f4c610b54fdf9a4bad21094fc41
5
5
  SHA512:
6
- metadata.gz: e39b0e7702a87427d242f722deb03ccf18186bb47e271a1fbb2c218bd1bde948db7fece51805a2b8de0c3f232273f624dd4c28cf743a50aa83bf00262c161cf2
7
- data.tar.gz: 2b528a4f6c8f8172294265fafe0e3751c62a3412bc67a2deeef09f124dd38a419302502e7c7be77ead661088b3ccb54c2eb0f35c65e848a0e5947117470d294f
6
+ metadata.gz: d48ca6b5854a6ef671312323d6469b3832889f2bedfb43954221b976ad2cc96d696066af6df44fdecb67847c8c2484f047d762185ef9b559e9a286500c7ef05b
7
+ data.tar.gz: 423a1d02a20d6fa794e46d9b40c2bc982c3205194416ea9e020c932e816b0bd9b3f55bf3df92a0bb4ba7a8e16156eba1cfaaf8fbab5169f0b926ec239c82cc82
@@ -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,12 @@
1
+ ## [1.1.0] - 2025-05-30
2
+ ### Added
3
+ - Added `:if` and `:unless` options for `:transaction` and `:after_commit` methods at `:sequel_models` plugin
4
+ - Added `:after_rollback` method at `:sequel_models` plugin
5
+ ### Fixed
6
+ - Fixed bug where setting a callback inside an `around` block could unexpectedly change the operation's result
7
+ ### Changed
8
+ - Removed support for `Ruby` 3.1
9
+
1
10
  ## [1.0.0] - 2025-05-19
2
11
  ### Changed
3
12
  - 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("../.ruby-lsp/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("../.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
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("../.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("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("../.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("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("../.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("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("../.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("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("../.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
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("../.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
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("../.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("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("../.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("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("../.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("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("../.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("yard", "yri")
@@ -12,10 +12,10 @@ module Pathway
12
12
  alias_method :auto_wire_options, :auto_wire
13
13
  alias_method :auto_wire_options=, :auto_wire=
14
14
 
15
- def contract(base = nil, &block)
15
+ def contract(base = nil, &)
16
16
  if block_given?
17
17
  base ||= _base_contract
18
- self.contract_class = Class.new(base, &block)
18
+ self.contract_class = Class.new(base, &)
19
19
  elsif base
20
20
  self.contract_class = base
21
21
  else
@@ -23,8 +23,8 @@ module Pathway
23
23
  end
24
24
  end
25
25
 
26
- def params(*args, **kwargs, &block)
27
- contract { params(*args, **kwargs, &block) }
26
+ def params(...)
27
+ contract { params(...) }
28
28
  end
29
29
 
30
30
  def contract_class= klass
@@ -33,8 +33,8 @@ module Pathway
33
33
  @builded_contract = @contract_options.empty? && klass.schema ? klass.new : nil
34
34
  end
35
35
 
36
- def build_contract(**opts)
37
- @builded_contract || contract_class.new(**opts)
36
+ def build_contract(**)
37
+ @builded_contract || contract_class.new(**)
38
38
  end
39
39
 
40
40
  def inherited(subclass)
@@ -65,8 +65,8 @@ module Pathway
65
65
  .then { |params| state.update(params:) }
66
66
  end
67
67
 
68
- def validate_with(input, **opts)
69
- result = contract(**opts).call(input)
68
+ def validate_with(input, **)
69
+ result = contract(**).call(input)
70
70
 
71
71
  result.success? ? wrap(result.values.to_h) : error(:validation, details: result.errors.to_h)
72
72
  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.1.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,8 +150,8 @@ 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
 
@@ -174,22 +177,21 @@ module Pathway
174
177
  @result = @result.then { |state| bl.call(state,...) }
175
178
  end
176
179
 
177
- def around(execution_strategy, &dsl_block)
180
+ def around(execution_strategy, &steps)
178
181
  @result.then do |state|
179
- dsl_runner = ->(dsl = self) { @result = dsl.run(&dsl_block) }
182
+ steps_runner = ->(dsl = self) { dsl.run(&steps) }
180
183
 
181
- _callable(execution_strategy).call(dsl_runner, state)
184
+ _callable(execution_strategy).call(steps_runner, state)
182
185
  end
183
186
  end
184
187
 
185
- def if_true(cond, &dsl_block)
188
+ def if_true(cond, &steps)
186
189
  cond = _callable(cond)
187
- around(->(dsl_runner, state) { dsl_runner.call if cond.call(state) }, &dsl_block)
190
+ around(->(runner, state) { runner.call if cond.call(state) }, &steps)
188
191
  end
189
192
 
190
- def if_false(cond, &dsl_block)
191
- cond = _callable(cond)
192
- if_true(->(state) { !cond.call(state) }, &dsl_block)
193
+ def if_false(cond, &steps)
194
+ if_true(_callable(cond) >> :!.to_proc, &steps)
193
195
  end
194
196
 
195
197
  alias_method :sequence, :around
@@ -201,7 +203,7 @@ module Pathway
201
203
 
202
204
  def _callable(callable)
203
205
  case callable
204
- when Proc
206
+ when Proc # unless (callable.binding rescue nil)&.receiver == @operation
205
207
  ->(*args, **kwargs) { @operation.instance_exec(*args, **kwargs, &callable) }
206
208
  when Symbol
207
209
  ->(*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,6 +40,7 @@ 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"
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.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pablo Herrero
@@ -149,6 +149,20 @@ dependencies:
149
149
  - - ">="
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
+ - !ruby/object:Gem::Dependency
153
+ name: reline
154
+ requirement: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ type: :development
160
+ prerelease: false
161
+ version_requirements: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
152
166
  - !ruby/object:Gem::Dependency
153
167
  name: byebug
154
168
  requirement: !ruby/object:Gem::Requirement
@@ -220,11 +234,30 @@ files:
220
234
  - LICENSE.txt
221
235
  - README.md
222
236
  - Rakefile
237
+ - bin/bundle
223
238
  - bin/byebug
239
+ - bin/coderay
224
240
  - bin/console
241
+ - bin/erb
242
+ - bin/htmldiff
243
+ - bin/irb
244
+ - bin/ldiff
245
+ - bin/pry
225
246
  - bin/rake
247
+ - bin/rbs
248
+ - bin/rdbg
249
+ - bin/rdoc
250
+ - bin/ri
226
251
  - bin/rspec
252
+ - bin/ruby-lsp
253
+ - bin/ruby-lsp-check
254
+ - bin/ruby-lsp-launcher
255
+ - bin/ruby-lsp-test-exec
256
+ - bin/sequel
227
257
  - bin/setup
258
+ - bin/yard
259
+ - bin/yardoc
260
+ - bin/yri
228
261
  - lib/pathway.rb
229
262
  - lib/pathway/plugins/auto_deconstruct_state.rb
230
263
  - lib/pathway/plugins/dry_validation.rb
@@ -256,7 +289,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
256
289
  requirements:
257
290
  - - ">="
258
291
  - !ruby/object:Gem::Version
259
- version: 3.1.0
292
+ version: 3.2.0
260
293
  required_rubygems_version: !ruby/object:Gem::Requirement
261
294
  requirements:
262
295
  - - ">="