Class: Arli::Lock::Formats::Template::CMakeRenderer
- Inherits:
-
Object
- Object
- Arli::Lock::Formats::Template::CMakeRenderer
- Extended by:
- Forwardable
- Defined in:
- lib/arli/lock/formats/template/cmake_renderer.rb
Class Attribute Summary collapse
-
.template ⇒ Object
Returns the value of attribute template.
Instance Attribute Summary collapse
-
#arlifile ⇒ Object
Returns the value of attribute arlifile.
-
#erb ⇒ Object
Returns the value of attribute erb.
Instance Method Summary collapse
- #arduino_libraries ⇒ Object
- #arli_library_path ⇒ Object
- #board ⇒ Object
- #cpu ⇒ Object
- #custom_libraries_headers_only ⇒ Object
- #device ⇒ Object
- #device_libraries ⇒ Object
- #device_libraries_headers_only ⇒ Object
- #hardware_libraries ⇒ Object
-
#initialize(arlifile) ⇒ CMakeRenderer
constructor
A new instance of CMakeRenderer.
- #library_path ⇒ Object
- #render ⇒ Object (also: #output)
Constructor Details
#initialize(arlifile) ⇒ CMakeRenderer
Returns a new instance of CMakeRenderer.
22 23 24 25 |
# File 'lib/arli/lock/formats/template/cmake_renderer.rb', line 22 def initialize(arlifile) self.arlifile = arlifile self.erb = ERB.new(self.class.template) end |
Class Attribute Details
.template ⇒ Object
Returns the value of attribute template.
15 16 17 |
# File 'lib/arli/lock/formats/template/cmake_renderer.rb', line 15 def template @template end |
Instance Attribute Details
#arlifile ⇒ Object
Returns the value of attribute arlifile.
20 21 22 |
# File 'lib/arli/lock/formats/template/cmake_renderer.rb', line 20 def arlifile @arlifile end |
#erb ⇒ Object
Returns the value of attribute erb.
20 21 22 |
# File 'lib/arli/lock/formats/template/cmake_renderer.rb', line 20 def erb @erb end |
Instance Method Details
#arduino_libraries ⇒ Object
49 50 51 |
# File 'lib/arli/lock/formats/template/cmake_renderer.rb', line 49 def arduino_libraries device && device.libraries ? device.libraries.arduino || [] : [] end |
#arli_library_path ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/arli/lock/formats/template/cmake_renderer.rb', line 69 def arli_library_path if library_path.start_with?('/') "#{library_path}" elsif library_path.start_with?('~') "$ENV{HOME}#{library_path[1..-1]}" elsif library_path.start_with?('./') "${CMAKE_CURRENT_SOURCE_DIR}/#{library_path[2..-1]}" elsif library_path && library_path.size > 0 library_path else '${CMAKE_CURRENT_SOURCE_DIR}/libraries' end end |
#board ⇒ Object
37 38 39 |
# File 'lib/arli/lock/formats/template/cmake_renderer.rb', line 37 def board device && device.board ? device.board : 'uno' end |
#cpu ⇒ Object
41 42 43 |
# File 'lib/arli/lock/formats/template/cmake_renderer.rb', line 41 def cpu device && device.cpu ? device.cpu : 'atmega328p' end |
#custom_libraries_headers_only ⇒ Object
57 58 59 |
# File 'lib/arli/lock/formats/template/cmake_renderer.rb', line 57 def custom_libraries_headers_only libraries.select { |l| l.headers_only } || [] end |
#device ⇒ Object
33 34 35 |
# File 'lib/arli/lock/formats/template/cmake_renderer.rb', line 33 def device arlifile_hash.device end |
#device_libraries ⇒ Object
53 54 55 |
# File 'lib/arli/lock/formats/template/cmake_renderer.rb', line 53 def device_libraries Array(hardware_libraries + arduino_libraries).flatten end |
#device_libraries_headers_only ⇒ Object
61 62 63 |
# File 'lib/arli/lock/formats/template/cmake_renderer.rb', line 61 def device_libraries_headers_only device_libraries.select { |l| l.headers_only } || [] end |
#hardware_libraries ⇒ Object
45 46 47 |
# File 'lib/arli/lock/formats/template/cmake_renderer.rb', line 45 def hardware_libraries device && device.libraries ? device.libraries.hardware || [] : [] end |
#library_path ⇒ Object
65 66 67 |
# File 'lib/arli/lock/formats/template/cmake_renderer.rb', line 65 def library_path config.libraries.path end |
#render ⇒ Object Also known as: output
27 28 29 |
# File 'lib/arli/lock/formats/template/cmake_renderer.rb', line 27 def render erb.result(binding) end |