arduino_ci 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +15 -7
- data/cpp/arduino/Arduino.h +65 -3
- data/cpp/arduino/Godmode.cpp +1 -0
- data/cpp/arduino/Godmode.h +5 -0
- data/cpp/arduino/WString.h +16 -3
- data/exe/arduino_ci_remote.rb +1 -1
- data/lib/arduino_ci/arduino_cmd.rb +1 -1
- data/lib/arduino_ci/arduino_cmd_windows.rb +34 -0
- data/lib/arduino_ci/arduino_downloader.rb +204 -0
- data/lib/arduino_ci/arduino_downloader.rb.orig +219 -0
- data/lib/arduino_ci/arduino_downloader_linux.rb +86 -0
- data/lib/arduino_ci/arduino_downloader_linux.rb.orig +79 -0
- data/lib/arduino_ci/arduino_downloader_osx.rb +66 -0
- data/lib/arduino_ci/arduino_downloader_osx.rb.orig +88 -0
- data/lib/arduino_ci/arduino_downloader_windows.rb +101 -0
- data/lib/arduino_ci/arduino_installation.rb +58 -79
- data/lib/arduino_ci/arduino_installation.rb.orig +116 -0
- data/lib/arduino_ci/display_manager.rb +1 -0
- data/lib/arduino_ci/host.rb +11 -0
- data/lib/arduino_ci/version.rb +1 -1
- data/lib/arduino_ci.rb +1 -1
- metadata +27 -4
@@ -1,10 +1,14 @@
|
|
1
1
|
require "arduino_ci/host"
|
2
2
|
require "arduino_ci/arduino_cmd_osx"
|
3
3
|
require "arduino_ci/arduino_cmd_linux"
|
4
|
+
require "arduino_ci/arduino_cmd_windows"
|
4
5
|
require "arduino_ci/arduino_cmd_linux_builder"
|
6
|
+
require "arduino_ci/arduino_downloader_osx"
|
7
|
+
require "arduino_ci/arduino_downloader_linux"
|
8
|
+
|
9
|
+
require "arduino_ci/arduino_downloader_windows" if ArduinoCI::Host.os == :windows
|
5
10
|
|
6
11
|
DESIRED_ARDUINO_IDE_VERSION = "1.8.5".freeze
|
7
|
-
USE_BUILDER = false
|
8
12
|
|
9
13
|
module ArduinoCI
|
10
14
|
|
@@ -12,75 +16,67 @@ module ArduinoCI
|
|
12
16
|
class ArduinoInstallation
|
13
17
|
|
14
18
|
class << self
|
15
|
-
# @return [String] The location where a forced install will go
|
16
|
-
def force_install_location
|
17
|
-
File.join(ENV['HOME'], 'arduino_ci_ide')
|
18
|
-
end
|
19
19
|
|
20
20
|
# attempt to find a workable Arduino executable across platforms
|
21
|
-
#
|
21
|
+
#
|
22
|
+
# Autolocation assumed to be an expensive operation
|
23
|
+
# @return [ArduinoCI::ArduinoCmd] an instance of the command or nil if it can't be found
|
22
24
|
def autolocate
|
25
|
+
ret = nil
|
23
26
|
case Host.os
|
24
|
-
when :osx then
|
25
|
-
|
27
|
+
when :osx then
|
28
|
+
ret = autolocate_osx
|
29
|
+
when :linux then
|
30
|
+
loc = ArduinoDownloaderLinux.autolocated_executable
|
31
|
+
return nil if loc.nil?
|
32
|
+
ret = ArduinoCmdLinux.new
|
33
|
+
ret.base_cmd = [loc]
|
34
|
+
when :windows then
|
35
|
+
loc = ArduinoDownloaderWindows.autolocated_executable
|
36
|
+
return nil if loc.nil?
|
37
|
+
ret = ArduinoCmdWindows.new
|
38
|
+
ret.base_cmd = [loc]
|
26
39
|
end
|
40
|
+
ret
|
27
41
|
end
|
28
42
|
|
29
|
-
# @return [ArduinoCI::ArduinoCmdOSX] an instance of
|
43
|
+
# @return [ArduinoCI::ArduinoCmdOSX] an instance of the command or nil if it can't be found
|
30
44
|
def autolocate_osx
|
31
|
-
osx_root =
|
45
|
+
osx_root = ArduinoDownloaderOSX.autolocated_installation
|
46
|
+
return nil if osx_root.nil?
|
32
47
|
return nil unless File.exist? osx_root
|
33
48
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
49
|
+
launchers = [
|
50
|
+
# try a hack that skips splash screen
|
51
|
+
# from https://github.com/arduino/Arduino/issues/1970#issuecomment-321975809
|
52
|
+
[
|
53
|
+
"java",
|
54
|
+
"-cp", "#{osx_root}/Java/*",
|
55
|
+
"-DAPP_DIR=#{osx_root}/Java",
|
56
|
+
"-Dfile.encoding=UTF-8",
|
57
|
+
"-Dapple.awt.UIElement=true",
|
58
|
+
"-Xms128M",
|
59
|
+
"-Xmx512M",
|
60
|
+
"processing.app.Base",
|
61
|
+
],
|
62
|
+
# failsafe way
|
63
|
+
[File.join(osx_root, "Contents", "MacOS", "Arduino")]
|
47
64
|
]
|
48
|
-
ret
|
49
|
-
end
|
50
|
-
|
51
|
-
# @return [ArduinoCI::ArduinoCmdLinux] an instance of a command
|
52
|
-
def autolocate_linux
|
53
|
-
if USE_BUILDER
|
54
|
-
builder_name = "arduino-builder"
|
55
|
-
cli_place = Host.which(builder_name)
|
56
|
-
unless cli_place.nil?
|
57
|
-
ret = ArduinoCmdLinuxBuilder.new
|
58
|
-
ret.base_cmd = [cli_place]
|
59
|
-
return ret
|
60
|
-
end
|
61
65
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
+
# create return and find a command launcher that works
|
67
|
+
ret = ArduinoCmdOSX.new
|
68
|
+
launchers.each do |launcher|
|
69
|
+
# test whether this method successfully launches the IDE
|
70
|
+
# note that "successful launch" involves a command that will fail,
|
71
|
+
# because that's faster than any command which succeeds. what we
|
72
|
+
# don't want to see is a java error.
|
73
|
+
args = launcher + ["--bogus-option"]
|
74
|
+
result = Host.run_and_capture(*args)
|
75
|
+
if result[:err].include? "Error: unknown option: --bogus-option"
|
76
|
+
ret.base_cmd = launcher
|
66
77
|
return ret
|
67
78
|
end
|
68
79
|
end
|
69
|
-
|
70
|
-
gui_name = "arduino"
|
71
|
-
gui_place = Host.which(gui_name)
|
72
|
-
unless gui_place.nil?
|
73
|
-
ret = ArduinoCmdLinux.new
|
74
|
-
ret.base_cmd = [gui_place]
|
75
|
-
return ret
|
76
|
-
end
|
77
|
-
|
78
|
-
forced_arduino = File.join(force_install_location, gui_name)
|
79
|
-
if File.exist?(forced_arduino)
|
80
|
-
ret = ArduinoCmdLinux.new
|
81
|
-
ret.base_cmd = [forced_arduino]
|
82
|
-
return ret
|
83
|
-
end
|
84
80
|
nil
|
85
81
|
end
|
86
82
|
|
@@ -98,30 +94,13 @@ module ArduinoCI
|
|
98
94
|
# Forcibly install Arduino from the web
|
99
95
|
# @return [bool] Whether the command succeeded
|
100
96
|
def force_install
|
101
|
-
case Host.os
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
puts "Downloading Arduino binary with wget"
|
109
|
-
system("wget", "--quiet", "--progress=dot:giga", "https://downloads.arduino.cc/#{tarfile}")
|
110
|
-
end
|
111
|
-
|
112
|
-
if File.exist? pkgname
|
113
|
-
puts "Tarfile seems to have been extracted already"
|
114
|
-
else
|
115
|
-
puts "Extracting archive with tar"
|
116
|
-
system("tar", "xf", tarfile)
|
117
|
-
end
|
118
|
-
|
119
|
-
if File.exist? force_install_location
|
120
|
-
puts "Arduino binary seems to have already been force-installed"
|
121
|
-
else
|
122
|
-
system("mv", pkgname, force_install_location)
|
123
|
-
end
|
124
|
-
end
|
97
|
+
worker_class = case Host.os
|
98
|
+
when :osx then ArduinoDownloaderOSX
|
99
|
+
when :windows then ArduinoDownloaderWindows
|
100
|
+
when :linux then ArduinoDownloaderLinux
|
101
|
+
end
|
102
|
+
worker = worker_class.new(DESIRED_ARDUINO_IDE_VERSION)
|
103
|
+
worker.execute
|
125
104
|
end
|
126
105
|
|
127
106
|
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require "arduino_ci/host"
|
2
|
+
require "arduino_ci/arduino_cmd_osx"
|
3
|
+
require "arduino_ci/arduino_cmd_linux"
|
4
|
+
require "arduino_ci/arduino_cmd_linux_builder"
|
5
|
+
require "arduino_ci/arduino_downloader_linux"
|
6
|
+
require "arduino_ci/arduino_downloader_osx"
|
7
|
+
|
8
|
+
DESIRED_ARDUINO_IDE_VERSION = "1.8.5".freeze
|
9
|
+
|
10
|
+
module ArduinoCI
|
11
|
+
|
12
|
+
# Manage the OS-specific install location of Arduino
|
13
|
+
class ArduinoInstallation
|
14
|
+
|
15
|
+
class << self
|
16
|
+
|
17
|
+
# attempt to find a workable Arduino executable across platforms
|
18
|
+
#
|
19
|
+
# Autolocation assumed to be an expensive operation
|
20
|
+
# @return [ArduinoCI::ArduinoCmd] an instance of the command or nil if it can't be found
|
21
|
+
def autolocate
|
22
|
+
ret = nil
|
23
|
+
case Host.os
|
24
|
+
when :osx then
|
25
|
+
ret = autolocate_osx
|
26
|
+
when :linux then
|
27
|
+
<<<<<<< HEAD
|
28
|
+
loc = ArduinoDownloaderLinux.autolocation
|
29
|
+
return nil if loc.nil?
|
30
|
+
ret = ArduinoCmdLinux.new
|
31
|
+
ret.base_cmd = [loc]
|
32
|
+
=======
|
33
|
+
loc = ArduinoDownloaderLinux.autolocated_executable
|
34
|
+
return nil if loc.nil?
|
35
|
+
ret = ArduinoCmdLinux.new
|
36
|
+
ret.base_cmd = [loc]
|
37
|
+
# when :windows then
|
38
|
+
# ArduinoDownloaderWindows.autolocation
|
39
|
+
# return nil if loc.nil?
|
40
|
+
# ret = ArduinoCmdWindows.new
|
41
|
+
# ret.base_cmd = [loc]
|
42
|
+
>>>>>>> Refactor force_install code in preparation for windows CI
|
43
|
+
end
|
44
|
+
ret
|
45
|
+
end
|
46
|
+
|
47
|
+
# @return [ArduinoCI::ArduinoCmdOSX] an instance of the command or nil if it can't be found
|
48
|
+
def autolocate_osx
|
49
|
+
<<<<<<< HEAD
|
50
|
+
osx_root = ArduinoDownloaderOSX.autolocation
|
51
|
+
=======
|
52
|
+
osx_root = ArduinoDownloaderOSX.autolocated_installation
|
53
|
+
return nil if osx_root.nil?
|
54
|
+
>>>>>>> Refactor force_install code in preparation for windows CI
|
55
|
+
return nil unless File.exist? osx_root
|
56
|
+
|
57
|
+
launchers = [
|
58
|
+
# try a hack that skips splash screen
|
59
|
+
# from https://github.com/arduino/Arduino/issues/1970#issuecomment-321975809
|
60
|
+
[
|
61
|
+
"java",
|
62
|
+
"-cp", "#{osx_root}/Java/*",
|
63
|
+
"-DAPP_DIR=#{osx_root}/Java",
|
64
|
+
"-Dfile.encoding=UTF-8",
|
65
|
+
"-Dapple.awt.UIElement=true",
|
66
|
+
"-Xms128M",
|
67
|
+
"-Xmx512M",
|
68
|
+
"processing.app.Base",
|
69
|
+
],
|
70
|
+
# failsafe way
|
71
|
+
[File.join(osx_root, "MacOS", "Arduino")]
|
72
|
+
]
|
73
|
+
|
74
|
+
# create return and find a command launcher that works
|
75
|
+
ret = ArduinoCmdOSX.new
|
76
|
+
launchers.each do |launcher|
|
77
|
+
# test whether this method successfully launches the IDE
|
78
|
+
# note that "successful launch" involves a command that will fail,
|
79
|
+
# because that's faster than any command which succeeds. what we
|
80
|
+
# don't want to see is a java error.
|
81
|
+
args = launcher + ["--bogus-option"]
|
82
|
+
result = Host.run_and_capture(*args)
|
83
|
+
if result[:err].include? "Error: unknown option: --bogus-option"
|
84
|
+
ret.base_cmd = launcher
|
85
|
+
return ret
|
86
|
+
end
|
87
|
+
end
|
88
|
+
nil
|
89
|
+
end
|
90
|
+
|
91
|
+
# Attempt to find a workable Arduino executable across platforms, and install it if we don't
|
92
|
+
# @return [ArduinoCI::ArduinoCmd] an instance of a command
|
93
|
+
def autolocate!
|
94
|
+
candidate = autolocate
|
95
|
+
return candidate unless candidate.nil?
|
96
|
+
|
97
|
+
# force the install
|
98
|
+
force_install
|
99
|
+
autolocate
|
100
|
+
end
|
101
|
+
|
102
|
+
# Forcibly install Arduino from the web
|
103
|
+
# @return [bool] Whether the command succeeded
|
104
|
+
def force_install
|
105
|
+
worker_class = case Host.os
|
106
|
+
when :osx then ArduinoDownloaderOSX
|
107
|
+
# when :windows then force_install_windows
|
108
|
+
when :linux then ArduinoDownloaderLinux
|
109
|
+
end
|
110
|
+
worker = worker_class.new(DESIRED_ARDUINO_IDE_VERSION)
|
111
|
+
worker.execute
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -34,6 +34,7 @@ module ArduinoCI
|
|
34
34
|
# @return [bool] whether there is already a GUI that can accept windows
|
35
35
|
def existing_display?
|
36
36
|
return true if RUBY_PLATFORM.include? "darwin"
|
37
|
+
return true if Host.os == :windows
|
37
38
|
return false if ENV["DISPLAY"].nil?
|
38
39
|
return true if ENV["DISPLAY"].include? ":"
|
39
40
|
false
|
data/lib/arduino_ci/host.rb
CHANGED
@@ -37,5 +37,16 @@ module ArduinoCI
|
|
37
37
|
return :windows if OS.windows?
|
38
38
|
end
|
39
39
|
|
40
|
+
# if on windows, call mklink, else self.symlink
|
41
|
+
# https://stackoverflow.com/a/22716582/2063546
|
42
|
+
def self.symlink(old_path, new_path)
|
43
|
+
return FileUtils.ln_s(old_path, new_path) unless RUBY_PLATFORM =~ /mswin32|cygwin|mingw|bccwin/
|
44
|
+
|
45
|
+
# windows mklink syntax is reverse of unix ln -s
|
46
|
+
# windows mklink is built into cmd.exe
|
47
|
+
# vulnerable to command injection, but okay because this is a hack to make a cli tool work.
|
48
|
+
_stdin, _stdout, _stderr, wait_thr = Open3.popen3('cmd.exe', "/c mklink #{new_path} #{old_path}")
|
49
|
+
wait_thr.value.exitstatus
|
50
|
+
end
|
40
51
|
end
|
41
52
|
end
|
data/lib/arduino_ci/version.rb
CHANGED
data/lib/arduino_ci.rb
CHANGED
@@ -4,7 +4,7 @@ require "arduino_ci/cpp_library"
|
|
4
4
|
require "arduino_ci/ci_config"
|
5
5
|
|
6
6
|
# ArduinoCI contains classes for automated testing of Arduino code on the command line
|
7
|
-
# @author Ian Katz <
|
7
|
+
# @author Ian Katz <ianfixes@gmail.com>
|
8
8
|
module ArduinoCI
|
9
9
|
|
10
10
|
end
|
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: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Katz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: os
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubyzip
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.2.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.2.1
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,7 +96,7 @@ dependencies:
|
|
82
96
|
version: 0.9.11
|
83
97
|
description: ''
|
84
98
|
email:
|
85
|
-
-
|
99
|
+
- ianfixes@gmail.com
|
86
100
|
executables:
|
87
101
|
- arduino_ci_remote.rb
|
88
102
|
extensions: []
|
@@ -394,14 +408,23 @@ files:
|
|
394
408
|
- lib/arduino_ci/arduino_cmd_linux.rb
|
395
409
|
- lib/arduino_ci/arduino_cmd_linux_builder.rb
|
396
410
|
- lib/arduino_ci/arduino_cmd_osx.rb
|
411
|
+
- lib/arduino_ci/arduino_cmd_windows.rb
|
412
|
+
- lib/arduino_ci/arduino_downloader.rb
|
413
|
+
- lib/arduino_ci/arduino_downloader.rb.orig
|
414
|
+
- lib/arduino_ci/arduino_downloader_linux.rb
|
415
|
+
- lib/arduino_ci/arduino_downloader_linux.rb.orig
|
416
|
+
- lib/arduino_ci/arduino_downloader_osx.rb
|
417
|
+
- lib/arduino_ci/arduino_downloader_osx.rb.orig
|
418
|
+
- lib/arduino_ci/arduino_downloader_windows.rb
|
397
419
|
- lib/arduino_ci/arduino_installation.rb
|
420
|
+
- lib/arduino_ci/arduino_installation.rb.orig
|
398
421
|
- lib/arduino_ci/ci_config.rb
|
399
422
|
- lib/arduino_ci/cpp_library.rb
|
400
423
|
- lib/arduino_ci/display_manager.rb
|
401
424
|
- lib/arduino_ci/host.rb
|
402
425
|
- lib/arduino_ci/version.rb
|
403
426
|
- misc/default.yml
|
404
|
-
homepage: http://github.com/
|
427
|
+
homepage: http://github.com/ianfixes/arduino_ci
|
405
428
|
licenses:
|
406
429
|
- Apache-2.0
|
407
430
|
metadata: {}
|