trailblazer-macro 2.1.3 → 2.1.7
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/ci.yml +17 -0
 - data/CHANGES.md +18 -0
 - data/Gemfile +3 -3
 - data/lib/trailblazer/macro/guard.rb +3 -3
 - data/lib/trailblazer/macro/nested.rb +42 -16
 - data/lib/trailblazer/macro/rescue.rb +2 -5
 - data/lib/trailblazer/macro/version.rb +1 -1
 - data/lib/trailblazer/macro/wrap.rb +1 -1
 - data/test/docs/guard_test.rb +2 -5
 - data/test/docs/model_test.rb +15 -1
 - data/test/docs/nested_test.rb +28 -28
 - data/test/docs/rescue_test.rb +52 -2
 - data/test/operation/nested_test.rb +76 -0
 - data/trailblazer-macro.gemspec +2 -3
 - metadata +14 -32
 - data/.travis.yml +0 -12
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 2b94581daf3c1a0afeea2d8a3d9f470393b15fbfe57fe01dc29c5d1f247beb7c
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: dff368470d21d9fb0f9522bf610ef1e62b51eebf59f9c41f371298d12d11b8e5
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 0a2547701dec5fd643a229313dfeab1d047b1b469208ba54c950cf6f496ef07aa950e6674fb96221fea898dcaff8329f2f3d2ff1f9bec7fa0b758599a96e6329
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: a0fb745ffb5a9a313764a08972f5271f66e2f07c097759bd5cccb0521b1f80cf72eadaf3c71ae1dc5abdc8bd311abf0aabf6aed4dbea728328a9c590249d9e24
         
     | 
| 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            name: CI
         
     | 
| 
      
 2 
     | 
    
         
            +
            on: [push, pull_request]
         
     | 
| 
      
 3 
     | 
    
         
            +
            jobs:
         
     | 
| 
      
 4 
     | 
    
         
            +
              test:
         
     | 
| 
      
 5 
     | 
    
         
            +
                strategy:
         
     | 
| 
      
 6 
     | 
    
         
            +
                  fail-fast: false
         
     | 
| 
      
 7 
     | 
    
         
            +
                  matrix:
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
         
     | 
| 
      
 9 
     | 
    
         
            +
                    ruby: [2.5, 2.6, 2.7, '3.0', head, jruby, jruby-head]
         
     | 
| 
      
 10 
     | 
    
         
            +
                runs-on: ubuntu-latest
         
     | 
| 
      
 11 
     | 
    
         
            +
                steps:
         
     | 
| 
      
 12 
     | 
    
         
            +
                - uses: actions/checkout@v2
         
     | 
| 
      
 13 
     | 
    
         
            +
                - uses: ruby/setup-ruby@v1
         
     | 
| 
      
 14 
     | 
    
         
            +
                  with:
         
     | 
| 
      
 15 
     | 
    
         
            +
                    ruby-version: ${{ matrix.ruby }}
         
     | 
| 
      
 16 
     | 
    
         
            +
                    bundler-cache: true # runs 'bundle install' and caches installed gems automatically
         
     | 
| 
      
 17 
     | 
    
         
            +
                - run: bundle exec rake
         
     | 
    
        data/CHANGES.md
    CHANGED
    
    | 
         @@ -1,3 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # 2.1.7
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            * Improve `Nested()` warning message.
         
     | 
| 
      
 4 
     | 
    
         
            +
            * Fix exception in `Rescue()` macro when it's handler is a `Module`.
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            # 2.1.6
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            * Allow connecting ends of the dynamically selected activity for `Nested()` using `:auto_wire`.
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            # 2.1.5
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            * Support for Ruby 3.0.
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            # 2.1.4
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            * Upgrade DSL version to fix step's circuit interface eating passed arguments
         
     | 
| 
      
 17 
     | 
    
         
            +
            * Upgrade OP version to remove OP::Container reference in tests
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
       1 
19 
     | 
    
         
             
            # 2.1.3
         
     | 
| 
       2 
20 
     | 
    
         | 
| 
       3 
21 
     | 
    
         
             
            * Rename Model()'s `not_found_end` kwarg to `not_found_terminus` for consistency.
         
     | 
    
        data/Gemfile
    CHANGED
    
    | 
         @@ -5,11 +5,11 @@ gemspec 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            # gem "trailblazer", github: "trailblazer/trailblazer"
         
     | 
| 
       7 
7 
     | 
    
         
             
            # gem "trailblazer-activity", path: "../trailblazer-activity"
         
     | 
| 
       8 
     | 
    
         
            -
            # gem "trailblazer-activity-dsl-linear", github: "trailblazer/trailblazer-activity-dsl-linear", branch: 'master'
         
     | 
| 
       9 
8 
     | 
    
         
             
            # gem "trailblazer-activity-dsl-linear", path: "../trailblazer-activity-dsl-linear"
         
     | 
| 
       10 
     | 
    
         
            -
            # gem "trailblazer-operation", github: "trailblazer/trailblazer-operation", branch: 'linear'
         
     | 
| 
       11 
     | 
    
         
            -
            # gem "trailblazer-activity"#, github: "trailblazer/trailblazer-activity"
         
     | 
| 
       12 
9 
     | 
    
         
             
            # gem "trailblazer-macro-contract", git: "https://github.com/trailblazer/trailblazer-macro-contract"
         
     | 
| 
      
 10 
     | 
    
         
            +
            # gem "trailblazer-context", path: "../trailblazer-context"
         
     | 
| 
      
 11 
     | 
    
         
            +
            # gem "trailblazer-operation", path: "../trailblazer-operation"
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
            gem "minitest-line"
         
     | 
| 
       15 
15 
     | 
    
         
             
            gem "rubocop", require: false
         
     | 
| 
         @@ -6,11 +6,11 @@ module Trailblazer::Macro 
     | 
|
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                module Guard
         
     | 
| 
       8 
8 
     | 
    
         
             
                  def self.build(callable)
         
     | 
| 
       9 
     | 
    
         
            -
                    option = Trailblazer::Option 
     | 
| 
      
 9 
     | 
    
         
            +
                    option = Trailblazer::Option(callable)
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
                    # this gets wrapped in a Operation::Result object.
         
     | 
| 
       12 
     | 
    
         
            -
                    ->(( 
     | 
| 
       13 
     | 
    
         
            -
                      Trailblazer::Operation::Result.new(!!option.call( 
     | 
| 
      
 12 
     | 
    
         
            +
                    ->((ctx, *), **circuit_args) do
         
     | 
| 
      
 13 
     | 
    
         
            +
                      Trailblazer::Operation::Result.new(!!option.call(ctx, keyword_arguments: ctx.to_hash, **circuit_args), {})
         
     | 
| 
       14 
14 
     | 
    
         
             
                    end
         
     | 
| 
       15 
15 
     | 
    
         
             
                  end
         
     | 
| 
       16 
16 
     | 
    
         
             
                end
         
     | 
| 
         @@ -2,14 +2,18 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            module Trailblazer
         
     | 
| 
       3 
3 
     | 
    
         
             
              module Macro
         
     | 
| 
       4 
4 
     | 
    
         
             
                # {Nested} macro.
         
     | 
| 
       5 
     | 
    
         
            -
                def self.Nested(callable, id: "Nested(#{callable})")
         
     | 
| 
      
 5 
     | 
    
         
            +
                def self.Nested(callable, id: "Nested(#{callable})", auto_wire: [])
         
     | 
| 
       6 
6 
     | 
    
         
             
                  if callable.is_a?(Class) && callable < Nested.operation_class
         
     | 
| 
       7 
     | 
    
         
            -
                     
     | 
| 
      
 7 
     | 
    
         
            +
                    caller_location = caller_locations(2, 1)[0]
         
     | 
| 
      
 8 
     | 
    
         
            +
                    warn "[Trailblazer]#{caller_location.absolute_path}: " \
         
     | 
| 
      
 9 
     | 
    
         
            +
                         "Using the `Nested()` macro with operations and activities is deprecated. " \
         
     | 
| 
      
 10 
     | 
    
         
            +
                         "Replace `Nested(#{callable})` with `Subprocess(#{callable})`."
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
       8 
12 
     | 
    
         
             
                    return Nested.operation_class.Subprocess(callable)
         
     | 
| 
       9 
13 
     | 
    
         
             
                  end
         
     | 
| 
       10 
14 
     | 
    
         | 
| 
       11 
15 
     | 
    
         
             
                  # dynamic
         
     | 
| 
       12 
     | 
    
         
            -
                  task = Nested::Dynamic.new(callable)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  task = Nested::Dynamic.new(callable, auto_wire: auto_wire)
         
     | 
| 
       13 
17 
     | 
    
         | 
| 
       14 
18 
     | 
    
         
             
                  merge = [
         
     | 
| 
       15 
19 
     | 
    
         
             
                    [Activity::TaskWrap::Pipeline.method(:insert_before), "task_wrap.call_task", ["Nested.compute_nested_activity", task.method(:compute_nested_activity)]],
         
     | 
| 
         @@ -33,17 +37,24 @@ module Trailblazer 
     | 
|
| 
       33 
37 
     | 
    
         
             
                  end
         
     | 
| 
       34 
38 
     | 
    
         | 
| 
       35 
39 
     | 
    
         
             
                  # For dynamic `Nested`s that do not expose an {Activity} interface.
         
     | 
| 
       36 
     | 
    
         
            -
                  # Since we do not know its outputs, we have to map them to :success and :failure, only.
         
     | 
| 
       37 
40 
     | 
    
         
             
                  #
         
     | 
| 
       38 
     | 
    
         
            -
                  #  
     | 
| 
      
 41 
     | 
    
         
            +
                  # Dynamic doesn't automatically connect outputs of runtime {Activity}
         
     | 
| 
      
 42 
     | 
    
         
            +
                  # at compile time (as we don't know which activity will be nested, obviously).
         
     | 
| 
      
 43 
     | 
    
         
            +
                  # So by default, it only connects good old success/failure ends. But it is also
         
     | 
| 
      
 44 
     | 
    
         
            +
                  # possible to connect all the ends of all possible dynamic activities
         
     | 
| 
      
 45 
     | 
    
         
            +
                  # by passing their list to {:auto_wire} option.
         
     | 
| 
      
 46 
     | 
    
         
            +
                  #
         
     | 
| 
      
 47 
     | 
    
         
            +
                  # step Nested(:compute_nested, auto_wire: [Create, Update])
         
     | 
| 
       39 
48 
     | 
    
         
             
                  class Dynamic
         
     | 
| 
       40 
     | 
    
         
            -
                     
     | 
| 
       41 
     | 
    
         
            -
                       
     | 
| 
      
 49 
     | 
    
         
            +
                    STATIC_OUTPUTS = {
         
     | 
| 
      
 50 
     | 
    
         
            +
                      :success => Activity::Output(Activity::Railway::End::Success.new(semantic: :success), :success),
         
     | 
| 
      
 51 
     | 
    
         
            +
                      :failure => Activity::Output(Activity::Railway::End::Failure.new(semantic: :failure), :failure),
         
     | 
| 
      
 52 
     | 
    
         
            +
                    }
         
     | 
| 
       42 
53 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                       
     | 
| 
      
 54 
     | 
    
         
            +
                    def initialize(nested_activity_decider, auto_wire: [])
         
     | 
| 
      
 55 
     | 
    
         
            +
                      @nested_activity_decider  = Trailblazer::Option(nested_activity_decider)
         
     | 
| 
      
 56 
     | 
    
         
            +
                      @known_activities         = Array(auto_wire)
         
     | 
| 
      
 57 
     | 
    
         
            +
                      @outputs                  = compute_task_outputs
         
     | 
| 
       47 
58 
     | 
    
         
             
                    end
         
     | 
| 
       48 
59 
     | 
    
         | 
| 
       49 
60 
     | 
    
         
             
                    attr_reader :outputs
         
     | 
| 
         @@ -53,7 +64,7 @@ module Trailblazer 
     | 
|
| 
       53 
64 
     | 
    
         
             
                      (ctx, _), original_circuit_options = original_args
         
     | 
| 
       54 
65 
     | 
    
         | 
| 
       55 
66 
     | 
    
         
             
                      # TODO: evaluate the option to get the actual "object" to call.
         
     | 
| 
       56 
     | 
    
         
            -
                      activity = @nested_activity_decider.(ctx, original_circuit_options)
         
     | 
| 
      
 67 
     | 
    
         
            +
                      activity = @nested_activity_decider.(ctx, keyword_arguments: ctx.to_hash, **original_circuit_options)
         
     | 
| 
       57 
68 
     | 
    
         | 
| 
       58 
69 
     | 
    
         
             
                      # Overwrite :task so task_wrap.call_task will call this activity.
         
     | 
| 
       59 
70 
     | 
    
         
             
                      # This is a trick so we don't have to repeat logic from #call_task here.
         
     | 
| 
         @@ -63,13 +74,28 @@ module Trailblazer 
     | 
|
| 
       63 
74 
     | 
    
         
             
                    end
         
     | 
| 
       64 
75 
     | 
    
         | 
| 
       65 
76 
     | 
    
         
             
                    def compute_return_signal(wrap_ctx, original_args)
         
     | 
| 
       66 
     | 
    
         
            -
                      #  
     | 
| 
       67 
     | 
    
         
            -
                       
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
                         
     | 
| 
      
 77 
     | 
    
         
            +
                      # NOOP when @known_activities are present as all possible signals have been registered already.
         
     | 
| 
      
 78 
     | 
    
         
            +
                      if @known_activities.empty?
         
     | 
| 
      
 79 
     | 
    
         
            +
                        # Translate the genuine nested signal to the generic Dynamic end (success/failure, only).
         
     | 
| 
      
 80 
     | 
    
         
            +
                        # Note that here we lose information about what specific event was emitted.
         
     | 
| 
      
 81 
     | 
    
         
            +
                        wrap_ctx[:return_signal] = wrap_ctx[:return_signal].kind_of?(Activity::Railway::End::Success) ?
         
     | 
| 
      
 82 
     | 
    
         
            +
                          @outputs[:success].signal : @outputs[:failure].signal
         
     | 
| 
      
 83 
     | 
    
         
            +
                      end
         
     | 
| 
       70 
84 
     | 
    
         | 
| 
       71 
85 
     | 
    
         
             
                      return wrap_ctx, original_args
         
     | 
| 
       72 
86 
     | 
    
         
             
                    end
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
                    private def compute_task_outputs
         
     | 
| 
      
 89 
     | 
    
         
            +
                      # If :auto_wire is empty, we map outputs to :success and :failure only, for backward compatibility.
         
     | 
| 
      
 90 
     | 
    
         
            +
                      # This is what {Nested} in 2.0 used to do, where the outcome could only be true/false (or success/failure).
         
     | 
| 
      
 91 
     | 
    
         
            +
                      return STATIC_OUTPUTS if @known_activities.empty?
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
                      # Merge activity#outputs from all given auto_wirable activities to wire up for this dynamic task.
         
     | 
| 
      
 94 
     | 
    
         
            +
                      @known_activities.map do |activity|
         
     | 
| 
      
 95 
     | 
    
         
            +
                        # TODO: Replace this when it's helper gets added.
         
     | 
| 
      
 96 
     | 
    
         
            +
                        Hash[activity.to_h[:outputs].collect{ |output| [output.semantic, output] }]
         
     | 
| 
      
 97 
     | 
    
         
            +
                      end.inject(:merge)
         
     | 
| 
      
 98 
     | 
    
         
            +
                    end
         
     | 
| 
       73 
99 
     | 
    
         
             
                  end
         
     | 
| 
       74 
100 
     | 
    
         
             
                end
         
     | 
| 
       75 
101 
     | 
    
         
             
              end
         
     | 
| 
         @@ -28,11 +28,8 @@ module Trailblazer 
     | 
|
| 
       28 
28 
     | 
    
         
             
                # TODO: remove me in 2.2.
         
     | 
| 
       29 
29 
     | 
    
         
             
                module Rescue
         
     | 
| 
       30 
30 
     | 
    
         
             
                  def self.deprecate_positional_handler_signature(handler)
         
     | 
| 
       31 
     | 
    
         
            -
                    return handler if handler.is_a?(Symbol) # can't do  
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                    arity = handler.is_a?(Class) ? handler.method(:call).arity : handler.arity
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
                    return handler if arity != 2 # means (exception, (ctx, flow_options), *, &block), "new style"
         
     | 
| 
      
 31 
     | 
    
         
            +
                    return handler if handler.is_a?(Symbol) # can't do nothing about this.
         
     | 
| 
      
 32 
     | 
    
         
            +
                    return handler if handler.method(:call).arity != 2 # means (exception, (ctx, flow_options), *, &block), "new style"
         
     | 
| 
       36 
33 
     | 
    
         | 
| 
       37 
34 
     | 
    
         
             
                    ->(exception, (ctx, flow_options), **circuit_options, &block) do
         
     | 
| 
       38 
35 
     | 
    
         
             
                      warn "[Trailblazer] Rescue handlers have a new signature: (exception, *, &block)"
         
     | 
| 
         @@ -48,7 +48,7 @@ module Trailblazer 
     | 
|
| 
       48 
48 
     | 
    
         | 
| 
       49 
49 
     | 
    
         
             
                    def call((ctx, flow_options), **circuit_options)
         
     | 
| 
       50 
50 
     | 
    
         
             
                      block_calling_wrapped = -> {
         
     | 
| 
       51 
     | 
    
         
            -
                        call_wrapped_activity([ctx, flow_options], circuit_options)
         
     | 
| 
      
 51 
     | 
    
         
            +
                        call_wrapped_activity([ctx, flow_options], **circuit_options)
         
     | 
| 
       52 
52 
     | 
    
         
             
                      }
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
       54 
54 
     | 
    
         
             
                      # call the user's Wrap {} block in the operation.
         
     | 
    
        data/test/docs/guard_test.rb
    CHANGED
    
    | 
         @@ -113,8 +113,6 @@ end 
     | 
|
| 
       113 
113 
     | 
    
         
             
            class DocsGuardInjectionTest < Minitest::Spec
         
     | 
| 
       114 
114 
     | 
    
         
             
              #:di-op
         
     | 
| 
       115 
115 
     | 
    
         
             
              class Create < Trailblazer::Operation
         
     | 
| 
       116 
     | 
    
         
            -
                extend Trailblazer::Operation::Container
         
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
       118 
116 
     | 
    
         
             
                step Policy::Guard( ->(options, current_user:, **) { current_user == Module } )
         
     | 
| 
       119 
117 
     | 
    
         
             
              end
         
     | 
| 
       120 
118 
     | 
    
         
             
              #:di-op end
         
     | 
| 
         @@ -124,9 +122,8 @@ class DocsGuardInjectionTest < Minitest::Spec 
     | 
|
| 
       124 
122 
     | 
    
         
             
                result =
         
     | 
| 
       125 
123 
     | 
    
         
             
              #:di-call
         
     | 
| 
       126 
124 
     | 
    
         
             
              Create.(
         
     | 
| 
       127 
     | 
    
         
            -
                 
     | 
| 
       128 
     | 
    
         
            -
                : 
     | 
| 
       129 
     | 
    
         
            -
                :"policy.default.eval" => Trailblazer::Operation::Policy::Guard.build(->(options, **) { false })
         
     | 
| 
      
 125 
     | 
    
         
            +
                :current_user           => Module,
         
     | 
| 
      
 126 
     | 
    
         
            +
                :"policy.default.eval"  => Trailblazer::Operation::Policy::Guard.build(->(options, **) { false })
         
     | 
| 
       130 
127 
     | 
    
         
             
              )
         
     | 
| 
       131 
128 
     | 
    
         
             
              #:di-call end
         
     | 
| 
       132 
129 
     | 
    
         
             
                result.inspect("").must_equal %{<Result:false [nil] >} }
         
     | 
    
        data/test/docs/model_test.rb
    CHANGED
    
    | 
         @@ -16,7 +16,7 @@ class DocsModelTest < Minitest::Spec 
     | 
|
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
              #:op
         
     | 
| 
       18 
18 
     | 
    
         
             
              class Create < Trailblazer::Operation
         
     | 
| 
       19 
     | 
    
         
            -
                step Model( 
     | 
| 
      
 19 
     | 
    
         
            +
                step Model(Song, :new)
         
     | 
| 
       20 
20 
     | 
    
         
             
                # ..
         
     | 
| 
       21 
21 
     | 
    
         
             
              end
         
     | 
| 
       22 
22 
     | 
    
         
             
              #:op end
         
     | 
| 
         @@ -121,4 +121,18 @@ class DocsModelTest < Minitest::Spec 
     | 
|
| 
       121 
121 
     | 
    
         
             
                result.success?.must_equal true
         
     | 
| 
       122 
122 
     | 
    
         
             
                result[:model].inspect.must_equal %{#<struct DocsModelTest::Song id=100, title=nil>}
         
     | 
| 
       123 
123 
     | 
    
         
             
              end
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
              it "allows injecting {:model.class} and friends" do
         
     | 
| 
      
 126 
     | 
    
         
            +
                class Hit < Song
         
     | 
| 
      
 127 
     | 
    
         
            +
                end
         
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
                result = Create.(params: {}, :"model.class" => Hit)
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
      
 131 
     | 
    
         
            +
                result[:model].inspect.must_equal %{#<struct DocsModelTest::Hit id=nil, title=nil>}
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
              # inject all variables
         
     | 
| 
      
 134 
     | 
    
         
            +
                result = Create.(params: {title: "Olympia"}, "model.class": Hit, "model.action": :find_by, "model.find_by_key": :title)
         
     | 
| 
      
 135 
     | 
    
         
            +
             
     | 
| 
      
 136 
     | 
    
         
            +
                result[:model].inspect.must_equal %{#<struct DocsModelTest::Hit id=2, title="Olympia">}
         
     | 
| 
      
 137 
     | 
    
         
            +
              end
         
     | 
| 
       124 
138 
     | 
    
         
             
            end
         
     | 
    
        data/test/docs/nested_test.rb
    CHANGED
    
    | 
         @@ -22,6 +22,11 @@ class NestedInput < Minitest::Spec 
     | 
|
| 
       22 
22 
     | 
    
         
             
                include T.def_steps(:validate)
         
     | 
| 
       23 
23 
     | 
    
         
             
              end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
      
 25 
     | 
    
         
            +
              class JsonValidate < Validate
         
     | 
| 
      
 26 
     | 
    
         
            +
                step :json
         
     | 
| 
      
 27 
     | 
    
         
            +
                include T.def_steps(:json)
         
     | 
| 
      
 28 
     | 
    
         
            +
              end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
       25 
30 
     | 
    
         
             
              it "Nested(Edit), without any options" do
         
     | 
| 
       26 
31 
     | 
    
         
             
                  module A
         
     | 
| 
       27 
32 
     | 
    
         | 
| 
         @@ -79,11 +84,6 @@ class NestedInput < Minitest::Spec 
     | 
|
| 
       79 
84 
     | 
    
         
             
                    #~meths end
         
     | 
| 
       80 
85 
     | 
    
         
             
                  end
         
     | 
| 
       81 
86 
     | 
    
         
             
                  #:nested-dynamic end
         
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
                  class JsonValidate < Validate
         
     | 
| 
       84 
     | 
    
         
            -
                    step :json
         
     | 
| 
       85 
     | 
    
         
            -
                    include T.def_steps(:json)
         
     | 
| 
       86 
     | 
    
         
            -
                  end
         
     | 
| 
       87 
87 
     | 
    
         
             
                # `edit` and `update` can be called from Nested()
         
     | 
| 
       88 
88 
     | 
    
         | 
| 
       89 
89 
     | 
    
         
             
              # edit/success
         
     | 
| 
         @@ -119,11 +119,6 @@ class NestedInput < Minitest::Spec 
     | 
|
| 
       119 
119 
     | 
    
         
             
                  end
         
     | 
| 
       120 
120 
     | 
    
         
             
                  #:nested-dynamic end
         
     | 
| 
       121 
121 
     | 
    
         | 
| 
       122 
     | 
    
         
            -
                  class JsonValidate < Validate
         
     | 
| 
       123 
     | 
    
         
            -
                    step :json
         
     | 
| 
       124 
     | 
    
         
            -
                    include T.def_steps(:json)
         
     | 
| 
       125 
     | 
    
         
            -
                  end
         
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
       127 
122 
     | 
    
         
             
                # `edit` and `update` can be called from Nested()
         
     | 
| 
       128 
123 
     | 
    
         
             
                end
         
     | 
| 
       129 
124 
     | 
    
         | 
| 
         @@ -161,29 +156,34 @@ class NestedInput < Minitest::Spec 
     | 
|
| 
       161 
156 
     | 
    
         
             
                end
         
     | 
| 
       162 
157 
     | 
    
         
             
              end
         
     | 
| 
       163 
158 
     | 
    
         | 
| 
       164 
     | 
    
         
            -
               
     | 
| 
       165 
     | 
    
         
            -
                 
     | 
| 
       166 
     | 
    
         
            -
             
     | 
| 
       167 
     | 
    
         
            -
             
     | 
| 
       168 
     | 
    
         
            -
             
     | 
| 
       169 
     | 
    
         
            -
             
     | 
| 
      
 159 
     | 
    
         
            +
              it "Nested(:method, auto_wire: *activities) with :pass_fast => End()" do
         
     | 
| 
      
 160 
     | 
    
         
            +
                module E
         
     | 
| 
      
 161 
     | 
    
         
            +
                  class JsonValidate < Trailblazer::Operation
         
     | 
| 
      
 162 
     | 
    
         
            +
                    step :validate, Output(:success) => End(:json_validate)
         
     | 
| 
      
 163 
     | 
    
         
            +
                    include T.def_steps(:validate)
         
     | 
| 
      
 164 
     | 
    
         
            +
                  end
         
     | 
| 
       170 
165 
     | 
    
         | 
| 
       171 
     | 
    
         
            -
             
     | 
| 
      
 166 
     | 
    
         
            +
                  #:nested-with-auto-wire
         
     | 
| 
      
 167 
     | 
    
         
            +
                  class Create < Trailblazer::Operation
         
     | 
| 
      
 168 
     | 
    
         
            +
                    step :create
         
     | 
| 
      
 169 
     | 
    
         
            +
                    step Nested(:compute_nested, auto_wire: [Validate, JsonValidate]),
         
     | 
| 
      
 170 
     | 
    
         
            +
                      Output(:json_validate) => End(:jsoned)
         
     | 
| 
       172 
171 
     | 
    
         | 
| 
       173 
     | 
    
         
            -
             
     | 
| 
       174 
     | 
    
         
            -
             
     | 
| 
       175 
     | 
    
         
            -
             
     | 
| 
       176 
     | 
    
         
            -
             
     | 
| 
      
 172 
     | 
    
         
            +
                    #~meths
         
     | 
| 
      
 173 
     | 
    
         
            +
                    def compute_nested(ctx, what:, **)
         
     | 
| 
      
 174 
     | 
    
         
            +
                      what
         
     | 
| 
      
 175 
     | 
    
         
            +
                    end
         
     | 
| 
       177 
176 
     | 
    
         | 
| 
       178 
     | 
    
         
            -
             
     | 
| 
       179 
     | 
    
         
            -
             
     | 
| 
       180 
     | 
    
         
            -
                   
     | 
| 
       181 
     | 
    
         
            -
                   
     | 
| 
       182 
     | 
    
         
            -
                  include T.def_steps(:a, :b)
         
     | 
| 
       183 
     | 
    
         
            -
                end
         
     | 
| 
      
 177 
     | 
    
         
            +
                    include T.def_steps(:create)
         
     | 
| 
      
 178 
     | 
    
         
            +
                    #~meths end
         
     | 
| 
      
 179 
     | 
    
         
            +
                  end
         
     | 
| 
      
 180 
     | 
    
         
            +
                  #:nested-with-auto-wire end
         
     | 
| 
       184 
181 
     | 
    
         | 
| 
      
 182 
     | 
    
         
            +
                  result = Create.(seq: [], what: JsonValidate)
         
     | 
| 
       185 
183 
     | 
    
         | 
| 
       186 
     | 
    
         
            -
             
     | 
| 
      
 184 
     | 
    
         
            +
                  result.inspect(:seq).must_equal %{<Result:false [[:create, :validate]] >}
         
     | 
| 
      
 185 
     | 
    
         
            +
                  result.event.inspect.must_equal %{#<Trailblazer::Activity::End semantic=:jsoned>}
         
     | 
| 
      
 186 
     | 
    
         
            +
                end
         
     | 
| 
       187 
187 
     | 
    
         
             
              end
         
     | 
| 
       188 
188 
     | 
    
         
             
            end
         
     | 
| 
       189 
189 
     | 
    
         | 
    
        data/test/docs/rescue_test.rb
    CHANGED
    
    | 
         @@ -66,7 +66,7 @@ plain Rescue() 
     | 
|
| 
       66 
66 
     | 
    
         
             
            =begin
         
     | 
| 
       67 
67 
     | 
    
         
             
            Rescue( handler: X )
         
     | 
| 
       68 
68 
     | 
    
         
             
            =end
         
     | 
| 
       69 
     | 
    
         
            -
              class  
     | 
| 
      
 69 
     | 
    
         
            +
              class RescueWithClassHandlerTest < Minitest::Spec
         
     | 
| 
       70 
70 
     | 
    
         
             
                Memo = Class.new
         
     | 
| 
       71 
71 
     | 
    
         | 
| 
       72 
72 
     | 
    
         
             
                #:rescue-handler
         
     | 
| 
         @@ -97,10 +97,35 @@ Rescue( handler: X ) 
     | 
|
| 
       97 
97 
     | 
    
         
             
                it { Memo::Create.( { seq: [], rehash_raise: true } ).inspect(:seq, :exception_class).must_equal %{<Result:false [[:find_model, :update, :rehash, :log_error], RuntimeError] >} }
         
     | 
| 
       98 
98 
     | 
    
         
             
              end
         
     | 
| 
       99 
99 
     | 
    
         | 
| 
      
 100 
     | 
    
         
            +
              class RescueWithModuleHandlerTest < Minitest::Spec
         
     | 
| 
      
 101 
     | 
    
         
            +
                Memo = Class.new
         
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
      
 103 
     | 
    
         
            +
                module MyHandler
         
     | 
| 
      
 104 
     | 
    
         
            +
                  def self.call(exception, (ctx), *)
         
     | 
| 
      
 105 
     | 
    
         
            +
                    ctx[:exception_class] = exception.class
         
     | 
| 
      
 106 
     | 
    
         
            +
                  end
         
     | 
| 
      
 107 
     | 
    
         
            +
                end
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
                class Memo::Create < Trailblazer::Operation
         
     | 
| 
      
 110 
     | 
    
         
            +
                  step :find_model
         
     | 
| 
      
 111 
     | 
    
         
            +
                  step Rescue( RuntimeError, handler: MyHandler ) {
         
     | 
| 
      
 112 
     | 
    
         
            +
                    step :update
         
     | 
| 
      
 113 
     | 
    
         
            +
                    step :rehash
         
     | 
| 
      
 114 
     | 
    
         
            +
                  }
         
     | 
| 
      
 115 
     | 
    
         
            +
                  step :notify
         
     | 
| 
      
 116 
     | 
    
         
            +
                  fail :log_error
         
     | 
| 
      
 117 
     | 
    
         
            +
                  include T.def_steps(:find_model, :update, :notify, :log_error)
         
     | 
| 
      
 118 
     | 
    
         
            +
                  include Rehash
         
     | 
| 
      
 119 
     | 
    
         
            +
                end
         
     | 
| 
      
 120 
     | 
    
         
            +
             
     | 
| 
      
 121 
     | 
    
         
            +
                it { Memo::Create.( { seq: [], } ).inspect(:seq, :exception_class).must_equal %{<Result:true [[:find_model, :update, :rehash, :notify], nil] >} }
         
     | 
| 
      
 122 
     | 
    
         
            +
                it { Memo::Create.( { seq: [], rehash_raise: true } ).inspect(:seq, :exception_class).must_equal %{<Result:false [[:find_model, :update, :rehash, :log_error], RuntimeError] >} }
         
     | 
| 
      
 123 
     | 
    
         
            +
              end
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
       100 
125 
     | 
    
         
             
            =begin
         
     | 
| 
       101 
126 
     | 
    
         
             
            Rescue( handler: :instance_method )
         
     | 
| 
       102 
127 
     | 
    
         
             
            =end
         
     | 
| 
       103 
     | 
    
         
            -
              class  
     | 
| 
      
 128 
     | 
    
         
            +
              class RescueWithMethodHandlerTest < Minitest::Spec
         
     | 
| 
       104 
129 
     | 
    
         
             
                Memo = Class.new
         
     | 
| 
       105 
130 
     | 
    
         | 
| 
       106 
131 
     | 
    
         
             
                #:rescue-method
         
     | 
| 
         @@ -126,4 +151,29 @@ Rescue( handler: :instance_method ) 
     | 
|
| 
       126 
151 
     | 
    
         
             
                it { Memo::Create.( { seq: [], } ).inspect(:seq, :exception_class).must_equal %{<Result:true [[:find_model, :update, :rehash, :notify], nil] >} }
         
     | 
| 
       127 
152 
     | 
    
         
             
                it { Memo::Create.( { seq: [], rehash_raise: true } ).inspect(:seq, :exception_class).must_equal %{<Result:false [[:find_model, :update, :rehash, :log_error], RuntimeError] >} }
         
     | 
| 
       128 
153 
     | 
    
         
             
              end
         
     | 
| 
      
 154 
     | 
    
         
            +
             
     | 
| 
      
 155 
     | 
    
         
            +
            =begin
         
     | 
| 
      
 156 
     | 
    
         
            +
            Rescue(), fast_track: true {}
         
     | 
| 
      
 157 
     | 
    
         
            +
            =end
         
     | 
| 
      
 158 
     | 
    
         
            +
              class RescueWithFastTrack < Minitest::Spec
         
     | 
| 
      
 159 
     | 
    
         
            +
                Memo = Class.new
         
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
      
 161 
     | 
    
         
            +
                #:rescue-fasttrack
         
     | 
| 
      
 162 
     | 
    
         
            +
                class Memo::Create < Trailblazer::Operation
         
     | 
| 
      
 163 
     | 
    
         
            +
                  rescue_block = ->(*) {
         
     | 
| 
      
 164 
     | 
    
         
            +
                    step :update, Output(:failure) => End(:fail_fast)
         
     | 
| 
      
 165 
     | 
    
         
            +
                    step :rehash
         
     | 
| 
      
 166 
     | 
    
         
            +
                  }
         
     | 
| 
      
 167 
     | 
    
         
            +
             
     | 
| 
      
 168 
     | 
    
         
            +
                  step :find_model
         
     | 
| 
      
 169 
     | 
    
         
            +
                  step Rescue(&rescue_block), fail_fast: true
         
     | 
| 
      
 170 
     | 
    
         
            +
                  step :notify
         
     | 
| 
      
 171 
     | 
    
         
            +
                  fail :log_error
         
     | 
| 
      
 172 
     | 
    
         
            +
                  #~methods
         
     | 
| 
      
 173 
     | 
    
         
            +
                  include T.def_steps(:find_model, :update, :notify, :log_error, :rehash)
         
     | 
| 
      
 174 
     | 
    
         
            +
                end
         
     | 
| 
      
 175 
     | 
    
         
            +
             
     | 
| 
      
 176 
     | 
    
         
            +
                it { Memo::Create.( { seq: [], } ).inspect(:seq).must_equal %{<Result:true [[:find_model, :update, :rehash, :notify]] >} }
         
     | 
| 
      
 177 
     | 
    
         
            +
                it { Memo::Create.( { seq: [], update: false } ).inspect(:seq).must_equal %{<Result:false [[:find_model, :update]] >} }
         
     | 
| 
      
 178 
     | 
    
         
            +
              end
         
     | 
| 
       129 
179 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,76 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'test_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class NestedTest < Minitest::Spec
         
     | 
| 
      
 4 
     | 
    
         
            +
              DatabaseError = Class.new(Trailblazer::Activity::Signal)
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              class SignUp < Trailblazer::Operation
         
     | 
| 
      
 7 
     | 
    
         
            +
                def self.b(ctx, **)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  ctx[:seq] << :b
         
     | 
| 
      
 9 
     | 
    
         
            +
                  return DatabaseError
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                step method(:b), Output(DatabaseError, :db_error) => End(:db_error)
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              class SignIn < Trailblazer::Operation
         
     | 
| 
      
 16 
     | 
    
         
            +
                include T.def_steps(:c)
         
     | 
| 
      
 17 
     | 
    
         
            +
                step :c
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              it "allows connection with custom output of a nested activity" do
         
     | 
| 
      
 21 
     | 
    
         
            +
                create = Class.new(Trailblazer::Operation) do
         
     | 
| 
      
 22 
     | 
    
         
            +
                  include T.def_steps(:a, :d)
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                  step :a
         
     | 
| 
      
 25 
     | 
    
         
            +
                  step Nested(SignUp), Output(:db_error) => Track(:no_user)
         
     | 
| 
      
 26 
     | 
    
         
            +
                  step :d, magnetic_to: :no_user
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                result = create.(seq: [])
         
     | 
| 
      
 30 
     | 
    
         
            +
                result.inspect(:seq).must_equal %{<Result:true [[:a, :b, :d]] >}
         
     | 
| 
      
 31 
     | 
    
         
            +
                result.event.inspect.must_equal %{#<Trailblazer::Activity::Railway::End::Success semantic=:success>}
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
              it "allows connecting dynamically nested activities with custom output when auto wired" do
         
     | 
| 
      
 35 
     | 
    
         
            +
                create = Class.new(Trailblazer::Operation) do
         
     | 
| 
      
 36 
     | 
    
         
            +
                  def compute_nested(ctx, what:, **)
         
     | 
| 
      
 37 
     | 
    
         
            +
                    what
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                  include T.def_steps(:a, :d)
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                  step :a
         
     | 
| 
      
 43 
     | 
    
         
            +
                  step Nested(:compute_nested, auto_wire: [SignUp, SignIn]), Output(:db_error) => Track(:no_user)
         
     | 
| 
      
 44 
     | 
    
         
            +
                  step :d, magnetic_to: :no_user
         
     | 
| 
      
 45 
     | 
    
         
            +
                end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                result = create.(seq: [], what: SignUp)
         
     | 
| 
      
 48 
     | 
    
         
            +
                result.inspect(:seq).must_equal %{<Result:true [[:a, :b, :d]] >}
         
     | 
| 
      
 49 
     | 
    
         
            +
                result.event.inspect.must_equal %{#<Trailblazer::Activity::Railway::End::Success semantic=:success>}
         
     | 
| 
      
 50 
     | 
    
         
            +
              end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
              it "raises RuntimeError if dynamically nested activities with custom output are not auto wired" do
         
     | 
| 
      
 53 
     | 
    
         
            +
                exception = assert_raises RuntimeError do
         
     | 
| 
      
 54 
     | 
    
         
            +
                  Class.new(Trailblazer::Operation) do
         
     | 
| 
      
 55 
     | 
    
         
            +
                    def compute_nested(ctx, what:, **)
         
     | 
| 
      
 56 
     | 
    
         
            +
                      what
         
     | 
| 
      
 57 
     | 
    
         
            +
                    end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
                    step Nested(:compute_nested), Output(:db_error) => Track(:no_user)
         
     | 
| 
      
 60 
     | 
    
         
            +
                  end
         
     | 
| 
      
 61 
     | 
    
         
            +
                end
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
                exception.inspect.must_match 'No `db_error` output found'
         
     | 
| 
      
 64 
     | 
    
         
            +
              end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
              it "shows warning if `Nested()` is being used instead of `Subprocess()` for static activities" do
         
     | 
| 
      
 67 
     | 
    
         
            +
                _, warnings = capture_io do
         
     | 
| 
      
 68 
     | 
    
         
            +
                  Class.new(Trailblazer::Operation) do
         
     | 
| 
      
 69 
     | 
    
         
            +
                    step Nested(SignUp)
         
     | 
| 
      
 70 
     | 
    
         
            +
                  end
         
     | 
| 
      
 71 
     | 
    
         
            +
                end
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
                warnings.must_equal %Q{[Trailblazer]#{__FILE__}: Using the `Nested()` macro with operations and activities is deprecated. Replace `Nested(NestedTest::SignUp)` with `Subprocess(NestedTest::SignUp)`.
         
     | 
| 
      
 74 
     | 
    
         
            +
            }
         
     | 
| 
      
 75 
     | 
    
         
            +
              end
         
     | 
| 
      
 76 
     | 
    
         
            +
            end
         
     | 
    
        data/trailblazer-macro.gemspec
    CHANGED
    
    | 
         @@ -25,9 +25,8 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       25 
25 
     | 
    
         
             
              spec.add_development_dependency "roar"
         
     | 
| 
       26 
26 
     | 
    
         
             
              spec.add_development_dependency "trailblazer-developer"
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
              spec.add_dependency "trailblazer-activity", ">= 0. 
     | 
| 
       29 
     | 
    
         
            -
              spec.add_dependency "trailblazer- 
     | 
| 
       30 
     | 
    
         
            -
              spec.add_dependency "trailblazer-operation", ">= 0.6.2" # TODO: this dependency will be removed.
         
     | 
| 
      
 28 
     | 
    
         
            +
              spec.add_dependency "trailblazer-activity-dsl-linear", ">= 0.4.0", "< 0.5.0"
         
     | 
| 
      
 29 
     | 
    
         
            +
              spec.add_dependency "trailblazer-operation", ">= 0.7.0" # TODO: this dependency will be removed.
         
     | 
| 
       31 
30 
     | 
    
         | 
| 
       32 
31 
     | 
    
         
             
              spec.required_ruby_version = ">= 2.2.0"
         
     | 
| 
       33 
32 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: trailblazer-macro
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.1.7
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Nick Sutterer
         
     | 
| 
       8 
8 
     | 
    
         
             
            - Marc Tich
         
     | 
| 
       9 
     | 
    
         
            -
            autorequire: 
     | 
| 
      
 9 
     | 
    
         
            +
            autorequire:
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date:  
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2021-11-09 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -95,60 +95,40 @@ dependencies: 
     | 
|
| 
       95 
95 
     | 
    
         
             
                - - ">="
         
     | 
| 
       96 
96 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       97 
97 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       98 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       99 
     | 
    
         
            -
              name: trailblazer-activity
         
     | 
| 
       100 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       101 
     | 
    
         
            -
                requirements:
         
     | 
| 
       102 
     | 
    
         
            -
                - - ">="
         
     | 
| 
       103 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       104 
     | 
    
         
            -
                    version: 0.10.0
         
     | 
| 
       105 
     | 
    
         
            -
                - - "<"
         
     | 
| 
       106 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       107 
     | 
    
         
            -
                    version: 1.0.0
         
     | 
| 
       108 
     | 
    
         
            -
              type: :runtime
         
     | 
| 
       109 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       110 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       111 
     | 
    
         
            -
                requirements:
         
     | 
| 
       112 
     | 
    
         
            -
                - - ">="
         
     | 
| 
       113 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       114 
     | 
    
         
            -
                    version: 0.10.0
         
     | 
| 
       115 
     | 
    
         
            -
                - - "<"
         
     | 
| 
       116 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       117 
     | 
    
         
            -
                    version: 1.0.0
         
     | 
| 
       118 
98 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       119 
99 
     | 
    
         
             
              name: trailblazer-activity-dsl-linear
         
     | 
| 
       120 
100 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       121 
101 
     | 
    
         
             
                requirements:
         
     | 
| 
       122 
102 
     | 
    
         
             
                - - ">="
         
     | 
| 
       123 
103 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       124 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 104 
     | 
    
         
            +
                    version: 0.4.0
         
     | 
| 
       125 
105 
     | 
    
         
             
                - - "<"
         
     | 
| 
       126 
106 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       127 
     | 
    
         
            -
                    version:  
     | 
| 
      
 107 
     | 
    
         
            +
                    version: 0.5.0
         
     | 
| 
       128 
108 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       129 
109 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       130 
110 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       131 
111 
     | 
    
         
             
                requirements:
         
     | 
| 
       132 
112 
     | 
    
         
             
                - - ">="
         
     | 
| 
       133 
113 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       134 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 114 
     | 
    
         
            +
                    version: 0.4.0
         
     | 
| 
       135 
115 
     | 
    
         
             
                - - "<"
         
     | 
| 
       136 
116 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       137 
     | 
    
         
            -
                    version:  
     | 
| 
      
 117 
     | 
    
         
            +
                    version: 0.5.0
         
     | 
| 
       138 
118 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       139 
119 
     | 
    
         
             
              name: trailblazer-operation
         
     | 
| 
       140 
120 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       141 
121 
     | 
    
         
             
                requirements:
         
     | 
| 
       142 
122 
     | 
    
         
             
                - - ">="
         
     | 
| 
       143 
123 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       144 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 124 
     | 
    
         
            +
                    version: 0.7.0
         
     | 
| 
       145 
125 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       146 
126 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       147 
127 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       148 
128 
     | 
    
         
             
                requirements:
         
     | 
| 
       149 
129 
     | 
    
         
             
                - - ">="
         
     | 
| 
       150 
130 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       151 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 131 
     | 
    
         
            +
                    version: 0.7.0
         
     | 
| 
       152 
132 
     | 
    
         
             
            description: Macros for Trailblazer's operation
         
     | 
| 
       153 
133 
     | 
    
         
             
            email:
         
     | 
| 
       154 
134 
     | 
    
         
             
            - apotonick@gmail.com
         
     | 
| 
         @@ -157,10 +137,10 @@ executables: [] 
     | 
|
| 
       157 
137 
     | 
    
         
             
            extensions: []
         
     | 
| 
       158 
138 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       159 
139 
     | 
    
         
             
            files:
         
     | 
| 
      
 140 
     | 
    
         
            +
            - ".github/workflows/ci.yml"
         
     | 
| 
       160 
141 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
       161 
142 
     | 
    
         
             
            - ".rubocop.yml"
         
     | 
| 
       162 
143 
     | 
    
         
             
            - ".rubocop_todo.yml"
         
     | 
| 
       163 
     | 
    
         
            -
            - ".travis.yml"
         
     | 
| 
       164 
144 
     | 
    
         
             
            - CHANGES.md
         
     | 
| 
       165 
145 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       166 
146 
     | 
    
         
             
            - LICENSE
         
     | 
| 
         @@ -185,6 +165,7 @@ files: 
     | 
|
| 
       185 
165 
     | 
    
         
             
            - test/docs/wrap_test.rb
         
     | 
| 
       186 
166 
     | 
    
         
             
            - test/operation/integration_test.rb
         
     | 
| 
       187 
167 
     | 
    
         
             
            - test/operation/model_test.rb
         
     | 
| 
      
 168 
     | 
    
         
            +
            - test/operation/nested_test.rb
         
     | 
| 
       188 
169 
     | 
    
         
             
            - test/operation/pundit_test.rb
         
     | 
| 
       189 
170 
     | 
    
         
             
            - test/test_helper.rb
         
     | 
| 
       190 
171 
     | 
    
         
             
            - trailblazer-macro.gemspec
         
     | 
| 
         @@ -192,7 +173,7 @@ homepage: http://trailblazer.to 
     | 
|
| 
       192 
173 
     | 
    
         
             
            licenses:
         
     | 
| 
       193 
174 
     | 
    
         
             
            - LGPL-3.0
         
     | 
| 
       194 
175 
     | 
    
         
             
            metadata: {}
         
     | 
| 
       195 
     | 
    
         
            -
            post_install_message: 
     | 
| 
      
 176 
     | 
    
         
            +
            post_install_message:
         
     | 
| 
       196 
177 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       197 
178 
     | 
    
         
             
            require_paths:
         
     | 
| 
       198 
179 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -208,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       208 
189 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       209 
190 
     | 
    
         
             
            requirements: []
         
     | 
| 
       210 
191 
     | 
    
         
             
            rubygems_version: 3.0.8
         
     | 
| 
       211 
     | 
    
         
            -
            signing_key: 
     | 
| 
      
 192 
     | 
    
         
            +
            signing_key:
         
     | 
| 
       212 
193 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       213 
194 
     | 
    
         
             
            summary: 'Macros for Trailblazer''s operation: Policy, Wrap, Rescue and more.'
         
     | 
| 
       214 
195 
     | 
    
         
             
            test_files:
         
     | 
| 
         @@ -221,5 +202,6 @@ test_files: 
     | 
|
| 
       221 
202 
     | 
    
         
             
            - test/docs/wrap_test.rb
         
     | 
| 
       222 
203 
     | 
    
         
             
            - test/operation/integration_test.rb
         
     | 
| 
       223 
204 
     | 
    
         
             
            - test/operation/model_test.rb
         
     | 
| 
      
 205 
     | 
    
         
            +
            - test/operation/nested_test.rb
         
     | 
| 
       224 
206 
     | 
    
         
             
            - test/operation/pundit_test.rb
         
     | 
| 
       225 
207 
     | 
    
         
             
            - test/test_helper.rb
         
     |