Skip to content

Commit 6dcc33e

Browse files
committed
Add arduino_library_location.rb script
1 parent f159abb commit 6dcc33e

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
88
### Added
99
- `ArduinoInstallation` and `ArduinoDownloader` now allow console output to optionally be set to an `IO` object of choice during `force_install`
1010
- `ArduinoInstallation::force_install` now optionally accepts a version string
11+
- `arduino_library_location.rb` script to print Arduino library location to stdout
1112

1213
### Changed
1314
- Unit tests and examples are now executed alphabetically by filename

REFERENCE.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ However, more flexible usage is available:
138138

139139
Sometimes you need a fork of an Arduino library instead of the version that will be installed via their GUI. `arduino_ci_remote.rb` won't overwrite existing downloaded libraries with fresh downloads, but it won't fetch the custom versions for you either.
140140

141-
If this is the behavior you need, `ensure_arduino_installation.rb` is for you.
141+
If this is the behavior you need, `ensure_arduino_installation.rb` is for you. It ensures that an Arduino binary is available on the system.
142142

143143
```shell
144144
# Example build script
@@ -147,14 +147,20 @@ bundle install
147147
# ensure the Arduino installation -- creates the Library directory
148148
bundle exec ensure_arduino_installation.rb
149149
150-
# manually install the custom version you need
150+
# manually install a custom library from a zip file
151+
wget https://hosting.com/custom_library.zip
152+
unzip -o custom_library.zip
153+
mv custom_library $(bundle exec arduino_library_location.rb)
154+
155+
# manually install a custom library from a git repository
151156
git clone https://repository.com/custom_library_repo.git
152-
mv custom_library_repo /path/to/Arduino/libraries
157+
mv custom_library_repo $(bundle exec arduino_library_location.rb)
153158
154159
# now run CI
155160
bundle exec arduino_ci_remote.rb
156161
```
157162

163+
Note the use of subshell to execute `bundle exec arduino_library_location.rb`. This command simply returns the directory in which Arduino Libraries are (or should be) installed.
158164

159165

160166

exe/arduino_library_location.rb

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env ruby
2+
require 'arduino_ci'
3+
4+
# locate and/or forcibly install Arduino, keep stdout clean
5+
@arduino_cmd = ArduinoCI::ArduinoInstallation.autolocate!($stderr)
6+
7+
puts @arduino_cmd.lib_dir

0 commit comments

Comments
 (0)