4
4
require 'pathname'
5
5
6
6
WIDTH = 80
7
+ FIND_FILES_INDENT = 4
7
8
8
9
@failure_count = 0
9
10
@passfail = proc { |result | result ? "✓" : "✗" }
@@ -83,6 +84,22 @@ def assured_platform(purpose, name, config)
83
84
platform_definition
84
85
end
85
86
87
+ # print out some files
88
+ def display_files ( pathname )
89
+ # `find` doesn't follow symlinks, so we should instead
90
+ realpath = pathname . symlink? ? pathname . readlink : pathname
91
+
92
+ # suppress directories and dotfile-based things
93
+ all_files = realpath . find . select ( &:file? )
94
+ non_hidden = all_files . reject do |path |
95
+ path . ascend . any? { |part | part . basename . to_s . start_with? "." }
96
+ end
97
+
98
+ # print files with an indent
99
+ margin = " " * FIND_FILES_INDENT
100
+ non_hidden . each { |p | puts "#{ margin } #{ p } " }
101
+ end
102
+
86
103
# initialize command and config
87
104
config = ArduinoCI ::CIConfig . default . from_project_library
88
105
@arduino_cmd = ArduinoCI ::ArduinoInstallation . autolocate!
@@ -98,7 +115,7 @@ def assured_platform(purpose, name, config)
98
115
@arduino_cmd . lib_dir . ascend do |path_part |
99
116
next unless path_part . exist?
100
117
101
- break puts path_part . find . to_a . to_s
118
+ break display_files ( path_part )
102
119
end
103
120
false
104
121
end
@@ -161,12 +178,14 @@ def assured_platform(purpose, name, config)
161
178
last_board = nil
162
179
if !cpp_library . tests_dir . exist?
163
180
inform_multiline ( "Skipping unit tests; no tests dir at #{ cpp_library . tests_dir } " ) do
164
- puts cpp_library . tests_dir . parent . find . to_a . to_s
181
+ puts " In case that's an error, this is what was found in the library:"
182
+ display_files ( cpp_library . tests_dir . parent )
165
183
true
166
184
end
167
185
elsif cpp_library . test_files . empty?
168
186
inform_multiline ( "Skipping unit tests; no test files were found in #{ cpp_library . tests_dir } " ) do
169
- puts cpp_library . tests_dir . find . to_a . to_s
187
+ puts " In case that's an error, this is what was found in the tests directory:"
188
+ display_files ( cpp_library . tests_dir )
170
189
true
171
190
end
172
191
elsif config . platforms_to_unittest . empty?
@@ -202,7 +221,7 @@ def assured_platform(purpose, name, config)
202
221
203
222
if library_examples . empty?
204
223
inform_multiline ( "Skipping libraries; no examples found in #{ installed_library_path } " ) do
205
- puts installed_library_path . find . to_a . to_s
224
+ display_files ( installed_library_path )
206
225
end
207
226
else
208
227
attempt ( "Setting compiler warning level" ) { @arduino_cmd . set_pref ( "compiler.warning_level" , "all" ) }
0 commit comments