Class: ArduinoSketchBuilder::ArduinoCmakeBuild
- Inherits:
-
Object
- Object
- ArduinoSketchBuilder::ArduinoCmakeBuild
- Defined in:
- lib/arduino_sketch_builder/arduino_cmake_build.rb
Defined Under Namespace
Classes: State
Constant Summary collapse
- INITIAL =
State.new(:initial, "ready")
- CMAKE_COMPLETE =
State.new(:cmake_complete, "success")
- MAKE_COMPLETE =
State.new(:make_complete, "success")
- MAKE_UPLOAD_COMPLETE =
State.new(:make_upload_complete, "success")
- COMPLETE =
State.new(:complete, "success")
- STATE_SEQUENCE =
[INITIAL, CMAKE_COMPLETE, MAKE_COMPLETE, MAKE_UPLOAD_COMPLETE, COMPLETE]
Instance Method Summary collapse
- #build_and_upload ⇒ Object
-
#initialize(main_directory, build_directory) ⇒ ArduinoCmakeBuild
constructor
A new instance of ArduinoCmakeBuild.
- #message ⇒ Object
- #reset ⇒ Object
- #state ⇒ Object
Constructor Details
#initialize(main_directory, build_directory) ⇒ ArduinoCmakeBuild
Returns a new instance of ArduinoCmakeBuild.
16 17 18 19 20 |
# File 'lib/arduino_sketch_builder/arduino_cmake_build.rb', line 16 def initialize(main_directory, build_directory) @main_directory = File.(main_directory) @build_directory = File.(build_directory) @state = INITIAL end |
Instance Method Details
#build_and_upload ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/arduino_sketch_builder/arduino_cmake_build.rb', line 30 def build_and_upload self.cmake return self.state unless @state == CMAKE_COMPLETE self.make return self.state unless @state == MAKE_COMPLETE self.make_upload @state = COMPLETE if @state == MAKE_UPLOAD_COMPLETE self.state end |
#message ⇒ Object
26 27 28 |
# File 'lib/arduino_sketch_builder/arduino_cmake_build.rb', line 26 def @state. end |
#reset ⇒ Object
67 68 69 70 71 72 73 74 |
# File 'lib/arduino_sketch_builder/arduino_cmake_build.rb', line 67 def reset FileUtils.rm_rf(Dir.glob("#{@build_directory}/*")) @state = INITIAL self.state end |
#state ⇒ Object
22 23 24 |
# File 'lib/arduino_sketch_builder/arduino_cmake_build.rb', line 22 def state @state.value end |