Class: ArduinoCI::ArduinoDownloaderOSX

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

Overview

Manage the OSX download & install of Arduino

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ArduinoDownloader

autolocated_executable, autolocated_installation, #download, #downloader, #execute, #extract, #extracter, #initialize, #install, must_implement, #package_url, #prepare

Constructor Details

This class inherits a constructor from ArduinoCI::ArduinoDownloader

Class Method Details

.existing_executablestring

The executable Arduino file in an existing installation, or nil

Returns:

  • (string)
 51 52 53
# File 'lib/arduino_ci/arduino_downloader_osx.rb', line 51 def self.existing_executable self.find_existing_arduino_exe(["/Applications/Arduino.app"]) end

.existing_installationstring

The path to the directory of an existing installation, or nil

Returns:

  • (string)
 45 46 47
# File 'lib/arduino_ci/arduino_downloader_osx.rb', line 45 def self.existing_installation self.find_existing_arduino_dir(["/Applications/Arduino.app"]) end

.find_existing_arduino_dir(paths) ⇒ string

An existing Arduino directory in one of the given directories, or nil

Parameters:

  • Array (string)

    a list of places to look

Returns:

  • (string)
 29 30 31
# File 'lib/arduino_ci/arduino_downloader_osx.rb', line 29 def self.find_existing_arduino_dir(paths) paths.find(&File.method(:exist?)) end

.find_existing_arduino_exe(paths) ⇒ string

An existing Arduino file in one of the given directories, or nil

Parameters:

  • Array (string)

    a list of places to look for the executable

Returns:

  • (string)
 36 37 38 39 40 41
# File 'lib/arduino_ci/arduino_downloader_osx.rb', line 36 def self.find_existing_arduino_exe(paths) paths.find do |path| exe = File.join(path, "MacOS", "Arduino") File.exist? exe end end

.force_install_locationString

Returns The location where a forced install will go.

Returns:

  • (String)

    The location where a forced install will go

 21 22 23 24
# File 'lib/arduino_ci/arduino_downloader_osx.rb', line 21 def self.force_install_location # include the .app extension  File.join(ENV['HOME'], 'Arduino.app') end

.force_installed_executablestring

The executable Arduino file in a forced installation, or nil

Returns:

  • (string)
 57 58 59
# File 'lib/arduino_ci/arduino_downloader_osx.rb', line 57 def self.force_installed_executable self.find_existing_arduino_exe([self.force_install_location]) end

Instance Method Details

#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_osx.rb', line 16 def extracted_file "Arduino.app" end

#package_filestring

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

Returns:

  • (string)
 10 11 12
# File 'lib/arduino_ci/arduino_downloader_osx.rb', line 10 def package_file "arduino-#{@desired_ide_version}-macosx.zip" end