class Inkmake
Attributes
verbose[RW]
Public Class Methods
run(argv)
click to toggle source
# File lib/inkmake.rb, line 807 def self.run(argv) inkfile_path = nil inkfile_opts = {} OptionParser.new do |o| o.banner = "Usage: #{$0} [options] [Inkfile]" o.on("-v", "--verbose", "Verbose output") { @verbose = true } o.on("-s", "--svg PATH", "SVG source base path") { |v| inkfile_opts[:svg_path] = v } o.on("-o", "--out PATH", "Output base path") { |v| inkfile_opts[:out_path] = v } o.on("-f", "--force", "Force regenerate (skip time check)") { |v| inkfile_opts[:force] = true } o.on("-i", "--inkscape PATH", "Inkscape binary path", "Default: #{InkscapeRemote.path || "not found"}") { |v| @inkscape_path = v } o.on("-h", "--help", "Display help") { puts o; exit } begin inkfile_path = o.parse!(argv).first rescue OptionParser::InvalidOption => e puts e.message exit 1 end end inkfile_path = File.expand_path(inkfile_path || "Inkfile", Dir.pwd) begin raise "Could not find Inkscape binary (maybe try --inkscape?)" if not InkscapeRemote.path raise "Inkscape binary #{InkscapeRemote.path} does not exist or is not executable" if not InkscapeRemote.path or not File.executable? InkscapeRemote.path rescue StandardError => e puts e.message exit 1 end begin if not InkFile.new(inkfile_path, inkfile_opts).process puts "Everything seems to be up to date" end rescue InkFile::ProcessError, SystemCallError => e puts e.message exit 1 end end