Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can fastlane skip `before_all` or `after_all` in certain lanes?

Tags:

ios

fastlane

I was wondering if there is a way for certain lanes to skip the before_all or after_all blocks for certain/specified lanes?

Thanks!

like image 329
user805981 Avatar asked Jan 11 '17 15:01

user805981


1 Answers

One way to do this:

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

addition relating to your comment

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

so you can do something like

before_all do |lane|
  lanes_to_say_foo = [:test, :build, :other]
  if lanes_to_say_foo.include?(lane)
    puts "Foo"
  end
end
like image 185
Christoph P. Avatar answered Oct 10 '22 14:10

Christoph P.