Class: ArduinoCI::ArduinoInstallation
- Inherits:
-
Object
- Object
- ArduinoCI::ArduinoInstallation
- Defined in:
- lib/arduino_ci/arduino_installation.rb
Overview
Manage the OS-specific install location of Arduino
Constant Summary collapse
- DESIRED_ARDUINO_CLI_VERSION =
"0.29.0".freeze
Class Method Summary collapse
-
.autolocate ⇒ ArduinoCI::ArduinoBackend
attempt to find a workable Arduino executable across platforms.
-
.autolocate!(output = $stdout) ⇒ ArduinoCI::ArduinoBackend
Attempt to find a workable Arduino executable across platforms, and install it if we don’t.
-
.force_install(output = $stdout, version = DESIRED_ARDUINO_CLI_VERSION) ⇒ bool
Forcibly install Arduino from the web.
Class Method Details
.autolocate ⇒ ArduinoCI::ArduinoBackend
attempt to find a workable Arduino executable across platforms
Autolocation assumed to be an expensive operation
23 24 25 26 27 28 29 30 31 32 33 34 |
# 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) ⇒ ArduinoCI::ArduinoBackend
Attempt to find a workable Arduino executable across platforms, and install it if we don’t
38 39 40 41 42 43 44 45 46 |
# 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) ⇒ bool
Forcibly install Arduino from the web
50 51 52 53 54 55 56 57 58 |
# 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 |