arduino_ci 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -24
- data/REFERENCE.md +91 -11
- data/cpp/arduino/Arduino.h +0 -5
- data/cpp/arduino/ArduinoDefines.h +3 -0
- data/cpp/arduino/Godmode.h +63 -6
- data/cpp/arduino/Wire.h +37 -13
- data/cpp/unittest/ArduinoUnitTests.h +32 -0
- data/cpp/unittest/Assertion.h +54 -26
- data/cpp/unittest/Compare.h +58 -51
- data/exe/arduino_ci.rb +186 -76
- data/lib/arduino_ci/arduino_backend.rb +18 -2
- data/lib/arduino_ci/ci_config.rb +5 -2
- data/lib/arduino_ci/host.rb +1 -1
- data/lib/arduino_ci/library_properties.rb +6 -1
- data/lib/arduino_ci/version.rb +1 -1
- data/misc/default.yml +2 -2
- metadata +2 -2
@@ -52,7 +52,7 @@ module ArduinoCI
|
|
52
52
|
# do some work to extract & merge environment variables if they exist
|
53
53
|
has_env = !args.empty? && args[0].instance_of?(Hash)
|
54
54
|
env_vars = has_env ? args[0] : {}
|
55
|
-
actual_args = has_env ? args[1
|
55
|
+
actual_args = has_env ? args[1..-1] : args # need to shift over if we extracted args
|
56
56
|
custom_config = @config_dir.nil? ? [] : ["--config-file", @config_dir.to_s]
|
57
57
|
full_args = [binary_path.to_s, "--format", "json"] + custom_config + actual_args
|
58
58
|
full_cmd = env_vars.empty? ? full_args : [env_vars] + full_args
|
@@ -113,10 +113,17 @@ module ArduinoCI
|
|
113
113
|
# @param boardname [String] The board to test
|
114
114
|
# @return [bool] Whether the board is installed
|
115
115
|
def board_installed?(boardname)
|
116
|
-
# capture_json("core", "list")[:json].find { |b| b["ID"] == boardname } # nope, this is for the family
|
117
116
|
run_and_capture("board", "details", "--fqbn", boardname)[:success]
|
118
117
|
end
|
119
118
|
|
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
|
+
|
120
127
|
# install a board by name
|
121
128
|
# @param name [String] the board name
|
122
129
|
# @return [bool] whether the command succeeded
|
@@ -129,6 +136,15 @@ module ArduinoCI
|
|
129
136
|
result[:success]
|
130
137
|
end
|
131
138
|
|
139
|
+
# Find out if a library is available
|
140
|
+
#
|
141
|
+
# @param name [String] the library name
|
142
|
+
# @return [bool] whether the library can be installed via the library manager
|
143
|
+
def library_available?(name)
|
144
|
+
# the --names flag limits the size of the response to just the name field
|
145
|
+
capture_json("lib", "search", "--names", name)[:json]["libraries"].any? { |l| l["name"] == name }
|
146
|
+
end
|
147
|
+
|
132
148
|
# @return [Hash] information about installed libraries via the CLI
|
133
149
|
def installed_libraries
|
134
150
|
capture_json("lib", "list")[:json]
|
data/lib/arduino_ci/ci_config.rb
CHANGED
@@ -57,20 +57,23 @@ module ArduinoCI
|
|
57
57
|
# @return [ArudinoCI::CIConfig] The configuration with defaults filled in
|
58
58
|
def default
|
59
59
|
ret = new
|
60
|
+
ret.instance_variable_set("@is_default", true)
|
60
61
|
ret.load_yaml(File.expand_path("../../misc/default.yml", __dir__))
|
61
62
|
ret
|
62
63
|
end
|
63
64
|
end
|
64
65
|
|
66
|
+
attr_reader :is_default
|
65
67
|
attr_accessor :package_info
|
66
68
|
attr_accessor :platform_info
|
67
69
|
attr_accessor :compile_info
|
68
70
|
attr_accessor :unittest_info
|
69
71
|
|
70
72
|
def initialize
|
71
|
-
@
|
73
|
+
@is_default = false
|
74
|
+
@package_info = {}
|
72
75
|
@platform_info = {}
|
73
|
-
@compile_info
|
76
|
+
@compile_info = {}
|
74
77
|
@unittest_info = {}
|
75
78
|
end
|
76
79
|
|
data/lib/arduino_ci/host.rb
CHANGED
@@ -103,7 +103,7 @@ module ArduinoCI
|
|
103
103
|
the_file = path.basename.to_s
|
104
104
|
|
105
105
|
stdout, _stderr, _exitstatus = Open3.capture3('cmd.exe', "/c dir /al #{the_dir}")
|
106
|
-
symlinks = stdout.lines.map { |l| DIR_SYMLINK_REGEX.match(l) }.compact
|
106
|
+
symlinks = stdout.lines.map { |l| DIR_SYMLINK_REGEX.match(l.scrub) }.compact
|
107
107
|
our_link = symlinks.find { |m| m[1] == the_file }
|
108
108
|
return nil if our_link.nil?
|
109
109
|
|
@@ -24,7 +24,12 @@ module ArduinoCI
|
|
24
24
|
|
25
25
|
# @return [Hash] the properties as a hash, all strings
|
26
26
|
def to_h
|
27
|
-
@fields.
|
27
|
+
Hash[@fields.map { |k, _| [k.to_sym, send(k)] }]
|
28
|
+
end
|
29
|
+
|
30
|
+
# @return [String] the string representation
|
31
|
+
def to_s
|
32
|
+
to_h.to_s
|
28
33
|
end
|
29
34
|
|
30
35
|
# Enable a shortcut syntax for library property accessors, in the style of `attr_accessor` metaprogramming.
|
data/lib/arduino_ci/version.rb
CHANGED
data/misc/default.yml
CHANGED
@@ -16,7 +16,7 @@ packages:
|
|
16
16
|
adafruit:samd:
|
17
17
|
url: https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
|
18
18
|
esp32:esp32:
|
19
|
-
url: https://
|
19
|
+
url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
|
20
20
|
|
21
21
|
platforms:
|
22
22
|
|
@@ -70,7 +70,7 @@ platforms:
|
|
70
70
|
warnings:
|
71
71
|
flags:
|
72
72
|
esp8266:
|
73
|
-
board: esp8266:esp8266:huzzah:
|
73
|
+
board: esp8266:esp8266:huzzah:eesz=4M3M,xtal=80
|
74
74
|
package: esp8266:esp8266
|
75
75
|
gcc:
|
76
76
|
features:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arduino_ci
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Katz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: os
|