Skip to content

Commit 2874fac

Browse files
authored
Also support newlines as separator for testers, groups, devices, and test case IDs files. (#384)
1 parent c8bb9e2 commit 2874fac

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_action.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ def self.test_release(alpha_client, release, test_devices, test_cases, username
393393
end
394394
end
395395

396-
device_executions = string_to_array(test_devices, ';').map do |td_string|
396+
device_executions = string_to_array(test_devices, /[;\n]/).map do |td_string|
397397
td_hash = parse_test_device_string(td_string)
398398
Google::Apis::FirebaseappdistributionV1alpha::GoogleFirebaseAppdistroV1alphaDeviceExecution.new(
399399
device: Google::Apis::FirebaseappdistributionV1alpha::GoogleFirebaseAppdistroV1alphaTestDevice.new(

lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def get_value_from_value_or_file(value, path)
3030

3131
# Returns the array representation of a string with trimmed comma
3232
# seperated values.
33-
def string_to_array(string, delimiter = ",")
33+
def string_to_array(string, delimiter = /[,\n]/)
3434
return [] if string.nil?
3535
# Strip string and then strip individual values
3636
string.strip.split(delimiter).map(&:strip)

spec/firebase_app_distribution_helper_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@
8484
array = helper.string_to_array(" ")
8585
expect(array).to eq([])
8686
end
87+
88+
it 'returns an array when the string is seperated by newlines' do
89+
array = helper.string_to_array("string1\n string2 \nstring3\n")
90+
expect(array).to eq(%w[string1 string2 string3])
91+
end
92+
93+
it 'returns an array when the string is seperated by semicolons and/or newlines when asked to do so' do
94+
array = helper.string_to_array("string1;string2\nstring3\n", /[;\n]/)
95+
expect(array).to eq(%w[string1 string2 string3])
96+
end
8797
end
8898

8999
describe '#get_ios_app_id_from_archive_plist' do

0 commit comments

Comments
 (0)