class ArduinoCI::ArduinoDownloaderWindows

Manage the POSIX download & install of Arduino

Public Class Methods

existing_executable() click to toggle source

The executable Arduino file in an existing installation, or nil @return [string]

# File lib/arduino_ci/arduino_downloader_windows.rb, line 33
def self.existing_executable
  Host.which("arduino-cli")
end
extract(package_file) click to toggle source

Extract the package_file to extracted_file @return [bool] whether successful

# File lib/arduino_ci/arduino_downloader_windows.rb, line 46
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() click to toggle source

The local file (dir) name of the extracted IDE package (zip/tar/etc) @return [string]

# File lib/arduino_ci/arduino_downloader_windows.rb, line 56
def self.extracted_file
  "arduino-cli.exe"
end
extracter() click to toggle source

The technology that will be used to extract the download (for logging purposes) @return [string]

# File lib/arduino_ci/arduino_downloader_windows.rb, line 40
def self.extracter
  "Expand-Archive"
end

Public Instance Methods

download() click to toggle source

Download the package_url to package_file @return [bool] whether successful

# 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() click to toggle source

The local filename of the desired IDE package (zip/tar/etc) @return [string]

# File lib/arduino_ci/arduino_downloader_windows.rb, line 27
def package_file
  "arduino-cli_#{@desired_version}_Windows_64bit.zip"
end