在env文件中为快照定义数组(Define array in env file for snapshot)

在我的项目中,我有几个目标来构建我的应用程序的几个变体。 为了使用快照处理这个问题,我使用了如下所述的环境: https : //github.com/fastlane/fastlane/blob/master/docs/Advanced.md#environment-variables

它适用于定义我的方案,但我没有设法将它用于语言。

.env.first_environment

SCHEME = MyScheme LANGUAGES = en-GB,es-ES

Snapfile

languages([ ENV['LANGUAGES'] ]) # The name of the scheme which contains the UI Tests scheme ENV['SCHEME']

如果我只有一种语言可以工作,但只要env变量中有逗号,我就会遇到一些问题。 当我启动fastlane时,我有:

+----------------------------+------------------------------+ | Summary for snapshot 1.2.2 | +----------------------------+------------------------------+ | workspace | ./my_app.xcworkspace | | devices | ["iPhone 4s"] | | languages | ["en-GB,es-ES"] | | output_directory | ./fastlane/Snapshots/MyScheme| | ios_version | 9.1 | | stop_after_first_error | false | | skip_open_summary | false | | clear_previous_screenshots | false | | buildlog_path | ~/Library/Logs/snapshot | | clean | false | | scheme | My-Scheme | +----------------------------+------------------------------+

对于语言选项,我有"en-GB,es-ES"而不是"en-GB","es-ES" 。

In my projet I have several targets to build several variants of my app. In order to handle this with snapshot, I use environnements as described here: https://github.com/fastlane/fastlane/blob/master/docs/Advanced.md#environment-variables

It works fine for defining my scheme but I do not manage to use it for languages.

.env.first_environment

SCHEME = MyScheme LANGUAGES = en-GB,es-ES

Snapfile

languages([ ENV['LANGUAGES'] ]) # The name of the scheme which contains the UI Tests scheme ENV['SCHEME']

If I have only one language it works, but as soon as there is a comma in the env variable, I have some problems. When I launch fastlane I have:

+----------------------------+------------------------------+ | Summary for snapshot 1.2.2 | +----------------------------+------------------------------+ | workspace | ./my_app.xcworkspace | | devices | ["iPhone 4s"] | | languages | ["en-GB,es-ES"] | | output_directory | ./fastlane/Snapshots/MyScheme| | ios_version | 9.1 | | stop_after_first_error | false | | skip_open_summary | false | | clear_previous_screenshots | false | | buildlog_path | ~/Library/Logs/snapshot | | clean | false | | scheme | My-Scheme | +----------------------------+------------------------------+

For the language option I have "en-GB,es-ES" instead of "en-GB","es-ES".

最满意答案

来自@AliSoftware的回答:

在env文件中

... LANGUAGES = "en-GB,es-ES" ...

在Snapfile中

... languages( ENV['LANGUAGES'].split(",") ) ...

谢谢。

Answer from @AliSoftware:

In env file

... LANGUAGES = "en-GB,es-ES" ...

In Snapfile

... languages( ENV['LANGUAGES'].split(",") ) ...

Thanks.

更多推荐