Sha256: c4825974f4b0d349459d48a9c55a1bce84df2828cd255775b0761817dfd8eae7

Contents?: true

Size: 1.36 KB

Versions: 485

Compression:

Stored size: 1.36 KB

Contents

require_relative 'module'
require_relative 'manager'
require_relative 'tester_manager'

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 => exception
          UI.error("Error adding tester #{email}: #{exception}")
        end
      end

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

Version data entries

485 entries across 485 versions & 5 rubygems

Version Path
fastlane-2.115.0.beta.20190127200030 pilot/lib/pilot/tester_importer.rb
fastlane-2.115.0.beta.20190126200102 pilot/lib/pilot/tester_importer.rb
fastlane-2.115.0.beta.20190125200019 pilot/lib/pilot/tester_importer.rb
fastlane-2.115.0.beta.20190124200016 pilot/lib/pilot/tester_importer.rb
fastlane-2.115.0.beta.20190123200015 pilot/lib/pilot/tester_importer.rb
fastlane-2.115.0.beta.20190122200028 pilot/lib/pilot/tester_importer.rb
fastlane-2.115.0.beta.20190120200101 pilot/lib/pilot/tester_importer.rb
fastlane-2.115.0.beta.20190119200019 pilot/lib/pilot/tester_importer.rb
fastlane-2.115.0.beta.20190118200015 pilot/lib/pilot/tester_importer.rb
fastlane-2.115.0.beta.20190117200016 pilot/lib/pilot/tester_importer.rb
fastlane-2.114.0 pilot/lib/pilot/tester_importer.rb
fastlane-2.114.0.beta.20190116200018 pilot/lib/pilot/tester_importer.rb
fastlane-2.114.0.beta.20190115200110 pilot/lib/pilot/tester_importer.rb
fastlane-2.114.0.beta.20190114200053 pilot/lib/pilot/tester_importer.rb
fastlane-2.114.0.beta.20190113200019 pilot/lib/pilot/tester_importer.rb
fastlane-2.114.0.beta.20190112200032 pilot/lib/pilot/tester_importer.rb
fastlane-2.114.0.beta.20190111200053 pilot/lib/pilot/tester_importer.rb
fastlane-2.114.0.beta.20190110200051 pilot/lib/pilot/tester_importer.rb
fastlane-2.114.0.beta.20190109200053 pilot/lib/pilot/tester_importer.rb
fastlane-2.114.0.beta.20190108200048 pilot/lib/pilot/tester_importer.rb