Class: ArduinoCI::ArduinoDownloaderWindows
- Inherits:
-
ArduinoDownloader
- Object
- ArduinoDownloader
- ArduinoCI::ArduinoDownloaderWindows
- Defined in:
- lib/arduino_ci/arduino_downloader_windows.rb
Overview
Manage the POSIX download & install of Arduino
Class Method Summary collapse
-
.extract(package_file) ⇒ bool
Extract the package_file to extracted_file.
-
.extracted_file ⇒ string
The local file (dir) name of the extracted IDE package (zip/tar/etc).
-
.extractor ⇒ string
The technology that will be used to extract the download (for logging purposes).
-
.force_installed_executable ⇒ Pathname
The executable Arduino file in a forced installation, or nil.
Instance Method Summary collapse
-
#download ⇒ bool
Download the package_url to package_file.
-
#package_file ⇒ string
The local filename of the desired IDE package (zip/tar/etc).
Methods inherited from ArduinoDownloader
autolocated_executable, downloader, #execute, existing_executable, #initialize, #install, must_implement, #package_url, #prepare
Constructor Details
This class inherits a constructor from ArduinoCI::ArduinoDownloader
Class Method Details
.extract(package_file) ⇒ bool
Extract the package_file to extracted_file
40 41 42 43 44 45 46 |
# File 'lib/arduino_ci/arduino_downloader_windows.rb', line 40 def self.extract(package_file) Zip::File.open(package_file) do |zip| zip.each do |file| file.extract(file.name) end end end |
.extracted_file ⇒ string
The local file (dir) name of the extracted IDE package (zip/tar/etc)
50 51 52 |
# File 'lib/arduino_ci/arduino_downloader_windows.rb', line 50 def self.extracted_file "arduino-cli.exe" end |
.extractor ⇒ string
The technology that will be used to extract the download (for logging purposes)
34 35 36 |
# File 'lib/arduino_ci/arduino_downloader_windows.rb', line 34 def self.extractor "Expand-Archive" end |
.force_installed_executable ⇒ Pathname
The executable Arduino file in a forced installation, or nil
56 57 58 |
# File 'lib/arduino_ci/arduino_downloader_windows.rb', line 56 def self.force_installed_executable Pathname.new(Host.windows_to_pathname(ENV['HOME'])) + self.extracted_file end |
Instance Method Details
#download ⇒ bool
Download the package_url to package_file
15 16 17 18 19 20 21 22 23 |
# File 'lib/arduino_ci/arduino_downloader_windows.rb', line 15 def download # Turned off ssl verification # This should be acceptable because it won't happen on a user's machine, just CI open(URI.parse(package_url), ssl_verify_mode: 0) do |url| File.open(package_file, 'wb') { |file| file.write(url.read) } end rescue Net::OpenTimeout, Net::ReadTimeout, OpenURI::HTTPError, URI::InvalidURIError => e @output.puts "\nArduino force-install failed downloading #{package_url}: #{e}" end |
#package_file ⇒ string
The local filename of the desired IDE package (zip/tar/etc)
27 28 29 |
# File 'lib/arduino_ci/arduino_downloader_windows.rb', line 27 def package_file "arduino-cli_#{@desired_version}_Windows_64bit.zip" end |