Sha256: edfdce9200748fc506a506fee56726405567d99d8e21c7beabbbb7dfa7a28015

Contents?: true

Size: 1.27 KB

Versions: 461

Compression:

Stored size: 1.27 KB

Contents

require "fastlane_core"

module Pilot
  class TesterImporter < Manager
    def import_testers(options)
      UI.user_error!("Import file path is required") unless options[:testers_file_path]

      start(options)

      require 'csv'

      file = config[:testers_file_path]
      tester_manager = Pilot::TesterManager.new
      imported_tester_count = 0

      groups = options[:groups]

      CSV.foreach(file, "r") do |row|
        first_name, last_name, email, testing_groups = row

        unless email
          UI.error("No email found in row: #{row}")
          next
        end

        unless email.index("@")
          UI.error("No email found in row: #{row}")
          next
        end

        # Add this the existing config hash to pass it to the TesterManager
        config[:first_name] = first_name
        config[:last_name] = last_name
        config[:email] = email
        config[:groups] = groups
        if testing_groups
          config[:groups] = testing_groups.split(";")
        end

        begin
          tester_manager.add_tester(config)
          imported_tester_count += 1
        rescue
          # do nothing, move on to the next row
        end
      end

      UI.success("Successfully imported #{imported_tester_count} testers from #{file}")
    end
  end
end

Version data entries

461 entries across 461 versions & 2 rubygems

Version Path
fastlane-2.65.0.beta.20171107010003 pilot/lib/pilot/tester_importer.rb
fastlane-2.64.0 pilot/lib/pilot/tester_importer.rb
fastlane-2.64.0.beta.20171106010003 pilot/lib/pilot/tester_importer.rb
fastlane-2.64.0.beta.20171105010003 pilot/lib/pilot/tester_importer.rb
fastlane-2.64.0.beta.20171104010004 pilot/lib/pilot/tester_importer.rb
fastlane-2.64.0.beta.20171103010004 pilot/lib/pilot/tester_importer.rb
fastlane-2.64.0.beta.20171102010003 pilot/lib/pilot/tester_importer.rb
fastlane-2.64.0.beta.20171101010004 pilot/lib/pilot/tester_importer.rb
fastlane-2.63.0 pilot/lib/pilot/tester_importer.rb
fastlane-2.63.0.beta.20171031010003 pilot/lib/pilot/tester_importer.rb
fastlane-2.63.0.beta.20171030010003 pilot/lib/pilot/tester_importer.rb
fastlane-2.63.0.beta.20171029010003 pilot/lib/pilot/tester_importer.rb
fastlane-2.63.0.beta.20171028010003 pilot/lib/pilot/tester_importer.rb
fastlane-2.63.0.beta.20171027010003 pilot/lib/pilot/tester_importer.rb
fastlane-2.63.0.beta.20171026010003 pilot/lib/pilot/tester_importer.rb
fastlane-2.63.0.beta.20171025010003 pilot/lib/pilot/tester_importer.rb
fastlane-2.63.0.beta.20171024010003 pilot/lib/pilot/tester_importer.rb
fastlane-2.62.1 pilot/lib/pilot/tester_importer.rb
fastlane-2.63.0.beta.20171023010003 pilot/lib/pilot/tester_importer.rb
fastlane-2.63.0.beta.20171022010003 pilot/lib/pilot/tester_importer.rb