fastlane可以在某些车道中跳过`before_all`或`after_all`吗?

问题描述:

我想知道是否有某种方法可以跳过某些/特定车道的before_allafter_all块?fastlane可以在某些车道中跳过`before_all`或`after_all`吗?

谢谢!

一种方式做到这一点:

before_all do |lane| 
    if lane == :test 
    puts "Do something for test" 
    else 
    puts "foo" 
    end 
end 

除了涉及您的评论

lanes = [:test, :foo, :bar] 
lanes.include?(:test) # => true 
lanes.include?(:baz) # => false 

所以你可以做这样的事情

before_all do |lane| 
    lanes_to_say_foo = [:test, :build, :other] 
    if lanes_to_say_foo.include?(lane) 
    puts "Foo" 
    end 
end 
+0

真棒!谢谢!但是我们想要多条车道的条件?有没有像“某些车道中的一条车道”? – user805981

+0

是的,你可以使用'if [:test,:beta] .include?(lane)'。这是所有标准的红宝石,你可以使用:) – KrauseFx

+0

我把这个添加到我的答案:-) –