From 53bf8308fae62b6f2c50df62c1b52b574bd0747a Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sun, 28 Jul 2013 11:20:59 +0300 Subject: [PATCH] htdocs: * update deps * use double quotes and fix warnings --- htdocs/site/.jshintrc | 6 +++--- htdocs/site/js/github.js | 4 +++- htdocs/site/make.js | 30 +++++++++++++++--------------- htdocs/site/package.json | 6 +++--- htdocs/site/run-tests.js | 28 +++++++++++++++------------- 5 files changed, 39 insertions(+), 35 deletions(-) diff --git a/htdocs/site/.jshintrc b/htdocs/site/.jshintrc index 799b3f8db..8f5e29a27 100644 --- a/htdocs/site/.jshintrc +++ b/htdocs/site/.jshintrc @@ -1,9 +1,7 @@ { - "node" : true, - "browser" : false, - "bitwise": true, "boss": true, + "browser": false, "camelcase": true, "curly": true, "eqeqeq": true, @@ -11,8 +9,10 @@ "latedef": true, "multistr": true, "noarg": true, + "node": true, "noempty": true, "plusplus": false, + "quotmark": "double", "regexp": true, "shelljs": true, "strict": false, diff --git a/htdocs/site/js/github.js b/htdocs/site/js/github.js index 870853165..07be3322a 100644 --- a/htdocs/site/js/github.js +++ b/htdocs/site/js/github.js @@ -1,5 +1,7 @@ /*! Inspired by: http://aboutcode.net/2010/11/11/list-github-projects-using-javascript.html */ +/* jshint quotmark:true, jquery:true */ + jQuery.fn.listCommits = function(username, repository, branch) { this.html('Querying GitHub for recent commits…'); @@ -26,7 +28,7 @@ jQuery.fn.listCommits = function(username, repository, branch) { }); function cutLines(message) { - var lineFeed = message.indexOf("\n"); + var lineFeed = message.indexOf('\n'); if (lineFeed > -1) { return message.slice(0, lineFeed); diff --git a/htdocs/site/make.js b/htdocs/site/make.js index 62f950d9f..7ae1031f9 100644 --- a/htdocs/site/make.js +++ b/htdocs/site/make.js @@ -17,13 +17,13 @@ */ (function () { - 'use strict'; + "use strict"; - require('shelljs/make'); - var fs = require('fs'), - cleanCSS = require('clean-css'), - UglifyJS = require('uglify-js'), - ROOT_DIR = __dirname + '/'; // absolute path to project's root + require("shelljs/make"); + var fs = require("fs"), + cleanCSS = require("clean-css"), + UglifyJS = require("uglify-js"), + ROOT_DIR = __dirname + "/"; // absolute path to project's root // // make minify @@ -35,9 +35,9 @@ // pack.css - var inCss = cat(['css/all.css', - 'css/demo.css', - 'css/normalize.css' + var inCss = cat(["css/all.css", + "css/demo.css", + "css/normalize.css" ]); var packCss = cleanCSS.process(inCss, { @@ -45,16 +45,16 @@ keepSpecialComments: 0 }); - fs.writeFileSync('css/pack.css', packCss, 'utf8'); + fs.writeFileSync("css/pack.css", packCss, "utf8"); echo(); - echo('### Finished' + ' ' + 'css/pack.css' + '.'); + echo("### Finished" + " " + "css/pack.css" + "."); echo(); echo("### Minifying js files..."); - var inJs = cat(['js/github.js', - 'js/picnet.table.filter.min.js']); + var inJs = cat(["js/github.js", + "js/picnet.table.filter.min.js"]); var minifiedJs = UglifyJS.minify(inJs, { compress: true, @@ -63,10 +63,10 @@ warnings: false }); - fs.writeFileSync('js/pack.js', minifiedJs.code, 'utf8'); + fs.writeFileSync("js/pack.js", minifiedJs.code, "utf8"); echo(); - echo('### Finished' + ' ' + 'js/pack.js' + '.'); + echo("### Finished" + " " + "js/pack.js" + "."); }; diff --git a/htdocs/site/package.json b/htdocs/site/package.json index 820f54f05..187b4497e 100644 --- a/htdocs/site/package.json +++ b/htdocs/site/package.json @@ -1,6 +1,6 @@ { "name": "cppcheck-web", - "version": "0.1.1", + "version": "0.1.2", "author": "XhmikosR (https://github.com/XhmikosR)", "description": "The dependencies to build cppcheck's website", "homepage": "https://github.com/danmar/cppcheck", @@ -19,9 +19,9 @@ "lint": "node run-tests" }, "dependencies": { - "clean-css": "~1.0.10", + "clean-css": "~1.0.12", "csslint": "~0.9.10", - "jshint": "~2.1.4", + "jshint": "~2.1.5", "shelljs": "~0.1.4", "uglify-js": "~2.3.6" }, diff --git a/htdocs/site/run-tests.js b/htdocs/site/run-tests.js index 17d7302b6..f4df5a0fd 100644 --- a/htdocs/site/run-tests.js +++ b/htdocs/site/run-tests.js @@ -18,25 +18,25 @@ * along with this program. If not, see . */ -require('shelljs/global'); +require("shelljs/global"); cd(__dirname); // // JSHint // -JSHINT_BIN = './node_modules/jshint/bin/jshint'; +var jshintBin = "./node_modules/jshint/bin/jshint"; -if (!test('-f', JSHINT_BIN)) { - echo('JSHint not found. Run `npm install` in the root dir first.'); +if (!test("-f", jshintBin)) { + echo("JSHint not found. Run `npm install` in the root dir first."); exit(1); } -if (exec('node' +' ' + JSHINT_BIN +' ' + 'make.js run-tests.js').code !== 0) { - echo('*** JSHint failed! (return code != 0)'); +if (exec("node" + " " + jshintBin + " " + "make.js run-tests.js js/github.js").code !== 0) { + echo("*** JSHint failed! (return code != 0)"); echo(); } else { - echo('JSHint completed successfully'); + echo("JSHint completed successfully"); echo(); } @@ -44,14 +44,16 @@ if (exec('node' +' ' + JSHINT_BIN +' ' + 'make.js run-tests.js').code !== 0) { // // csslint // -CSSLINT_BIN = './node_modules/csslint/cli.js'; +var csslintBin = "./node_modules/csslint/cli.js"; -if (!test('-f', CSSLINT_BIN)) { - echo('csslint not found. Run `npm install` in the root dir first.'); +if (!test("-f", csslintBin)) { + echo("csslint not found. Run `npm install` in the root dir first."); exit(1); } -if (exec('node' +' ' + CSSLINT_BIN +' ' + 'css/all.css').code !== 0) { - echo('*** csslint failed! (return code != 0)'); +// csslint doesn't return proper error codes... +/*if (exec("node" + " " + csslintBin + " " + "css/all.css").code !== 0) { + echo("*** csslint failed! (return code != 0)"); echo(); -} +}*/ +exec("node" + " " + csslintBin + " " + "css/all.css");