传入变量为import_from_git
问题描述:
我想为我的项目有一个通用的Fastlane文件。在每个项目中,我只想设置一些文件需要的变量。传入变量为import_from_git
我想象中的自定义中fastfile应该是这个样子:
myVariable = "Tank"
myArray = ["1", "2", "3", "let's go"]
import_from_git(url: '[email protected]:foo/FastlaneFiles.git', path: 'Fastfile')
但是,这不会工作,我认为它预计的定义是在一个车道。我该如何定义变量,以便通用的Fastlane可以使用它们? (我不喜欢设置环境变量)
答
这里的技巧,当你的Fastfile运行时,self
是一个Ruby Fastfile
实例。因此,这意味着你可以很简单的地方添加一个实例变量:
@myVariable = "Tank" @myArray = ["1", "2", "3", "let's go"]
这将提供给已导入实例变量@myVariable
你的其他中fastfile。