Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I call lanes with parameters from within my lane?

Tags:

ruby

fastlane

I have a Fastfile,and I want to all lanes with parameters from within my lane .How can do this? Just like this:

lane :my_lane do
     other_lane paramter1_name:"1" parameter2:"2"
end
like image 871
H.WZ Avatar asked Nov 30 '17 02:11

H.WZ


People also ask

What is Lane in fastlane?

Switching lanes fastlane takes care of all the magic for you. You can call lanes of the same platform or a general lane outside of the platform definition. Passing parameters is optional.

Is Fastfile a ruby?

The Fastfile is used to configure fastlane. Open it in your favourite text editor, using Ruby syntax highlighting. Defining lanes is easy. Make as many lanes as you like!


2 Answers

You should do it in this way:

lane :my_lane do
  other_lane(
    parameter1: '1', 
    parameter2: '2'
  )
end

Hope this helps!

So other lane should be

lane :other_lane do |values|
   parameter1  = values[:parameter1]
   parameter2  = values[:parameter2]
   puts parameter1
   puts parameter2
end
like image 187
Artem Demchenko Avatar answered Dec 14 '22 23:12

Artem Demchenko


this will also work

lane :other_lane do |values|
    parameterValue1 = values[:parameterKey1]  #read from arguments
    parameterValue2 = values[:parameterKey2]  #read from arguments

    #call other_lane with arguments
    other_lane parameterKey1:parameterValue1 parameterKey2:parameterValue2
end
like image 43
ir2pid Avatar answered Dec 14 '22 23:12

ir2pid