arduino_sketch_builder 0.0.5 → 0.0.6
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 196ee574d94b524c18b0f26785eabb9303f97ce0
|
4
|
+
data.tar.gz: 8ee1dff937b46bd8cd7d5b9cfe20197d5441406c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 271bb1cbef24da3d8d9a9f4c200253e7ecf4ed883e8dd344dc24e7d523f960627d11f7b63c1a5d19cb721e61b9b4fde5d49f43e70e8c68bd6abaea1a84658cf1
|
7
|
+
data.tar.gz: 187953360cacb0bf431e4104bf69ba61007b739f66840c2ae42ee945b72fc7be7255659ff66122092d55c645bed3a71fc35e92f6d6784a7529b0510e0ecfa9ad
|
data/README.md
CHANGED
@@ -122,7 +122,24 @@ If Arduino board type and port are different from the default,
|
|
122
122
|
arduino_sketch_file_path = File.expand_path('~/temp/BlinkCustomized.ino')
|
123
123
|
setup.setup(root_directory, arduino_sketch_file_path, board_type: "diecimila", board_port: "/dev/cu.usbmodem411")
|
124
124
|
|
125
|
-
####
|
125
|
+
#### Building and uploading the sketch
|
126
|
+
|
127
|
+
require "arduino_sketch_builder"
|
128
|
+
|
129
|
+
main_directory = File.expand_path('~/.arduino_sketches/blink_customized')
|
130
|
+
build_directory = File.join(main_directory, "build")
|
131
|
+
|
132
|
+
# Instantiate ArduinoCmakeBuild with state == :initial (It's a state machine):
|
133
|
+
arduino_cmake_build = ArduinoSketchBuilder::ArduinoCmakeBuild.new(main_directory, build_directory)
|
134
|
+
|
135
|
+
# Build and upload
|
136
|
+
# raises error if state at the point of execution is not :initial (i.e. precondition: state == :initial)
|
137
|
+
# Success: state == :make_upload_complete
|
138
|
+
# Failure: state == :cmake_incomplete, :make_incomplete, or :make_upload_incomplete depending on the step at the time of the failure
|
139
|
+
# arduino_cmake_build.message gives message such as error message in case of failure.
|
140
|
+
state = arduino_cmake_build.build_and_upload
|
141
|
+
|
142
|
+
#### (Optional: individual steps for "Building and uploading the sketch" above): Executing cmake commands - compile, make, and make upload
|
126
143
|
|
127
144
|
require "arduino_sketch_builder"
|
128
145
|
|
@@ -25,6 +25,14 @@ class ArduinoSketchBuilder::ArduinoCmakeBuild
|
|
25
25
|
@state.message
|
26
26
|
end
|
27
27
|
|
28
|
+
def build_and_upload
|
29
|
+
self.cmake
|
30
|
+
return self.state unless self.state == :cmake_complete
|
31
|
+
self.make
|
32
|
+
return self.state unless self.state == :make_complete
|
33
|
+
self.make_upload
|
34
|
+
end
|
35
|
+
|
28
36
|
[:cmake, :make, :make_upload].each_with_index do |method_name, index|
|
29
37
|
|
30
38
|
define_method(method_name) do
|
@@ -102,4 +102,23 @@ describe ArduinoSketchBuilder::ArduinoCmakeBuild do
|
|
102
102
|
|
103
103
|
end
|
104
104
|
|
105
|
+
context "one method to do cmake, make and make upload" do
|
106
|
+
|
107
|
+
it "should execute cmake, make and make upload" do
|
108
|
+
|
109
|
+
@arduino_cmake_build.state.should == :initial
|
110
|
+
File.exists?(File.join(BUILD_DIRECTORY, "Makefile")).should be_false
|
111
|
+
File.exists?(File.join(BUILD_DIRECTORY, "src", "blink_customized_for_test.hex")).should be_false
|
112
|
+
|
113
|
+
@arduino_cmake_build.build_and_upload.should == :make_upload_complete
|
114
|
+
|
115
|
+
@arduino_cmake_build.state.should == :make_upload_complete
|
116
|
+
|
117
|
+
File.exists?(File.join(BUILD_DIRECTORY, "Makefile")).should be_true
|
118
|
+
File.exists?(File.join(BUILD_DIRECTORY, "src", "blink_customized_for_test.hex")).should be_true
|
119
|
+
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
105
124
|
end
|