Reputation: 4302
I'm setting up a Fastfile
for fastlane
, and I'm trying to switch on the lane name that fastlane is beeing run with.
Say I run fastlane wow
In this Fastfile
, I want to get the name of the current lane that fastlane
was called with, which is "wow"
:
wowness = (lane[:lane-name] == "wow" ? "Much wow" : "Not so wow")
puts wowness
lane :wow do |options|
puts "print something random"
end
As far as I understand the fastlane
uses Ruby, so maybe this could be the way to go?
Upvotes: 3
Views: 2240
Reputation: 696
ENV["FASTLANE_LANE_NAME"]
# or
lane_context[SharedValues::LANE_NAME]
ref: https://docs.fastlane.tools/advanced/lanes/#lane-properties
Upvotes: 6
Reputation: 4302
Nevermind, I think i got it. I made this nifty little lane:
lane :get_lane_name do
lanename = ""
ARGV.each do |a|
lanename = "#{a}"
end
lanename
end
I use it like this:
build_type = (get_lane_name == "beta" ? "Staging" : "Production")
puts build_type
Upvotes: 4