Class: Fastlane::Saucectl::Installer
- Inherits:
-
Object
- Object
- Fastlane::Saucectl::Installer
show all
- Includes:
- FileUtils
- Defined in:
- lib/fastlane/plugin/saucectl/helper/installer.rb
Overview
This class provides the functions required to install the saucectl binary
Constant Summary
collapse
- 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
#download_saucectl_installer ⇒ Object
27
28
29
30
31
|
# File 'lib/fastlane/plugin/saucectl/helper/installer.rb', line 27
def download_saucectl_installer
URI.open('sauce', 'wb') do |file|
file << URI.open('https://saucelabs.github.io/saucectl/install', ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE).read
end
end
|
#execute_saucectl_installer(version) ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/fastlane/plugin/saucectl/helper/installer.rb', line 33
def execute_saucectl_installer(version)
saucectl_version = version[:version].nil? ? '' : "v#{version[:version]}"
status = system("sh sauce #{saucectl_version}")
status == 1 ? UI.user_error!("❌ failed to install saucectl") : status
executable = 'saucectl'
FileUtils.mv("bin/#{executable}", executable) unless File.exist?(executable)
end
|
#install(version) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/fastlane/plugin/saucectl/helper/installer.rb', line 15
def install(version)
timeout_in_seconds = 90
Timeout.timeout(timeout_in_seconds) do
download_saucectl_installer
execute_saucectl_installer(version)
UI.success("✅ Successfully installed saucectl runner binary 🚀")
rescue OpenURI::HTTPError => e
response = e.io
UI.user_error!("❌ Failed to install saucectl binary: status #{response.status[0]}")
end
end
|
#system(*cmd) ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/fastlane/plugin/saucectl/helper/installer.rb', line 41
def system(*cmd)
Open3.popen2e(*cmd) do |stdin, stdout_stderr, wait_thread|
Thread.new do
stdout_stderr.each do |out|
UI.message(out)
end
end
stdin.close
wait_thread.value
end
end
|