jenkins-bot has submitted this change and it was merged. Change subject: Rename JSDuck config to standard 'jsduck' ......................................................................
Rename JSDuck config to standard 'jsduck' * Move configuration to /jsduck.json per standard. * Move --processes=0 from maintenace script into config file. * Use grunt-contrib-copy instead of a symlink for resources. Also removed old JSDuck 4 logic. Change-Id: Iaaaac50ee78dd9ff8f24f1ef3a3685ad51cf33b2 (cherry picked from commit 3bbd27aa4911e491a6e0838438e9bc03c9df22c6) --- M Gruntfile.js A jsduck.json D maintenance/jsduck/MetaTags.rb D maintenance/jsduck/config.json M maintenance/mwjsduck-gen M package.json 6 files changed, 49 insertions(+), 161 deletions(-) Approvals: Krinkle: Looks good to me, approved jenkins-bot: Verified diff --git a/Gruntfile.js b/Gruntfile.js index 22154f7..9badf03 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,5 +1,6 @@ /*jshint node:true */ module.exports = function ( grunt ) { + grunt.loadNpmTasks( 'grunt-contrib-copy' ); grunt.loadNpmTasks( 'grunt-contrib-jshint' ); grunt.loadNpmTasks( 'grunt-contrib-watch' ); grunt.loadNpmTasks( 'grunt-jscs-checker' ); @@ -35,7 +36,17 @@ '.{jshintrc,jscs.json,jshintignore,csslintrc}', '<%= jshint.all %>' ], - tasks: ['test'] + tasks: 'test' + }, + copy: { + jsduck: { + src: 'resources/**/*', + dest: 'docs/js/modules', + expand: true, + rename: function ( dest, src ) { + return require( 'path' ).join( dest, src.replace( 'resources/', '' ) ); + } + } } } ); diff --git a/jsduck.json b/jsduck.json new file mode 100644 index 0000000..5fbabd3 --- /dev/null +++ b/jsduck.json @@ -0,0 +1,30 @@ +{ + "--title": "MediaWiki core - Documentation", + "--categories": "maintenance/jsduck/categories.json", + "--eg-iframe": "maintenance/jsduck/eg-iframe.html", + "--tags": "maintenance/jsduck/CustomTags.rb", + "--warnings": ["-nodoc(class,public)"], + "--builtin-classes": true, + "--processes": "0", + "--warnings-exit-nonzero": true, + "--external": "HTMLElement,HTMLDocument,Window", + "--output": "docs/js", + "--": [ + "maintenance/jsduck/external.js", + "resources/src/mediawiki", + "resources/src/mediawiki.action/mediawiki.action.edit.js", + "resources/src/mediawiki.action/mediawiki.action.view.postEdit.js", + "resources/src/mediawiki.page/mediawiki.page.startup.js", + "resources/src/mediawiki.page/mediawiki.page.watch.ajax.js", + "resources/src/mediawiki.api", + "resources/src/mediawiki.language", + "resources/src/jquery/jquery.arrowSteps.js", + "resources/src/jquery/jquery.autoEllipsis.js", + "resources/src/jquery/jquery.badge.js", + "resources/src/jquery/jquery.byteLimit.js", + "resources/src/jquery/jquery.localize.js", + "resources/src/jquery/jquery.spinner.js", + "resources/lib/oojs", + "resources/lib/oojs-ui" + ] +} diff --git a/maintenance/jsduck/MetaTags.rb b/maintenance/jsduck/MetaTags.rb deleted file mode 100644 index cde7d3b..0000000 --- a/maintenance/jsduck/MetaTags.rb +++ /dev/null @@ -1,103 +0,0 @@ -# Custom tags for JSDuck 4.x -# See also: -# - https://github.com/senchalabs/jsduck/wiki/Tags -# - https://github.com/senchalabs/jsduck/wiki/Custom-tags -# - https://github.com/senchalabs/jsduck/wiki/Custom-tags/7f5c32e568eab9edc8e3365e935bcb836cb11f1d -require 'jsduck/meta_tag' - -class SourceTag < JsDuck::MetaTag - def initialize - # This defines the name of the @tag - @name = 'source' - end - - # Generate HTML output for this tag. - # One can make use of the #format method to easily support - # Markdown and {@link} tags inside the contents of the tag. - # - # @param tags All matches of this tag on one class. - def to_html(tags) - '<h3 class="pa">Source</h3>' + tags.map {|tag| format(tag) }.join("\n") - end -end - -class ContextTag < JsDuck::MetaTag - def initialize - @name = 'context' - end - - # @param tags All matches of this tag on one class. - def to_html(tags) - return '<h3 class="pa">Context</h3>' + render_long_context(tags.last) - end - - def render_long_context(tag) - if tag =~ /\A([^\s]+)/m - name = $1 - return format("`this` : {@link #{name}}") - end - end -end - -class SeeTag < JsDuck::MetaTag - def initialize - @name = 'see' - @multiline = true - end - - # @param tags All matches of this tag on one class. - def to_html(tags) - doc = [] - doc << '<h3 class="pa">Related</h3>' - doc << [ - '<ul>', - tags.map {|tag| render_long_see(tag) }, - '</ul>', - ] - doc - end - - def render_long_see(tag) - if tag =~ /\A([^\s]+)( .*)?\Z/m - name = $1 - doc = $2 ? ': ' + $2 : '' - return [ - '<li>', - format("{@link #{name}} #{doc}"), - '</li>' - ] - end - end -end - -# As of JSDuck 5 this is in core -class FiresTag < JsDuck::MetaTag - def initialize - @name = 'fires' - @multiline = true - end - - # @param tags All matches of this tag on one class. - def to_html(tags) - doc = [] - doc << '<h3 class="pa">Fires</h3>' - doc << [ - '<ul>', - tags.map {|tag| render_long_event(tag) }, - '</ul>', - ] - doc - end - - def render_long_event(tag) - if tag =~ /\A(\w+)( .*)?\Z/m - name = $1 - doc = $2 ? ': ' + $2 : '' - return [ - '<li>', - format("{@link #event-#{name}} #{doc}"), - '</li>' - ] - end - end -end diff --git a/maintenance/jsduck/config.json b/maintenance/jsduck/config.json deleted file mode 100644 index 493815e..0000000 --- a/maintenance/jsduck/config.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "--title": "MediaWiki core - Documentation", - "--footer": "Documentation for MediaWiki core. Generated on {DATE} by {JSDUCK} {VERSION}.", - "--categories": "./categories.json", - "--eg-iframe": "./eg-iframe.html", - "--builtin-classes": true, - "--output": "../../docs/js", - "--external": "HTMLElement,HTMLDocument,Window", - "--": [ - "./external.js", - "../../resources/src/mediawiki", - "../../resources/src/mediawiki.action/mediawiki.action.edit.js", - "../../resources/src/mediawiki.action/mediawiki.action.view.postEdit.js", - "../../resources/src/mediawiki.page/mediawiki.page.startup.js", - "../../resources/src/mediawiki.page/mediawiki.page.watch.ajax.js", - "../../resources/src/mediawiki.api", - "../../resources/src/mediawiki.language", - "../../resources/src/jquery/jquery.arrowSteps.js", - "../../resources/src/jquery/jquery.autoEllipsis.js", - "../../resources/src/jquery/jquery.badge.js", - "../../resources/src/jquery/jquery.byteLimit.js", - "../../resources/src/jquery/jquery.localize.js", - "../../resources/src/jquery/jquery.spinner.js", - "../../resources/lib/oojs", - "../../resources/lib/oojs-ui" - ] -} diff --git a/maintenance/mwjsduck-gen b/maintenance/mwjsduck-gen index 62d1bba..6b7c77b 100755 --- a/maintenance/mwjsduck-gen +++ b/maintenance/mwjsduck-gen @@ -1,30 +1,4 @@ #!/usr/bin/env bash - -JSDUCK_MWVERSION=master -if [[ "$1" == "--version" && "$2" != "" ]] -then - JSDUCK_MWVERSION="$2" -elif [[ "$*" != "" ]] -then - echo "Usage: $0 [--version <mediawiki version>]" - echo - exit 1 -fi - -# Support jsduck 4.x and 5.x -JSDUCK_VERSION="$(jsduck --version | sed -e 's/[.].*//')" -if [ "$JSDUCK_VERSION" = "JSDuck 4" ]; then - JSDUCK_VERSION_OPT="--meta-tags ./maintenance/jsduck/MetaTags.rb --warnings=-no_doc" -else - JSDUCK_VERSION_OPT="--tags ./maintenance/jsduck/CustomTags.rb --warnings=-nodoc(class,public)" -fi - -MWCORE_DIR=$(cd $(dirname $0)/..; pwd) - -jsduck \ ---config=$MWCORE_DIR/maintenance/jsduck/config.json \ -$JSDUCK_VERSION_OPT \ ---footer="Documentation for branch ($JSDUCK_MWVERSION) on {DATE} by {JSDUCK} {VERSION}." \ ---processes 0 --warnings-exit-nonzero \ -&& echo 'JSDuck execution finished.' \ -&& ln -s ../../resources $MWCORE_DIR/docs/js/modules +set -e +cd $(dirname $0)/.. +jsduck diff --git a/package.json b/package.json index 7694d4a..a9b9148 100644 --- a/package.json +++ b/package.json @@ -2,11 +2,14 @@ "name": "mediawiki", "version": "0.0.0", "scripts": { - "test": "grunt test" + "test": "grunt test", + "doc": "jsduck", + "postdoc": "grunt copy:jsduck" }, "devDependencies": { "grunt": "0.4.2", "grunt-contrib-jshint": "0.9.2", + "grunt-contrib-copy": "0.8.0", "grunt-contrib-watch": "0.6.1", "grunt-jscs-checker": "0.4.1" } -- To view, visit https://gerrit.wikimedia.org/r/196236 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iaaaac50ee78dd9ff8f24f1ef3a3685ad51cf33b2 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: REL1_23 Gerrit-Owner: Krinkle <krinklem...@gmail.com> Gerrit-Reviewer: Krinkle <krinklem...@gmail.com> Gerrit-Reviewer: Parent5446 <tylerro...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits