Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[refactor] Remove usage of `require.paths`

  • Loading branch information...
commit 0795ae00a0d58176039f7a418779df8202f1477f 1 parent c36023f
@indexzero indexzero authored
View
4 bin/jitsu
@@ -1,12 +1,10 @@
#!/usr/bin/env node
-require.paths.unshift(require('path').join(__dirname, '..', 'lib'));
-
var eyes = require('eyes'),
colors = require('colors'),
winston = require('winston'),
argv = require('optimist').argv,
- jitsu = require('jitsu');
+ jitsu = require('../lib/jitsu');
jitsu.start(argv, function (err) {
View
24 lib/jitsu.js
@@ -5,8 +5,6 @@
*
*/
-require.paths.unshift(__dirname);
-
var jitsu = exports;
// Failure HTTP Response codes based
@@ -28,20 +26,20 @@ var successCodes = jitsu.successCodes = {
jitsu.skipAuth = false;
jitsu.started = false;
-jitsu.utils = require('jitsu/utils');
-jitsu.package = require('jitsu/package');
+jitsu.utils = require('./jitsu/utils');
+jitsu.package = require('./jitsu/package');
jitsu.log = require('cliff');
jitsu.api = {};
-jitsu.api.Client = require('jitsu/api/client').Client;
-jitsu.api.Apps = require('jitsu/api/apps').Apps;
-jitsu.api.Databases = require('jitsu/api/databases').Databases;
-jitsu.api.Logs = require('jitsu/api/logs').Logs;
-jitsu.api.Snapshots = require('jitsu/api/snapshots').Snapshots;
-jitsu.api.Users = require('jitsu/api/users').Users;
+jitsu.api.Client = require('./jitsu/api/client').Client;
+jitsu.api.Apps = require('./jitsu/api/apps').Apps;
+jitsu.api.Databases = require('./jitsu/api/databases').Databases;
+jitsu.api.Logs = require('./jitsu/api/logs').Logs;
+jitsu.api.Snapshots = require('./jitsu/api/snapshots').Snapshots;
+jitsu.api.Users = require('./jitsu/api/users').Users;
jitsu.prompt = require('prompt');
-jitsu.prompt.properties = require('jitsu/properties').properties;
-jitsu.config = require('jitsu/config');
-jitsu.commands = require('jitsu/commands');
+jitsu.prompt.properties = require('./jitsu/properties').properties;
+jitsu.config = require('./jitsu/config');
+jitsu.commands = require('./jitsu/commands');
//
// Alias the appropriate commands for simplier CLI usage
View
2  lib/jitsu/api/apps.js
@@ -7,7 +7,7 @@
var util = require('util'),
winston = require('winston'),
- jitsu = require('jitsu');
+ jitsu = require('../../jitsu');
//
// ### function Apps (options)
View
2  lib/jitsu/api/client.js
@@ -8,7 +8,7 @@
var eyes = require('eyes'),
fs = require('fs'),
request = require('request'),
- jitsu = require('jitsu');
+ jitsu = require('../../jitsu');
//
// ### function Client (options)
View
2  lib/jitsu/api/databases.js
@@ -7,7 +7,7 @@
var util = require('util'),
winston = require('winston'),
- jitsu = require('jitsu');
+ jitsu = require('../../jitsu');
//
// ### function Databases (options)
View
2  lib/jitsu/api/logs.js
@@ -7,7 +7,7 @@
var util = require('util'),
winston = require('winston'),
- jitsu = require('jitsu');
+ jitsu = require('../../jitsu');
//
// ### function Logs (options)
View
2  lib/jitsu/api/snapshots.js
@@ -7,7 +7,7 @@
var util = require('util'),
winston = require('winston'),
- jitsu = require('jitsu');
+ jitsu = require('../../jitsu');
//
// ### function Snapshots (options)
View
2  lib/jitsu/api/users.js
@@ -7,7 +7,7 @@
var util = require('util'),
winston = require('winston'),
- jitsu = require('jitsu');
+ jitsu = require('../../jitsu');
//
// ### function Users (options)
View
4 lib/jitsu/commands.js
@@ -3,7 +3,7 @@
var fs = require('fs'),
path = require('path'),
winston = require('winston'),
- jitsu = require('jitsu');
+ jitsu = require('../jitsu');
var commands = exports;
@@ -15,7 +15,7 @@ commands.commands = {};
fs.readdirSync(path.join(__dirname, 'commands')).forEach(function (cmd) {
cmd = cmd.replace('.js', '');
commands.commands.__defineGetter__(cmd, function () {
- return require('jitsu/commands/' + cmd);
+ return require('./commands/' + cmd);
});
});
View
2  lib/jitsu/commands/apps.js
@@ -8,7 +8,7 @@
var eyes = require('eyes'),
winston = require('winston'),
analyzer = require('require-analyzer'),
- jitsu = require('jitsu');
+ jitsu = require('../../jitsu');
var apps = exports;
View
4 lib/jitsu/commands/config.js
@@ -5,8 +5,8 @@
*
*/
-var jitsu = require('jitsu'),
- winston = require('winston');
+var winston = require('winston'),
+ jitsu = require('../../jitsu');
var config = exports,
noDelete = ['root', 'remoteUri', 'userconfig', 'auth', 'tmproot', 'tar', 'gzipbin'];
View
2  lib/jitsu/commands/databases.js
@@ -6,7 +6,7 @@
*/
var winston = require('winston'),
- jitsu = require('jitsu');
+ jitsu = require('../../jitsu');
var databases = exports;
View
2  lib/jitsu/commands/help.js
@@ -7,7 +7,7 @@
var colors = require('colors'),
winston = require('winston'),
- jitsu = require('jitsu');
+ jitsu = require('../../jitsu');
var help = exports;
View
2  lib/jitsu/commands/logs.js
@@ -6,7 +6,7 @@
*/
var winston = require('winston'),
- jitsu = require('jitsu');
+ jitsu = require('../../jitsu');
var logs = exports;
View
2  lib/jitsu/commands/package.js
@@ -6,7 +6,7 @@
*/
var winston = require('winston'),
- jitsu = require('jitsu');
+ jitsu = require('../../jitsu');
var package = exports;
View
2  lib/jitsu/commands/snapshots.js
@@ -7,7 +7,7 @@
var winston = require('winston'),
semver = require('semver'),
- jitsu = require('jitsu');
+ jitsu = require('../../jitsu');
var snapshots = exports;
View
2  lib/jitsu/commands/users.js
@@ -6,7 +6,7 @@
*/
var winston = require('winston'),
- jitsu = require('jitsu');
+ jitsu = require('../../jitsu');
var users = exports;
View
8 lib/jitsu/package.js
@@ -5,19 +5,19 @@
*
*/
-var util = require('util'),
+var fs = require('fs'),
path = require('path'),
- fs = require('fs'),
spawn = require('child_process').spawn,
+ util = require('util'),
async = require('async'),
analyzer = require('require-analyzer'),
npm = require('npm'),
npmout = require('npm/lib/utils/output'),
npmtar = require('npm/lib/utils/tar'),
+ optimist = require('optimist'),
semver = require('semver'),
winston = require('winston'),
- jitsu = require('jitsu'),
- optimist = require('optimist');
+ jitsu = require('../jitsu');
var package = exports;
View
10 lib/jitsu/utils/index.js
@@ -5,15 +5,15 @@
*
*/
-var util = require('util'),
- spawn = require('child_process').spawn,
- fs = require('fs'),
+var fs = require('fs'),
path = require('path'),
+ spawn = require('child_process').spawn,
+ util = require('util'),
async = require('async'),
request = require('request'),
- winston = require('winston'),
semver = require('semver'),
- jitsu = require('jitsu');
+ winston = require('winston'),
+ jitsu = require('../../jitsu');
var utils = exports;
View
6 test/client-test.js
@@ -5,13 +5,11 @@
*
*/
-require.paths.unshift(require('path').join(__dirname, '..', 'lib'));
-
var assert = require('assert'),
- vows = require('vows'),
- jitsu = require('jitsu'),
optimist = require('optimist'),
mockRequest = require('mock-request'),
+ vows = require('vows'),
+ jitsu = require('../lib/jitsu'),
helper = require('./helpers/mock-helpers');
var port = 90210,
View
12 test/commands/apps-test.js
@@ -5,15 +5,13 @@
*
*/
-require.paths.unshift(require('path').join(__dirname, '..', '..', 'lib'));
-
-var fs = require('fs'),
+var assert = require('assert'),
+ fs = require('fs'),
path = require('path'),
- assert = require('assert'),
+ mockRequest = require('mock-request'),
vows = require('vows'),
- jitsu = require('jitsu'),
- helper = require('../helpers/mock-helpers'),
- mockRequest = require('mock-request');
+ jitsu = require('../../lib/jitsu'),
+ helper = require('../helpers/mock-helpers');
var mockPrompt2 = helper.mockPrompt2,
runJitsuCommand = helper.runJitsuCommand;
View
8 test/commands/snapshots-test.js
@@ -5,13 +5,11 @@
*
*/
-require.paths.unshift(require('path').join(__dirname, '..', '..', 'lib'));
-
var assert = require('assert'),
- jitsu = require('jitsu'),
vows = require('vows'),
- helper = require('../helpers/mock-helpers'),
- mockRequest = require('mock-request');
+ mockRequest = require('mock-request'),
+ jitsu = require('../../lib/jitsu'),
+ helper = require('../helpers/mock-helpers');
var mockPrompt = helper.mockPrompt,
runJitsuCommand = helper.runJitsuCommand;
View
8 test/commands/users-test.js
@@ -5,13 +5,11 @@
*
*/
-require.paths.unshift(require('path').join(__dirname, '..', '..', 'lib'));
-
var assert = require('assert'),
- jitsu = require('jitsu'),
vows = require('vows'),
- helper = require('../helpers/mock-helpers'),
- mockRequest = require('mock-request');
+ mockRequest = require('mock-request'),
+ jitsu = require('../../lib/jitsu'),
+ helper = require('../helpers/mock-helpers');
var mockPrompt = helper.mockPrompt,
runJitsuCommand = helper.runJitsuCommand;
View
2  test/fixtures/example-app/server.js
@@ -1,6 +1,4 @@
-require('jitsu')
-
module.exports = {hi:console.log}
//console.log('FIXTURES/EXAMPLE-APP')
View
14 test/helpers/mock-helpers.js
@@ -1,17 +1,15 @@
-require.paths.unshift(require('path').join(__dirname, '..', 'lib'));
-
var assert = require('assert'),
- eyes = require('eyes'),
- jitsu = require('jitsu'),
http = require('http'),
util = require('util'),
- optimist = require('optimist'),
+ eyes = require('eyes'),
it = require('it-is'),
+ inspect = eyes.inspector({ stream: null })
nodemock = require('nodemock'),
- inspect = require('eyes').inspector({ stream: null })
- base64 = require('jitsu/utils/base64'),
- MockRequest = require('mock-request').MockRequest;
+ MockRequest = require('mock-request').MockRequest,
+ optimist = require('optimist'),
+ jitsu = require('../../lib/jitsu'),
+ base64 = require('../../lib/jitsu/utils/base64');
var port = 90210,
remoteHost = 'api.mockjitsu.com';
View
16 test/package-test.js
@@ -1,23 +1,21 @@
/*
- * log-test.js: Tests for the jitsu log module.
+ * package-test.js: Tests for the jitsu package module.
*
* (C) 2010, Nodejitsu Inc.
*
*/
-require.paths.unshift(require('path').join(__dirname, '..', 'lib'));
-
var assert = require('assert'),
+ fs = require('fs'),
+ join = require('path').join,
vows = require('vows'),
+ analyzer = require('require-analyzer'),
eyes = require('eyes'),
- jitsu = require('jitsu'),
- join = require('path').join,
+ optimist = require('optimist'),
nodemock = require('nodemock'),
- helper = require('./helpers/mock-helpers'),
- analyzer = require('require-analyzer'),
- fs = require('fs'),
nm = require('nodemock'),
- optimist = require('optimist');
+ jitsu = require('../lib/jitsu'),
+ helper = require('./helpers/mock-helpers');
//
// package.create prompts user to create package.json
Please sign in to comment.
Something went wrong with that request. Please try again.