Skip to content

Commit 6926ecb

Browse files
committed
Add ArduinoBackend.boards_installed?
1 parent dfa2565 commit 6926ecb

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1717
- `Wire.resetMocks()` and documentation
1818
- `shiftIn()` and `shiftOut()`
1919
- `CIConfig.is_default` to detect when the default configuration is used
20+
- `ArduinoBackend.boards_installed?` to detect whether a board family (or package, like `arduino:avr`) is installed
2021

2122
### Changed
2223
- Rubocop expected syntax downgraded from ruby 2.6 to 2.5

lib/arduino_ci/arduino_backend.rb

+8-1
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,17 @@ def board_manager_urls=(all_urls)
113113
# @param boardname [String] The board to test
114114
# @return [bool] Whether the board is installed
115115
def board_installed?(boardname)
116-
# capture_json("core", "list")[:json].find { |b| b["ID"] == boardname } # nope, this is for the family
117116
run_and_capture("board", "details", "--fqbn", boardname)[:success]
118117
end
119118

119+
# check whether a board family is installed (e.g. arduino:avr)
120+
#
121+
# @param boardfamily_name [String] The board family to test
122+
# @return [bool] Whether the board is installed
123+
def boards_installed?(boardfamily_name)
124+
capture_json("core", "list")[:json].any? { |b| b["ID"] == boardfamily_name }
125+
end
126+
120127
# install a board by name
121128
# @param name [String] the board name
122129
# @return [bool] whether the command succeeded

0 commit comments

Comments
 (0)