Class: ArduinoSketchBuilder::CMakeListsFileGenerator
- Inherits:
-
Object
- Object
- ArduinoSketchBuilder::CMakeListsFileGenerator
- Defined in:
- lib/arduino_sketch_builder/c_make_lists_file_generator.rb
Constant Summary collapse
- TEMPLATES_DIRECTORY =
File.('../../../templates', __FILE__)
Instance Attribute Summary collapse
-
#board_port ⇒ Object
readonly
Returns the value of attribute board_port.
-
#board_type ⇒ Object
readonly
Returns the value of attribute board_type.
-
#root_directory ⇒ Object
readonly
Returns the value of attribute root_directory.
-
#sketch_name ⇒ Object
readonly
Returns the value of attribute sketch_name.
Instance Method Summary collapse
- #generate_main(root_directory, c_make_lists_file_directory) ⇒ Object
- #generate_sketch_specific(sketch_name, c_make_lists_file_directory, board_type: "uno", board_port: "/dev/tty.usbmodem411") ⇒ Object
Instance Attribute Details
#board_port ⇒ Object (readonly)
Returns the value of attribute board_port.
11 12 13 |
# File 'lib/arduino_sketch_builder/c_make_lists_file_generator.rb', line 11 def board_port @board_port end |
#board_type ⇒ Object (readonly)
Returns the value of attribute board_type.
10 11 12 |
# File 'lib/arduino_sketch_builder/c_make_lists_file_generator.rb', line 10 def board_type @board_type end |
#root_directory ⇒ Object (readonly)
Returns the value of attribute root_directory.
8 9 10 |
# File 'lib/arduino_sketch_builder/c_make_lists_file_generator.rb', line 8 def root_directory @root_directory end |
#sketch_name ⇒ Object (readonly)
Returns the value of attribute sketch_name.
9 10 11 |
# File 'lib/arduino_sketch_builder/c_make_lists_file_generator.rb', line 9 def sketch_name @sketch_name end |
Instance Method Details
#generate_main(root_directory, c_make_lists_file_directory) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/arduino_sketch_builder/c_make_lists_file_generator.rb', line 13 def generate_main(root_directory, c_make_lists_file_directory) @root_directory = root_directory erb = ERB.new(File.read("#{TEMPLATES_DIRECTORY}/MainCMakeListsTemplate.txt.erb")) generated_content = erb.result(binding) File.write(File.join(c_make_lists_file_directory, "CMakeLists.txt"), generated_content) end |
#generate_sketch_specific(sketch_name, c_make_lists_file_directory, board_type: "uno", board_port: "/dev/tty.usbmodem411") ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/arduino_sketch_builder/c_make_lists_file_generator.rb', line 25 def generate_sketch_specific(sketch_name, c_make_lists_file_directory, board_type: "uno", board_port: "/dev/tty.usbmodem411") @sketch_name = sketch_name @board_type = board_type @board_port = board_port erb = ERB.new(File.read("#{TEMPLATES_DIRECTORY}/SourceCMakeListsTemplate.txt.erb")) generated_content = erb.result(binding) File.write(File.join(c_make_lists_file_directory, "CMakeLists.txt"), generated_content) end |