jenkins-bot has submitted this change and it was merged.

Change subject: Run jsduck through grunt
......................................................................


Run jsduck through grunt

* New grunt commands: jsduck, docs
* Replace ruby jsduck with grunt jsduck task

If you're not running jsduck from inside vagrant then you can pass
the MediaWiki install path as an argument so that jsduck is able to find
the Mantle javascript files:
* grunt docs --MW_INSTALL_PATH=/some/path/
* make jsduck MW_INSTALL_PATH=/some/path/

Bug: 72718
Change-Id: I2ebcf50680e6d4a7e37a4dfb4247279385c0bcd9
---
M Gemfile
M Gruntfile.js
M Makefile
M package.json
4 files changed, 42 insertions(+), 12 deletions(-)

Approvals:
  Jhernandez: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Gemfile b/Gemfile
index e105845..0f6d19d 100644
--- a/Gemfile
+++ b/Gemfile
@@ -4,6 +4,5 @@
 source "https://rubygems.org";
 
 gem "chunky_png"
-gem "jsduck"
 gem "mediawiki_selenium", "~> 0.3.2"
 gem "rubocop", require: false
diff --git a/Gruntfile.js b/Gruntfile.js
index 457183c..87f5fed 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -7,6 +7,7 @@
 /*jshint node:true, strict:false*/
 /*global module*/
 module.exports = function ( grunt ) {
+       var MW_INSTALL_PATH = grunt.option('MW_INSTALL_PATH') || '../..';
 
        grunt.loadNpmTasks( 'grunt-contrib-jshint' );
        grunt.loadNpmTasks( 'grunt-jscs' );
@@ -14,6 +15,9 @@
        grunt.loadNpmTasks( 'grunt-contrib-watch' );
        grunt.loadNpmTasks( 'grunt-notify' );
        grunt.loadNpmTasks( 'grunt-svg2png' );
+       grunt.loadNpmTasks( 'grunt-jsduck' );
+       grunt.loadNpmTasks( 'grunt-contrib-clean' );
+       grunt.loadNpmTasks( 'grunt-mkdir' );
 
        grunt.initConfig( {
                URL: process.env.URL || 'http://127.0.0.1:8080/w/index.php/',
@@ -22,7 +26,8 @@
                files: {
                        js: 'javascripts/**/*.js',
                        jsTests: 'tests/qunit/**/*.js',
-                       jsExternals: 'javascripts/externals/**/*.js'
+                       jsExternals: 'javascripts/externals/**/*.js',
+                       mantleJs: MW_INSTALL_PATH + 
'/extensions/Mantle/javascripts/**/*.js'
                },
                svg2png: {
                        dist: {
@@ -90,10 +95,41 @@
                                        reload: true
                                }
                        }
+               },
+               mkdir: {
+                       jsdocs: {
+                               options: {
+                                       create: [ 'docs/js' ]
+                               }
+                       }
+               },
+               clean: {
+                       jsdocs: [ 'docs/js' ]
+               },
+               jsduck: {
+                       main: {
+                               src: [ '<%= files.mantleJs %>', '<%= files.js 
%>', '!<%= files.jsExternals %>' ],
+                               dest: 'docs/js',
+                               options: {
+                                       'builtin-classes': true,
+                                       'external': [
+                                               'Hogan.Template',
+                                               'HandleBars.Template',
+                                               'jQuery.Deferred',
+                                               'jQuery.Event',
+                                               'jQuery.Object',
+                                               'mw.user',
+                                               'OO.EventEmitter'
+                                       ],
+                                       'ignore-global': true,
+                                       'warnings': [ '-no_doc', '-dup_member', 
'-link_ambiguous' ]
+                               }
+                       }
                }
        } );
 
        grunt.registerTask( 'lint', [ 'jshint', 'jscs:main' ] );
+       grunt.registerTask( 'docs', [ 'clean:jsdocs', 'mkdir:jsdocs', 
'jsduck:main' ] );
 
        // grunt test will be run by npm test which will be run by Jenkins
        // Do not execute qunit here, or other tasks that require full mediawiki
diff --git a/Makefile b/Makefile
index 6488c80..4a903ae 100644
--- a/Makefile
+++ b/Makefile
@@ -29,16 +29,8 @@
        @node_modules/.bin/kss-node less/ docs/styleguide/ --css 
$(KSS_MF_RL_TMP) -t styleguide-template
        @rm $(KSS_MF_RL_TMP)
 
-jsduck: gems                           ## Build the JavaScript documentation
-       rm -rf docs/js
-       mkdir -p docs
-       jsduck ${MW_INSTALL_PATH}/extensions/Mantle/javascripts/ javascripts/ \
-               --output docs/js/ \
-               --warnings-exit-nonzero \
-               
--external=OO.EventEmitter,jQuery.Object,Hogan.Template,HandleBars.Template,jQuery.Deferred,jQuery.Event,mw.user
 \
-               --exclude=javascripts/external \
-               --ignore-global \
-               --warnings=nodoc
+jsduck: nodecheck                              ## Build the JavaScript 
documentation
+       @grunt docs --MW_INSTALL_PATH=${MW_INSTALL_PATH}
 
 phpdoc: nodecheck                      ## Build the PHP documentation
        mkdir -p docs
diff --git a/package.json b/package.json
index 8bb7348..3e8692a 100644
--- a/package.json
+++ b/package.json
@@ -15,10 +15,13 @@
                "svgo": ">=0.4.4"
        },
        "devDependencies": {
+               "grunt-contrib-clean": "^0.6.0",
+               "grunt-mkdir": "^0.1.2",
                "grunt-svg2png": "0.2.5",
                "grunt-contrib-jshint": "0.10.0",
                "grunt-jscs": "0.8.1",
                "jscs-jsdoc": "^0.0.24",
+               "grunt-jsduck": "^1.0.1",
                "js-beautify": "^1.5.4",
                "grunt-notify": "^0.3.1",
                "grunt-contrib-watch": "0.6.1",

-- 
To view, visit https://gerrit.wikimedia.org/r/174851
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2ebcf50680e6d4a7e37a4dfb4247279385c0bcd9
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Bmansurov <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Jhernandez <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to