Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
language: node_js
node_js:
- "0.10"
- "0.12"
- "4"
- "5"
- "6"
- "7"
- "8"
- "9"
sudo: false
after_success:
- "npm run coverage"
Expand Down
20 changes: 8 additions & 12 deletions lib/fs-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,14 @@ var helpers = {
*
* @param {String} path
*/
exists: typeof fs.access === 'function' ?
function (path) {
try {
fs.accessSync(path);
return true;
} catch (err) {
return false;
}
} :
function (path) {
return fs.existsSync(path);
},
exists: function (path) {
try {
fs.accessSync(path);
return true;
} catch (err) {
return false;
}
},

/**
* @param {String} path
Expand Down
8 changes: 1 addition & 7 deletions lib/git-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,7 @@ module.exports = {
fsHelpers.makeDir(hooksPath);
HOOKS.forEach(function (hookName) {
var hookPath = path.resolve(hooksPath, hookName);
try {
fs.writeFileSync(hookPath, hook, {mode: '0777'});
} catch (e) {
// node 0.8 fallback
fs.writeFileSync(hookPath, hook, 'utf8');
fs.chmodSync(hookPath, '0777');
}
fs.writeFileSync(hookPath, hook, {mode: '0777'});
});
},

Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"prepare-commit-msg"
],
"engines": {
"node": ">=0.8.x"
"node": ">=5"
},
"engine-strict": true,
"scripts": {
Expand All @@ -48,11 +48,11 @@
"lib"
],
"devDependencies": {
"chai": "2.3.0",
"istanbul": "0.3.17",
"jscs": "1.13.1",
"jshint": "2.8.0",
"mocha": "2.2.5"
"chai": "4.1.2",
"istanbul": "0.4.5",
"jscs": "2.11.0",
"jshint": "2.9.5",
"mocha": "5.1.1"
},
"license": "MIT"
}
11 changes: 3 additions & 8 deletions tests/uninstall.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require('chai').should();
var exec = require('child_process').exec;
var execSync = require('child_process').execSync;
var gitHooks = require('../lib/git-hooks');
var fsHelpers = require('../lib/fs-helpers');

Expand All @@ -9,14 +9,9 @@ var GIT_HOOKS = GIT_ROOT + 'hooks';
var GIT_HOOKS_OLD = GIT_ROOT + 'hooks.old';

describe('--uninstall', function () {
beforeEach(function (done) {
beforeEach(function () {
fsHelpers.makeDir(SANDBOX_PATH);
exec('git init', {cwd: SANDBOX_PATH}, function (err) {
if (err) {
throw err;
}
done();
});
execSync('git init', {cwd: SANDBOX_PATH});
});

afterEach(function () {
Expand Down