Loading lib/jsduck/options/processor.rb +3 −16 Original line number Diff line number Diff line Loading @@ -7,24 +7,22 @@ require 'jsduck/util/parallel' require 'jsduck/tag_registry' require 'jsduck/js/ext_patterns' require 'jsduck/warning/parser' require 'jsduck/version' module JsDuck module Options # Handles setting different settings based on the commend line # options and also processes some of the options (like #footer and # #input_files). Finally it also validates them. # options and also processes some of the options (like #input_files). # Finally it also validates them. class Processor # Processes and applies the parsed command line options. # It modifies the values of #footer and #input_files options. # It modifies the values of#input_files option. def process!(opts) @opts = opts # Apply the various options. configure_input_files configure_footer configure_logger configure_parallel configure_tags Loading Loading @@ -78,17 +76,6 @@ module JsDuck end end def configure_footer @opts.footer = format_footer(@opts.footer) end # Replace special placeholders in footer text def format_footer(text) jsduck = "<a href='https://github.com/senchalabs/jsduck'>JSDuck</a>" date = Time.new.strftime('%a %d %b %Y %H:%M:%S') text.gsub(/\{VERSION\}/, JsDuck::VERSION).gsub(/\{JSDUCK\}/, jsduck).gsub(/\{DATE\}/, date) end def configure_logger Logger.verbose = true if @opts.verbose Loading lib/jsduck/web/index_html.rb +13 −1 Original line number Diff line number Diff line require 'jsduck/logger' require 'jsduck/util/io' require 'jsduck/tag_registry' require 'jsduck/version' require 'fileutils' module JsDuck Loading Loading @@ -35,7 +36,7 @@ module JsDuck "{title}" => @opts.title, "{mobile_redirect}" => @opts.seo ? include_script(@opts.template_dir+"/mobile-redirect.js") : "", "{header}" => @opts.header, "{footer}" => "<div id='footer-content' style='display: none'>#{@opts.footer}</div>", "{footer}" => footer, "{extjs_path}" => @opts.extjs_path, "{data_path}" => File.basename(@paths[:data]), "{css_path}" => File.basename(@paths[:css]), Loading Loading @@ -73,6 +74,17 @@ module JsDuck "<script type='text/javascript'>\n" + Util::IO.read(filename) + "\n</script>" end def footer jsduck = "<a href='https://github.com/senchalabs/jsduck'>JSDuck</a>" date = Time.new.strftime('%a %d %b %Y %H:%M:%S') footer_text = @opts.footer.gsub(/\{VERSION\}/, JsDuck::VERSION) .gsub(/\{JSDUCK\}/, jsduck) .gsub(/\{DATE\}/, date) return "<div id='footer-content' style='display: none'>#{footer_text}</div>" end # Opens in_file, replaces {keys} inside it, writes to out_file def write_template(in_file, out_file, replacements) Logger.log("Writing", out_file) Loading Loading
lib/jsduck/options/processor.rb +3 −16 Original line number Diff line number Diff line Loading @@ -7,24 +7,22 @@ require 'jsduck/util/parallel' require 'jsduck/tag_registry' require 'jsduck/js/ext_patterns' require 'jsduck/warning/parser' require 'jsduck/version' module JsDuck module Options # Handles setting different settings based on the commend line # options and also processes some of the options (like #footer and # #input_files). Finally it also validates them. # options and also processes some of the options (like #input_files). # Finally it also validates them. class Processor # Processes and applies the parsed command line options. # It modifies the values of #footer and #input_files options. # It modifies the values of#input_files option. def process!(opts) @opts = opts # Apply the various options. configure_input_files configure_footer configure_logger configure_parallel configure_tags Loading Loading @@ -78,17 +76,6 @@ module JsDuck end end def configure_footer @opts.footer = format_footer(@opts.footer) end # Replace special placeholders in footer text def format_footer(text) jsduck = "<a href='https://github.com/senchalabs/jsduck'>JSDuck</a>" date = Time.new.strftime('%a %d %b %Y %H:%M:%S') text.gsub(/\{VERSION\}/, JsDuck::VERSION).gsub(/\{JSDUCK\}/, jsduck).gsub(/\{DATE\}/, date) end def configure_logger Logger.verbose = true if @opts.verbose Loading
lib/jsduck/web/index_html.rb +13 −1 Original line number Diff line number Diff line require 'jsduck/logger' require 'jsduck/util/io' require 'jsduck/tag_registry' require 'jsduck/version' require 'fileutils' module JsDuck Loading Loading @@ -35,7 +36,7 @@ module JsDuck "{title}" => @opts.title, "{mobile_redirect}" => @opts.seo ? include_script(@opts.template_dir+"/mobile-redirect.js") : "", "{header}" => @opts.header, "{footer}" => "<div id='footer-content' style='display: none'>#{@opts.footer}</div>", "{footer}" => footer, "{extjs_path}" => @opts.extjs_path, "{data_path}" => File.basename(@paths[:data]), "{css_path}" => File.basename(@paths[:css]), Loading Loading @@ -73,6 +74,17 @@ module JsDuck "<script type='text/javascript'>\n" + Util::IO.read(filename) + "\n</script>" end def footer jsduck = "<a href='https://github.com/senchalabs/jsduck'>JSDuck</a>" date = Time.new.strftime('%a %d %b %Y %H:%M:%S') footer_text = @opts.footer.gsub(/\{VERSION\}/, JsDuck::VERSION) .gsub(/\{JSDUCK\}/, jsduck) .gsub(/\{DATE\}/, date) return "<div id='footer-content' style='display: none'>#{footer_text}</div>" end # Opens in_file, replaces {keys} inside it, writes to out_file def write_template(in_file, out_file, replacements) Logger.log("Writing", out_file) Loading