class Makefile
Public Class Methods
new(include_makefile)
click to toggle source
# File lib/makefile.rb, line 4 def initialize(include_makefile) @include_makefile = include_makefile @file = write end
Public Instance Methods
get(variable)
click to toggle source
# File lib/makefile.rb, line 9 def get(variable) output = run variable _, value = parse output value end
Private Instance Methods
contents()
click to toggle source
# File lib/makefile.rb, line 34 def contents <<-contents .PHONY: print-% print-%: \t@echo '$*=$($*)' contents end
parse(output)
click to toggle source
# File lib/makefile.rb, line 27 def parse(output) match = output.match /^(\w+)=(.+)/ if match [match[1], match[2]] end end
run(variable)
click to toggle source
# File lib/makefile.rb, line 23 def run(variable) `make -f #{@file.path} -f #{@include_makefile} print-#{variable.to_s.upcase}` end
write()
click to toggle source
# File lib/makefile.rb, line 16 def write file = Tempfile.new('makefile') file.write contents file.close file end