Sha256: 29422b7a252325907b38c856df75325650448dc3e0f97a4917e232528ca07d9a
Contents?: true
Size: 1.6 KB
Versions: 2
Compression:
Stored size: 1.6 KB
Contents
#!/usr/bin/env ruby # # Created by Gregor Schmidt on 2007-9-30. # Copyright (c) 2007. All rights reserved. begin require 'rubygems' rescue LoadError # no rubygems to load, so we fail silently end require 'optparse' # NOTE: the option -p/--path= is given as an example, and should probably be replaced in your application. OPTIONS = { :output_path => nil } MANDATORY_OPTIONS = %w( ) parser = OptionParser.new do |opts| opts.banner = <<BANNER Literate Maruku allows you to interleave your documentation and the corresponding code in a style of literate programming. This is the command line front end of the literate_maruku gem. You may find additional information on our website http://rug-b.rubyforge.org/literate_maruku/ Usage: #{File.basename($0)} [options] filename.mkd Options are: BANNER opts.separator "" opts.on("-o", "--output_path=PATH", String, "The root path for the generated files", "If not set, not output will be generated") { |OPTIONS[:output_path]| } opts.on("-h", "--help", "Show this help message.") { puts opts; exit } opts.parse!(ARGV) if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? } or ARGV[0].nil? puts opts; exit end end # do stuff begin gem "literate_maruku" require "literate_maruku" rescue LoadError require File.dirname(__FILE__) + "/../lib/literate_maruku" end if OPTIONS[:output_path] path = File.join(Dir.pwd, OPTIONS[:output_path]) puts "Generating output to \"#{OPTIONS[:output_path]}\"" LiterateMaruku.require(ARGV[0], :output => path) else LiterateMaruku.require(ARGV[0]) end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
literate_maruku-0.1.1 | bin/literate_maruku |
literate_maruku-0.1.0 | bin/literate_maruku |