Skip to content

Commit 740453d

Browse files
committed
remove unneeded locals
1 parent dcebe44 commit 740453d

File tree

26 files changed

+56
-63
lines changed

26 files changed

+56
-63
lines changed

generate/templates/templates/nodegit.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ exports.__proto__ = rawApi;
5454

5555
var importExtension = function(name) {
5656
try {
57-
require(local(name));
57+
require(name);
5858
}
5959
catch (unhandledException) {
6060
if (unhandledException.code != "MODULE_NOT_FOUND") {
@@ -65,14 +65,14 @@ var importExtension = function(name) {
6565

6666
// Load up utils
6767
rawApi.Utils = {};
68-
require(local("utils", "lookup_wrapper"));
69-
require(local("utils", "normalize_options"));
68+
require("utils/lookup_wrapper");
69+
require("utils/normalize_options");
7070

7171
// Load up extra types;
72-
require(local("convenient_hunk"));
73-
require(local("convenient_patch"));
74-
require(local("status_file"));
75-
require(local("enums.js"));
72+
require("convenient_hunk");
73+
require("convenient_patch");
74+
require("status_file");
75+
require("enums.js");
7676

7777
// Import extensions
7878
{% each %}

lifecycleScripts/install.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,17 @@ var promisify = require("promisify-node");
33
var path = require("path");
44
var fs = require("fs");
55

6-
var local = path.join.bind(path, __dirname);
7-
8-
var checkPrepared = require(local("checkPrepared"));
6+
var checkPrepared = require("./checkPrepared");
97
var whichNativeNodish = require("which-native-nodish");
10-
var prepareForBuild = require(local("prepareForBuild"));
8+
var prepareForBuild = require("./prepareForBuild");
119

1210
var exec = promisify(function(command, opts, callback) {
1311
return require("child_process").exec(command, opts, callback);
1412
});
1513
var nwVersion = null;
1614
var asVersion = null;
1715

18-
return whichNativeNodish(local(".."))
16+
return whichNativeNodish("..")
1917
.then(function(results) {
2018
nwVersion = results.nwVersion;
2119
asVersion = results.asVersion;
@@ -29,7 +27,7 @@ return whichNativeNodish(local(".."))
2927
console.info("[nodegit] Must build for atom-shell");
3028
return checkAndBuild();
3129
}
32-
if (fs.existsSync(local("../.didntcomefromthenpmregistry"))) {
30+
if (fs.existsSync("../.didntcomefromthenpmregistry")) {
3331
return checkAndBuild();
3432
}
3533
if (process.env.BUILD_DEBUG) {
@@ -85,7 +83,7 @@ function build() {
8583
}
8684

8785
var opts = {
88-
cwd: local(".."),
86+
cwd: "..",
8987
maxBuffer: Number.MAX_VALUE
9088
};
9189

test/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
var fork = require("child_process").fork;
22
var path = require("path");
3-
var local = path.join.bind(path, __dirname);
43

54
var args = [
65
"cover",
76
process.platform != "win32" ?
87
"_mocha" :
9-
local("../node_modules/mocha/bin/_mocha"),
8+
"../node_modules/mocha/bin/_mocha",
109
"--",
1110
"runner",
1211
"tests",
1312
"--report=lcov",
1413
"--expose-gc"
1514
];
1615

17-
fork(local("../node_modules/istanbul/lib/cli.js"), args, {
16+
fork("../node_modules/istanbul/lib/cli.js", args, {
1817
cwd: __dirname
1918
}).on("close", function(code) {
2019
process.exit(code);

test/tests/attr.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ var path = require("path");
33
var local = path.join.bind(path, __dirname);
44

55
describe("Attr", function() {
6-
var NodeGit = require(local("../../"));
6+
var NodeGit = require("../../");
77
var Repository = NodeGit.Repository;
88
var Attr = NodeGit.Attr;
99
var Status = NodeGit.Status;
1010

11-
var reposPath = local("../repos/workdir/.git");
11+
var reposPath = local("../repos/workdir");
1212

1313
beforeEach(function() {
1414
var test = this;

test/tests/blob.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ var path = require("path");
33
var local = path.join.bind(path, __dirname);
44

55
describe("Blob", function() {
6-
var NodeGit = require(local("../../"));
6+
var NodeGit = require("../../");
77

88
var Oid = NodeGit.Oid;
99
var Repository = NodeGit.Repository;
1010
var FileMode = NodeGit.TreeEntry.FILEMODE;
1111

12-
var reposPath = local("../repos/workdir/.git");
12+
var reposPath = local("../repos/workdir");
1313
var oid = "111dd657329797f6165f52f5085f61ac976dcf04";
1414

1515
beforeEach(function() {

test/tests/branch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ var Promise = require("nodegit-promise");
44
var local = path.join.bind(path, __dirname);
55

66
describe("Branch", function() {
7-
var NodeGit = require(local("../../"));
7+
var NodeGit = require("../../");
88
var Repository = NodeGit.Repository;
99
var Branch = NodeGit.Branch;
1010
var branchName = "test-branch";
1111
var fullBranchName = "refs/heads/" + branchName;
1212

13-
var reposPath = local("../repos/workdir/.git");
13+
var reposPath = local("../repos/workdir");
1414

1515
beforeEach(function() {
1616
var test = this;

test/tests/checkout.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ var path = require("path");
33
var local = path.join.bind(path, __dirname);
44

55
describe("Checkout", function() {
6-
var NodeGit = require(local("../../"));
6+
var NodeGit = require("../../");
77
var Repository = NodeGit.Repository;
88
var Checkout = NodeGit.Checkout;
99

1010
var packageJsonOid = "0fa56e90e096a4c24c785206b826ab914ea3de1e";
11-
var reposPath = local("../repos/workdir/.git");
11+
var reposPath = local("../repos/workdir");
1212

1313
beforeEach(function() {
1414
var test = this;

test/tests/clone.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var fse = promisify(require("fs-extra"));
55
var local = path.join.bind(path, __dirname);
66

77
describe("Clone", function() {
8-
var NodeGit = require(local("../../"));
8+
var NodeGit = require("../../");
99
var Repository = NodeGit.Repository;
1010
var Clone = NodeGit.Clone;
1111

test/tests/commit.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ var fse = promisify(require("fs-extra"));
66
var local = path.join.bind(path, __dirname);
77

88
describe("Commit", function() {
9-
var NodeGit = require(local("../../"));
9+
var NodeGit = require("../../");
1010
var Repository = NodeGit.Repository;
1111

12-
var reposPath = local("../repos/workdir/.git");
12+
var reposPath = local("../repos/workdir");
1313
var oid = "fce88902e66c72b5b93e75bdb5ae717038b221f6";
1414

1515
function reinitialize(test) {

test/tests/cred.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var path = require("path");
33
var local = path.join.bind(path, __dirname);
44

55
describe("Cred", function() {
6-
var NodeGit = require(local("../../"));
6+
var NodeGit = require("../../");
77

88
var sshPublicKey = local("../id_rsa.pub");
99
var sshPrivateKey = local("../id_rsa");

0 commit comments

Comments
 (0)