class Programmer
Public Class Methods
new(keyboard_path)
click to toggle source
# File lib/programmer.rb, line 16 def initialize(keyboard_path) @keyboard_path = keyboard_path end
Public Instance Methods
bootloader()
click to toggle source
# File lib/programmer.rb, line 20 def bootloader filename = "#{@keyboard_path}/rules.mk" parse_bootloader_name(filename) if File.exists? filename end
flasher()
click to toggle source
# File lib/programmer.rb, line 25 def flasher bootloader and FLASHERS.each do |k, v| break k.to_s if v.include? bootloader.downcase end end
Private Instance Methods
bootloader_from_size(size)
click to toggle source
# File lib/programmer.rb, line 32 def bootloader_from_size(size) size and BOOTLOADERS.each do |k, v| break k.to_s if v.include? size.to_s end end
parse_bootloader_name(filename)
click to toggle source
# File lib/programmer.rb, line 38 def parse_bootloader_name(filename) make = Makefile.new(filename) name = make.get :bootloader return name if name size = make.get :bootloader_size return bootloader_from_size(size) if size opt_defs = make.get :opt_defs match = opt_defs.match /BOOTLOADER_SIZE=(\w+)/ return bootloader_from_size(match[1]) if match end