Mvolz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/191190

Change subject: [WIP] Add Grunt and clean-up its errors
......................................................................

[WIP] Add Grunt and clean-up its errors

Add grunt to package.json and Gruntfile.js

Fix errors where grunt complains.

Change-Id: If325f350b24b534da56f28c9bb40758e407fa877
---
A Gruntfile.js
M lib/distinguish.js
M localsettings.js.sample
M package.json
M server.js
5 files changed, 61 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/citoid 
refs/changes/90/191190/1

diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100644
index 0000000..b50ac3d
--- /dev/null
+++ b/Gruntfile.js
@@ -0,0 +1,51 @@
+/*global module:false*/
+module.exports = function(grunt) {
+
+       // Project configuration.
+       grunt.initConfig({
+               // Task configuration.
+               jshint: {
+                       options: {
+                               curly: true,
+                               eqeqeq: true,
+                               immed: true,
+                               latedef: true,
+                               newcap: true,
+                               noarg: true,
+                               sub: true,
+                               undef: true,
+                               unused: true,
+                               boss: true,
+                               eqnull: true,
+                               globals: {
+                                       module: true
+                               }
+                       },
+                       gruntfile: {
+                               src: 'Gruntfile.js'
+                       },
+                       localsettings: {
+                               src: [
+                               'localsettings.js',
+                               'localsettings.js.sample'
+                               ]
+                       },
+                       server: {
+                               src: 'server.js'
+                       },
+                       lib: {
+                               src: [
+                               'lib/*.js',
+                               'lib/translators/*.js'
+                               ]
+                       }
+               }
+       });
+
+       // These plugins provide necessary tasks.
+       grunt.loadNpmTasks('grunt-contrib-jshint');
+
+       // Default task.
+       grunt.registerTask('default', ['jshint']);
+
+};
diff --git a/lib/distinguish.js b/lib/distinguish.js
index a6e866d..e879303 100644
--- a/lib/distinguish.js
+++ b/lib/distinguish.js
@@ -7,8 +7,7 @@
  */
 
 /* Import Modules */
-var request = require('request'),
-       urlParse = require('url'),
+var urlParse = require('url'),
        requestFromURL = require('./requests.js').requestFromURL,
        requestFromDOI = require('./requests.js').requestFromDOI,
        requestFromPubMedID = require('./requests.js').requestFromPubMedID;
@@ -57,9 +56,9 @@
 
 /*Test methods in main */
 if (require.main === module) {
-
        distinguish("example.com", function (extracted, selectedFcn){
-               console.log(extracted);
+               var expected = requestFromURL;
+               console.log("Matches expected: " + (expected === selectedFcn));
        });
 }
 
diff --git a/localsettings.js.sample b/localsettings.js.sample
index bb376fa..f503415 100644
--- a/localsettings.js.sample
+++ b/localsettings.js.sample
@@ -8,9 +8,6 @@
 
 var CitoidConfig = {
 
-       // Enable debug mode (prints extra debugging messages)
-       debug : true,
-
        // Allow cross-domain requests to the API (default '*')
        // Sets Access-Control-Allow-Origin header
        // enable:
diff --git a/package.json b/package.json
index dfdd7e9..7372fb0 100644
--- a/package.json
+++ b/package.json
@@ -15,6 +15,10 @@
                "xpath" : "0.0.7",
                "yargs": "1.3.3"
        },
+       "devDependencies": {
+               "grunt": "~0.4.5",
+               "grunt-contrib-jshint": "~0.10.0"
+       },
        "repository": {
                "type": "git",
                "url": 
"https://gerrit.wikimedia.org/r/mediawiki/services/citoid";
diff --git a/server.js b/server.js
index 85d9928..316e3a4 100644
--- a/server.js
+++ b/server.js
@@ -30,7 +30,6 @@
        citoidInterface = CitoidConfig.citoidInterface,
        zoteroPort = CitoidConfig.zoteroPort,
        zoteroInterface = CitoidConfig.zoteroInterface,
-       debug = CitoidConfig.debug,
        allowCORS = CitoidConfig.allowCORS;
 
 // URL base which allows further formatting by adding a single endpoint, i.e. 
'web'
@@ -122,7 +121,7 @@
 
        res.type('application/json');
 
-       var opts, dSearch,
+       var opts, dSearch, sessionID,
                format = req.query.format,
                search = req.query.search;
 
@@ -158,9 +157,9 @@
        }
 });
 
-citoid.listen(citoidPort);
+citoid.listen(citoidPort, citoidInterface);
 
-log.info('Server started on http://localhost:'+citoidPort);
+log.info('Server started on ' + citoidInterface + ':' + citoidPort);
 
 /* Exports */
 exports = module.exports = citoid;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If325f350b24b534da56f28c9bb40758e407fa877
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/citoid
Gerrit-Branch: master
Gerrit-Owner: Mvolz <[email protected]>

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

Reply via email to