bin/guider in guider-0.0.7 vs bin/guider in guider-0.0.8

- old
+ new

@@ -4,12 +4,13 @@ $:.unshift File.dirname(File.dirname(__FILE__)) + "/lib" require "rubygems" require "optparse" require "guider/app" +require "guider/social" -GUIDER_VERSION = '0.0.7' +GUIDER_VERSION = '0.0.8' def format_footer(text) guider = "<a href='https://github.com/nene/guider'>Guider</a>" date = Time.new.strftime('%a %d %b %Y %H:%M:%S') text.gsub(/\{VERSION\}/, GUIDER_VERSION).gsub(/\{GUIDER\}/, guider).gsub(/\{DATE\}/, date) @@ -20,10 +21,13 @@ :title => "Guides", :footer => format_footer("Generated on {DATE} by {GUIDER} {VERSION}."), :link_url => "http://localhost/extjs/", :tpl_dir => File.dirname(File.dirname(__FILE__)) + "/template", :warnings => false, + :social => [], + :search => nil, + :analytics => nil, } input_files = OptionParser.new do |opts| opts.banner = "Generates a guide.\n\n" + "Usage: guider <guides/dir/>\n\n" @@ -48,9 +52,27 @@ options[:link_url] = url end opts.on("--index=PATH", "The guides.json file to create index.html from.") do |path| options[:index] = path + end + + opts.on("--social=google,twitter,facebook", Array, "Buttons to add to the page.") do |social| + social = social.map {|t| t.to_sym } + unsupported = social.find_all {|t| !Guider::Social.supported_types.include?(t) } + if unsupported.length > 0 + $stderr.puts "ERROR: Unsupported social button type: " + unsupported.join(" ") + exit(1) + end + options[:social] = social + end + + opts.on("--search=id", "ID of custom google search engine.") do |id| + options[:search] = id + end + + opts.on("--analytics=id", "ID for Google Analytics tracking.") do |id| + options[:analytics] = id end opts.on("--warnings", "Enables warnings.") do options[:warnings] = true end