Class: Fastlane::Saucectl::Runner

Inherits:
Object
  • Object
show all
Includes:
FileUtils
Defined in:
lib/fastlane/plugin/saucectl/helper/runner.rb

Overview

This class provides the ability to execute tests via configured specifications and capture the output of the sauce executable.

Constant Summary collapse

EXECUTABLE =
'saucectl'
UI =
FastlaneCore::UI

Constants included from FileUtils

FileUtils::CLASS_NAME_REGEX, FileUtils::FILE_TYPE_REGEX

Instance Method Summary collapse

Methods included from FileUtils

#find, #read_file, #search_retrieve_test_classes, #syscall

Instance Method Details

#executeObject



16
17
18
19
20
21
22
23
# File 'lib/fastlane/plugin/saucectl/helper/runner.rb', line 16

def execute
  unless File.exist?(EXECUTABLE)
    UI.user_error!("❌ sauce labs executable file does not exist! Expected sauce executable file to be located at:'#{Dir.pwd}/#{EXECUTABLE}'")
  end

  system("chmod +x #{EXECUTABLE}")
  system("./#{EXECUTABLE} run")
end

#system(*cmd) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/fastlane/plugin/saucectl/helper/runner.rb', line 25

def system(*cmd)
  Open3.popen2e(*cmd) do |stdin, stdout_stderr, wait_thread|
    Thread.new do
      stdout_stderr.each { |out| UI.message(out) }
    end
    stdin.close
    wait_thread.value
  end
end