Class: Inkmake
- Inherits:
-
Object
- Object
- Inkmake
- Defined in:
- lib/inkmake.rb
Defined Under Namespace
Classes: InkFile, InkImage, InkVariant, InkscapeRemote, InkscapeResolution, InkscapeUnit
Class Attribute Summary collapse
-
.verbose ⇒ Object
readonly
Returns the value of attribute verbose.
Class Method Summary collapse
Class Attribute Details
.verbose ⇒ Object (readonly)
Returns the value of attribute verbose.
51 52 53 |
# File 'lib/inkmake.rb', line 51 def verbose @verbose end |
Class Method Details
.run(argv) ⇒ Object
706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 |
# File 'lib/inkmake.rb', line 706 def self.run(argv) inkfile_path = nil inkfile_opts = {} OptionParser.new do |o| o. = "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. exit 1 end end inkfile_path = File.(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. 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. exit 1 end end |