spaceship/lib/spaceship/portal/ui/select_team.rb in fastlane-2.31.0.beta.20170515010044 vs spaceship/lib/spaceship/portal/ui/select_team.rb in fastlane-2.31.0.beta.20170516010048

- old
+ new

@@ -29,10 +29,24 @@ # {"personId"=>nil, "firstName"=>nil, "lastName"=>nil, "email"=>nil, "developerStatus"=>nil, "privileges"=>{}, "roles"=>["TEAM_ADMIN"], "teamMemberId"=>"HQR8N4GAAA"}, # "name"=>"Company GmbH"}, # {...} # ] + def self.ci? + if Object.const_defined?("FastlaneCore") && FastlaneCore.const_defined?("Helper") + return FastlaneCore::Helper.ci? + end + return false + end + + def self.interactive? + if Object.const_defined?("FastlaneCore") && FastlaneCore.const_defined?("Helper") + return FastlaneCore::Helper.interactive? + end + return true + end + def select_team teams = client.teams if teams.count == 0 puts "No teams available on the Developer Portal" @@ -61,9 +75,19 @@ end puts "Couldn't find team with Name '#{team_name}'" end return teams[0]['teamId'] if teams.count == 1 # user is just in one team + + unless self.class.interactive? + puts "Multiple teams found on the Developer Portal, Your Terminal is running in non-interactive mode! Cannot continue from here." + puts "Please check that you set FASTLANE_TEAM_ID or FASTLANE_TEAM_NAME to the right value." + puts "Available Teams:" + teams.each_with_index do |team, i| + puts "#{i + 1}) #{team['teamId']} \"#{team['name']}\" (#{team['type']})" + end + raise "Multiple Teams found; unable to choose, terminal not ineractive!" + end # User Selection loop do # Multiple teams, user has to select puts "Multiple teams found on the Developer Portal, please enter the number of the team you want to use: "