class ArduinoCI::ArduinoInstallation
Manage the OS-specific install location of Arduino
Constants
- DESIRED_ARDUINO_CLI_VERSION
Public Class Methods
autolocate()
click to toggle source
attempt to find a workable Arduino executable across platforms
Autolocation assumed to be an expensive operation @return [ArduinoCI::ArduinoBackend] an instance of the command or nil if it can't be found
# File lib/arduino_ci/arduino_installation.rb, line 23 def autolocate downloader_class = case Host.os when :osx then ArduinoDownloaderOSX when :linux then ArduinoDownloaderLinux when :windows then ArduinoDownloaderWindows end loc = downloader_class.autolocated_executable return nil if loc.nil? ArduinoBackend.new(loc) end
autolocate!(output = $stdout)
click to toggle source
Attempt to find a workable Arduino executable across platforms, and install it if we don't @return [ArduinoCI::ArduinoBackend] an instance of a command
# File lib/arduino_ci/arduino_installation.rb, line 38 def autolocate!(output = $stdout) candidate = autolocate return candidate unless candidate.nil? # force the install raise ArduinoInstallationError, "Failed to force-install Arduino" unless force_install(output) autolocate end
force_install(output = $stdout, version = DESIRED_ARDUINO_CLI_VERSION)
click to toggle source
Forcibly install Arduino from the web @return [bool] Whether the command succeeded
# File lib/arduino_ci/arduino_installation.rb, line 50 def force_install(output = $stdout, version = DESIRED_ARDUINO_CLI_VERSION) worker_class = case Host.os when :osx then ArduinoDownloaderOSX when :windows then ArduinoDownloaderWindows when :linux then ArduinoDownloaderLinux end worker = worker_class.new(version, output) worker.execute end