Loading Rakefile +23 −25 Original line number Diff line number Diff line Loading @@ -69,31 +69,44 @@ task :sdk do ]) end desc "Run JSDuck on ExtJS SDK for export" task :export do def run_jsduck_export(extra_options, ext_dir) load_sdk_vars rev = `git rev-parse HEAD`.slice(0, 7) run_jsduck([ "--title", "Ext JS 4.0.2 API Documentation", "--title", "Ext JS 4.0.3 API Documentation", "--footer", "ExtJS 4.0.3 Documentation from Sencha. Generated with <a href='https://github.com/nene/jsduck'>JSDuck</a> revison #{rev}", "--extjs-path", "extjs/ext-all.js", "#{SDK_DIR}/extjs/src", "#{SDK_DIR}/platform/src", "#{SDK_DIR}/platform/core/src", ]) ].concat(extra_options)) system "rm #{OUT_DIR}/extjs" system "mkdir -p #{OUT_DIR}/extjs/resources/themes/images" system "cp #{EXT_DIR}/ext-all.js #{OUT_DIR}/extjs" system "cp -r #{EXT_DIR}/resources/themes/images/default #{OUT_DIR}/extjs/resources/themes/images" system "rm -rf #{OUT_DIR}/resources/sass" system "cp -r #{ext_dir}/resources/themes/images/default #{OUT_DIR}/extjs/resources/themes/images" system "rm -rf #{ext_dir}/resources/sass" system "rm -rf #{OUT_DIR}/resources/.sass-cache" end desc "Run JSDuck on ExtJS SDK for export" task :live_docs do desc "Run JSDuck on ExtJS SDK to create release version of docs app" task :export do load_sdk_vars run_jsduck_export([ "--append-html", <<-EOHTML <div id="notice-text" style="display: none"> Use <a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a> for up to date documentation and features </div> EOHTML ], EXT_DIR) end analytics = <<-EOHTML desc "Run JSDuck on ExtJS SDK to create live docs app" task :live_docs do load_sdk_vars run_jsduck_export([ "--append-html", <<-EOHTML <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1396058-10']); Loading Loading @@ -122,22 +135,7 @@ task :live_docs do } </script> EOHTML run_jsduck([ "--title", "Ext JS 4.0.1 API Documentation", "--extjs-path", "extjs/ext-all.js", "--append-html", analytics, "#{SDK_DIR}/extjs/src", "#{SDK_DIR}/platform/src", "#{SDK_DIR}/platform/core/src", ]) system "rm #{OUT_DIR}/extjs" system "mkdir -p #{OUT_DIR}/extjs/resources/themes/images" system "cp #{SDK_DIR}/extjs/build/sdk/ext-all.js #{OUT_DIR}/extjs" system "cp -r #{SDK_DIR}/extjs/build/sdk/resources/themes/images/default #{OUT_DIR}/extjs/resources/themes/images" system "rm -rf #{OUT_DIR}/resources/sass" system "rm -rf #{OUT_DIR}/resources/.sass-cache" ], "#{SDK_DIR}/extjs/build/sdk") end desc "Run JSDuck on the Docs app itself" Loading bin/jsduck +4 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,10 @@ opts = OptionParser.new do | opts | app.extjs_path = path end opts.on('--footer=TEXT', "Custom footer text for the documentation app.", " ") do |text| app.footer = text end opts.on('--guides=PATH', "Path to guides directory.", "Each subdirectory of that is treated as a guide", "and is expectd to contain a REAME.md file,", Loading lib/jsduck/aggregator.rb +7 −2 Original line number Diff line number Diff line Loading @@ -73,19 +73,23 @@ module JsDuck def add_member(node) if node[:owner] if @classes[node[:owner]] @classes[node[:owner]][:members][node[:tagname]] << node add_to_class(@classes[node[:owner]], node) else add_orphan(node) end elsif @current_class node[:owner] = @current_class[:name] @current_class[:members][ node[:tagname] ] << node add_to_class(@current_class, node) else add_orphan(node) end @aliases << node if node[:alias] end def add_to_class(cls, member) cls[member[:static] ? :statics : :members][member[:tagname]] << member end def add_orphan(node) @orphans << node end Loading Loading @@ -151,6 +155,7 @@ module JsDuck :mixins => [], :alternateClassNames => [], :members => Class.default_members_hash, :statics => Class.default_members_hash, :filename => "", :html_filename => "", :linenr => 0, Loading lib/jsduck/app.rb +3 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ module JsDuck attr_accessor :external_classes attr_accessor :show_private_classes attr_accessor :title attr_accessor :footer attr_accessor :extjs_path attr_accessor :append_html Loading @@ -50,6 +51,7 @@ module JsDuck @external_classes = [] @show_private_classes = false @title = "Ext JS API Documentation" @footer = 'Generated with <a href="https://github.com/nene/jsduck">JSDuck</a>.' @extjs_path = "extjs/ext-all-debug.js" @append_html = "" @timer = Timer.new Loading Loading @@ -321,6 +323,7 @@ module JsDuck Logger.instance.log("Creating #{dir}/index.html...") html = IO.read(template_dir+"/index.html") html.gsub!("{title}", @title) html.gsub!("{footer}", @footer) html.gsub!("{extjs_path}", @extjs_path) html.gsub!("{append_html}", @append_html) FileUtils.rm(dir+"/index.html") Loading lib/jsduck/class.rb +16 −13 Original line number Diff line number Diff line Loading @@ -68,12 +68,11 @@ module JsDuck # Returns array of all public members of particular type in a class, # sorted by name. # # For methods the the constructor is listed as first method having # the same name as class itself. # For methods the the constructor is listed first. # # See members_hash for details. def members(type) ms = members_hash(type).values.sort {|a,b| a[:name] <=> b[:name] } def members(type, context=:members) ms = members_hash(type, context).values.sort {|a,b| a[:name] <=> b[:name] } type == :method ? constructor_first(ms) : ms end Loading @@ -83,11 +82,7 @@ module JsDuck constr = ms.find {|m| m[:name] == "constructor" } if constr ms.delete(constr) # Clone it. Otherwise the search for "constructor" from this # class will return nothing as we have renamed it. constr2 = constr.clone constr2[:name] = short_name ms.unshift(constr2) ms.unshift(constr) end ms end Loading @@ -98,14 +93,19 @@ module JsDuck # # When parent and child have members with same name, # member from child overrides tha parent member. def members_hash(type) all_members = parent ? parent.members_hash(type) : {} def members_hash(type, context=:members) all_members = parent ? parent.members_hash(type, context) : {} mixins.each do |mix| all_members.merge!(mix.members_hash(type)) all_members.merge!(mix.members_hash(type, context)) end (@doc[:members][type] || []).each do |m| # For static members, exclude everything not explicitly marked as inheritable if context == :statics all_members.delete_if {|key, member| !member[:inheritable] } end (@doc[context][type] || []).each do |m| all_members[m[:name]] = m if !m[:private] end Loading @@ -122,6 +122,9 @@ module JsDuck @doc[:members].each_key do |type| @type_map.merge!(members_hash(type)) end @doc[:statics].each_key do |type| @type_map.merge!(members_hash(type, :statics)) end end @type_map[name] && @type_map[name][:tagname] Loading Loading
Rakefile +23 −25 Original line number Diff line number Diff line Loading @@ -69,31 +69,44 @@ task :sdk do ]) end desc "Run JSDuck on ExtJS SDK for export" task :export do def run_jsduck_export(extra_options, ext_dir) load_sdk_vars rev = `git rev-parse HEAD`.slice(0, 7) run_jsduck([ "--title", "Ext JS 4.0.2 API Documentation", "--title", "Ext JS 4.0.3 API Documentation", "--footer", "ExtJS 4.0.3 Documentation from Sencha. Generated with <a href='https://github.com/nene/jsduck'>JSDuck</a> revison #{rev}", "--extjs-path", "extjs/ext-all.js", "#{SDK_DIR}/extjs/src", "#{SDK_DIR}/platform/src", "#{SDK_DIR}/platform/core/src", ]) ].concat(extra_options)) system "rm #{OUT_DIR}/extjs" system "mkdir -p #{OUT_DIR}/extjs/resources/themes/images" system "cp #{EXT_DIR}/ext-all.js #{OUT_DIR}/extjs" system "cp -r #{EXT_DIR}/resources/themes/images/default #{OUT_DIR}/extjs/resources/themes/images" system "rm -rf #{OUT_DIR}/resources/sass" system "cp -r #{ext_dir}/resources/themes/images/default #{OUT_DIR}/extjs/resources/themes/images" system "rm -rf #{ext_dir}/resources/sass" system "rm -rf #{OUT_DIR}/resources/.sass-cache" end desc "Run JSDuck on ExtJS SDK for export" task :live_docs do desc "Run JSDuck on ExtJS SDK to create release version of docs app" task :export do load_sdk_vars run_jsduck_export([ "--append-html", <<-EOHTML <div id="notice-text" style="display: none"> Use <a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a> for up to date documentation and features </div> EOHTML ], EXT_DIR) end analytics = <<-EOHTML desc "Run JSDuck on ExtJS SDK to create live docs app" task :live_docs do load_sdk_vars run_jsduck_export([ "--append-html", <<-EOHTML <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1396058-10']); Loading Loading @@ -122,22 +135,7 @@ task :live_docs do } </script> EOHTML run_jsduck([ "--title", "Ext JS 4.0.1 API Documentation", "--extjs-path", "extjs/ext-all.js", "--append-html", analytics, "#{SDK_DIR}/extjs/src", "#{SDK_DIR}/platform/src", "#{SDK_DIR}/platform/core/src", ]) system "rm #{OUT_DIR}/extjs" system "mkdir -p #{OUT_DIR}/extjs/resources/themes/images" system "cp #{SDK_DIR}/extjs/build/sdk/ext-all.js #{OUT_DIR}/extjs" system "cp -r #{SDK_DIR}/extjs/build/sdk/resources/themes/images/default #{OUT_DIR}/extjs/resources/themes/images" system "rm -rf #{OUT_DIR}/resources/sass" system "rm -rf #{OUT_DIR}/resources/.sass-cache" ], "#{SDK_DIR}/extjs/build/sdk") end desc "Run JSDuck on the Docs app itself" Loading
bin/jsduck +4 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,10 @@ opts = OptionParser.new do | opts | app.extjs_path = path end opts.on('--footer=TEXT', "Custom footer text for the documentation app.", " ") do |text| app.footer = text end opts.on('--guides=PATH', "Path to guides directory.", "Each subdirectory of that is treated as a guide", "and is expectd to contain a REAME.md file,", Loading
lib/jsduck/aggregator.rb +7 −2 Original line number Diff line number Diff line Loading @@ -73,19 +73,23 @@ module JsDuck def add_member(node) if node[:owner] if @classes[node[:owner]] @classes[node[:owner]][:members][node[:tagname]] << node add_to_class(@classes[node[:owner]], node) else add_orphan(node) end elsif @current_class node[:owner] = @current_class[:name] @current_class[:members][ node[:tagname] ] << node add_to_class(@current_class, node) else add_orphan(node) end @aliases << node if node[:alias] end def add_to_class(cls, member) cls[member[:static] ? :statics : :members][member[:tagname]] << member end def add_orphan(node) @orphans << node end Loading Loading @@ -151,6 +155,7 @@ module JsDuck :mixins => [], :alternateClassNames => [], :members => Class.default_members_hash, :statics => Class.default_members_hash, :filename => "", :html_filename => "", :linenr => 0, Loading
lib/jsduck/app.rb +3 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ module JsDuck attr_accessor :external_classes attr_accessor :show_private_classes attr_accessor :title attr_accessor :footer attr_accessor :extjs_path attr_accessor :append_html Loading @@ -50,6 +51,7 @@ module JsDuck @external_classes = [] @show_private_classes = false @title = "Ext JS API Documentation" @footer = 'Generated with <a href="https://github.com/nene/jsduck">JSDuck</a>.' @extjs_path = "extjs/ext-all-debug.js" @append_html = "" @timer = Timer.new Loading Loading @@ -321,6 +323,7 @@ module JsDuck Logger.instance.log("Creating #{dir}/index.html...") html = IO.read(template_dir+"/index.html") html.gsub!("{title}", @title) html.gsub!("{footer}", @footer) html.gsub!("{extjs_path}", @extjs_path) html.gsub!("{append_html}", @append_html) FileUtils.rm(dir+"/index.html") Loading
lib/jsduck/class.rb +16 −13 Original line number Diff line number Diff line Loading @@ -68,12 +68,11 @@ module JsDuck # Returns array of all public members of particular type in a class, # sorted by name. # # For methods the the constructor is listed as first method having # the same name as class itself. # For methods the the constructor is listed first. # # See members_hash for details. def members(type) ms = members_hash(type).values.sort {|a,b| a[:name] <=> b[:name] } def members(type, context=:members) ms = members_hash(type, context).values.sort {|a,b| a[:name] <=> b[:name] } type == :method ? constructor_first(ms) : ms end Loading @@ -83,11 +82,7 @@ module JsDuck constr = ms.find {|m| m[:name] == "constructor" } if constr ms.delete(constr) # Clone it. Otherwise the search for "constructor" from this # class will return nothing as we have renamed it. constr2 = constr.clone constr2[:name] = short_name ms.unshift(constr2) ms.unshift(constr) end ms end Loading @@ -98,14 +93,19 @@ module JsDuck # # When parent and child have members with same name, # member from child overrides tha parent member. def members_hash(type) all_members = parent ? parent.members_hash(type) : {} def members_hash(type, context=:members) all_members = parent ? parent.members_hash(type, context) : {} mixins.each do |mix| all_members.merge!(mix.members_hash(type)) all_members.merge!(mix.members_hash(type, context)) end (@doc[:members][type] || []).each do |m| # For static members, exclude everything not explicitly marked as inheritable if context == :statics all_members.delete_if {|key, member| !member[:inheritable] } end (@doc[context][type] || []).each do |m| all_members[m[:name]] = m if !m[:private] end Loading @@ -122,6 +122,9 @@ module JsDuck @doc[:members].each_key do |type| @type_map.merge!(members_hash(type)) end @doc[:statics].each_key do |type| @type_map.merge!(members_hash(type, :statics)) end end @type_map[name] && @type_map[name][:tagname] Loading