Class: ArduinoCI::ArduinoDownloaderLinux

Inherits:
ArduinoDownloader show all
Defined in:
lib/arduino_ci/arduino_downloader_linux.rb

Overview

Manage the linux download & install of Arduino

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ArduinoDownloader

autolocated_executable, #download, downloader, #execute, existing_executable, force_installed_executable, #initialize, #install, must_implement, #package_url

Constructor Details

This class inherits a constructor from ArduinoCI::ArduinoDownloader

Class Method Details

.extract(package_file) ⇒ bool

Extract the package_file to extracted_file

Returns:

  • (bool)

    whether successful



39
40
41
# File 'lib/arduino_ci/arduino_downloader_linux.rb', line 39

def self.extract(package_file)
  system(extractor, "xf", package_file, extracted_file)
end

.extracted_filestring

The local file (dir) name of the extracted IDE package (zip/tar/etc)

Returns:

  • (string)


16
17
18
# File 'lib/arduino_ci/arduino_downloader_linux.rb', line 16

def self.extracted_file
  "arduino-cli"
end

.extractorstring

The technology that will be used to extract the download (for logging purposes)

Returns:

  • (string)


33
34
35
# File 'lib/arduino_ci/arduino_downloader_linux.rb', line 33

def self.extractor
  "tar"
end

Instance Method Details

#package_filestring

The local filename of the desired IDE package (zip/tar/etc)

Returns:

  • (string)


10
11
12
# File 'lib/arduino_ci/arduino_downloader_linux.rb', line 10

def package_file
  "arduino-cli_#{@desired_version}_Linux_64bit.tar.gz"
end

#preparestring

Make any preparations or run any checks prior to making changes

Returns:

  • (string)

    Error message, or nil if success



22
23
24
25
26
27
28
# File 'lib/arduino_ci/arduino_downloader_linux.rb', line 22

def prepare
  reqs = [self.class.extractor]
  reqs.each do |req|
    return "#{req} does not appear to be installed!" unless Host.which(req)
  end
  nil
end