-
Notifications
You must be signed in to change notification settings - Fork 16
Migration 2.1.rc1 to 2.1.rc11
Emanuele Magliozzi edited this page Aug 29, 2019
·
13 revisions
Since between 2.1.rc1 and 2.1.rc12 there's a significant (but necessary) internal refactoring, we decided to have a rather odd version jump.
The following Gemfile
works. Note that you don't have to use all listed gems.
gem "trailblazer", ">= 2.1.0.rc12"
group :development, :test do
gem "trailblazer-test"
gem "trailblazer-developer"
end
Before
module Create
extend Trailblazer::Activity::Railway()
module_function
step :a, Output(:success) => :some_id
step :b, Output(:success) => :track
step :c, magnetic_to: [:track]
end
Now
class Create < Trailblazer::Activity::Railway
step :a, Output(:success) => Id(:some_id )
step :b, Output(:success) => Track(:track)
step :c, magnetic_to: :track
end
Before
module Create
extend Trailblazer::Activity::Railway()
module_function
def a(ctx, *)
end
step method(:a)
end
Now
class Create < Trailblazer::Activity::Railway
def self.a(ctx, *) # class method!
end
step method(:a)
end
In case the fast_track
functionality has been used the new activity class must be inherited from Trailblazer::Activity::FastTrack
and also Railway
becomes Trailblazer::Operation::Railway
.
Before
module Create
extend Trailblazer::Activity::FastTrack()
module_function
def a(ctx, *)
.....
Railway.pass_fast!
end
step method(:a), fast_track: true
end
Now
class Create < Trailblazer::Activity::FastTrack()
def a(ctx, *)
.....
Trailblazer::Operation::Railway.pass_fast!
end
step method(:a), fast_track: true
end
For both Operation and Activity, a block in a Macro which return a fast_track
signal needs to be wired to the external object
Before
class Create < Trailblazer::Operation
step :start
step Rescue(handler: :my_handler) {
step :test
step :fail_test, fast_track: true
}
......
end
Now
class Create < Trailblazer::Operation
step :start
step Rescue(handler: :my_handler) {
step :test
step :fail_test, fast_track: true
}, fast_track: true # need to add the fast_track option to the external step as well
......
end
:input
and :output
in Nested(..)