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 ⇒ Object
33
34
35
36
37
38
|
# File 'lib/fastlane/plugin/saucectl/helper/installer.rb', line 33
def execute_saucectl_installer
status = system('sh sauce')
status == 1 ? UI.user_error!("❌ failed to install saucectl") : status
executable = 'saucectl'
FileUtils.mv("bin/#{executable}", executable) unless File.exist?(executable)
end
|
#install ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/fastlane/plugin/saucectl/helper/installer.rb', line 15
def install
timeout_in_seconds = 30
Timeout.timeout(timeout_in_seconds) do
download_saucectl_installer
execute_saucectl_installer
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
40
41
42
43
44
45
46
47
48
|
# File 'lib/fastlane/plugin/saucectl/helper/installer.rb', line 40
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
|