Sha256: d1f3b162f4ad98f1a75d8e1c72a38e9cd1fcb8e01e0a32c5dd875a84394e98df
Contents?: true
Size: 1.2 KB
Versions: 4
Compression:
Stored size: 1.2 KB
Contents
require 'erb' class Makefile class << self # build the sketch Makefile for the given template based on the values in its software and hardware config files def compose_for_sketch(sketch_name) params = hardware_params.merge software_params params[:target] = sketch_name e = ERB.new File.open("#{File.dirname(__FILE__)}/makefile.erb").read File.open("#{RAD_ROOT}/#{sketch_name}/Makefile", "w") do |f| f << e.result(binding) end end def hardware_params return @hardware_params if @hardware_params @hardware_params = {} File.open( "#{RAD_ROOT}/config/hardware.yml" ) do |yf| YAML.load_documents( yf ) do |ydoc| @hardware_params[:serial_port] = ydoc["serial_port"] end end @hardware_params end def software_params return @software_params if @software_params @software_params = {} File.open( "#{RAD_ROOT}/config/software.yml" ) do |yf| YAML.load_documents( yf ) do |ydoc| @software_params[:arduino_root] = ydoc["arduino_root"] end end @software_params end end end
Version data entries
4 entries across 4 versions & 1 rubygems