3 require "rexml/document"
6 INKSCAPE = 'env inkscape'
9 puts "Rendering from SVGs in #{SRC}"
10 Dir.foreach(SRC) do |file|
12 svg = Document.new(File.new("#{SRC}/#{file}", 'r'))
13 svg.root.each_element("//g[@inkscape:label='baseplate']/rect") do |icon|
14 dir = "#{icon.attributes['inkscape:label']}/apps"
15 File.makedirs(dir) unless File.exists?(dir)
16 out = "#{dir}/#{file.gsub(/svg$/,"png")}"
17 cmd = "#{INKSCAPE} -i #{icon.attributes['id']} -e #{Dir.pwd}/#{out} #{SRC}/#{file} > /dev/null 2>&1"