-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refactor-cli-handling' into develop
* refactor: mute index.js * style: clean some empty lines * chore: update binary task and don't concatenate files * refactor: cli handling into helper module
- Loading branch information
1 parent
8144c89
commit ec863ca
Showing
9 changed files
with
136 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/*! | ||
* git-contributors (0.1.8) - 2014-05-24 | ||
* https://github.com/davidlinse/git-contributors.js.git | ||
* Copyright (c) 2014 David Linse; License: MIT | ||
*/ | ||
|
||
/** | ||
* cli helper module | ||
* @version 0.1.1 | ||
*/ | ||
|
||
module.exports = { | ||
|
||
parse: function (argv, version) { | ||
'use strict'; | ||
|
||
var program = require('commander'); | ||
|
||
// TODO: move to 'cli' helper | ||
// | ||
program | ||
.version(version) | ||
.usage('/path/to/repository') | ||
.parse(argv); | ||
|
||
if (!program.args.length) { | ||
program.help(); | ||
process.exit(0); | ||
} | ||
|
||
return program; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/*! | ||
* git-contributors (0.1.8) - 2014-05-24 | ||
* https://github.com/davidlinse/git-contributors.js.git | ||
* Copyright (c) 2014 David Linse; License: MIT | ||
*/ | ||
|
||
/** | ||
* gitlog module | ||
*/ | ||
|
||
/* jshint indent:2 */ | ||
|
||
var exec = require('child_process').exec; | ||
|
||
var git = { | ||
|
||
log: function(opts, cb) { | ||
'use strict'; | ||
|
||
process.chdir(opts.cwd); | ||
|
||
exec('git log --pretty="%an %ae"', opts, function(err, stdout) { | ||
cb(err, stdout); | ||
}); | ||
|
||
} | ||
}; | ||
|
||
module.exports = git; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/*! | ||
* git-contributors (0.1.8) - 2014-05-24 | ||
* https://github.com/davidlinse/git-contributors.js.git | ||
* Copyright (c) 2014 David Linse; License: MIT | ||
*/ | ||
|
||
/** | ||
* cli helper module | ||
* @version 0.1.1 | ||
*/ | ||
|
||
module.exports = { | ||
|
||
parse: function (argv, version) { | ||
'use strict'; | ||
|
||
var program = require('commander'); | ||
|
||
// TODO: move to 'cli' helper | ||
// | ||
program | ||
.version(version) | ||
.usage('/path/to/repository') | ||
.parse(argv); | ||
|
||
if (!program.args.length) { | ||
program.help(); | ||
process.exit(0); | ||
} | ||
|
||
return program; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,10 @@ | |
Generate the binary file. | ||
$ grunt generate-bin | ||
$ grunt generate-binary | ||
@author David Linse <[email protected]> | ||
@version 0.1.0 | ||
@version 0.1.1 | ||
@license MIT | ||
*/ | ||
|
@@ -17,20 +17,26 @@ module.exports = function(grunt) { | |
grunt.registerTask('generate-binary', function() { | ||
|
||
var shebang = grunt.file.read('fixtures/binary-header'); | ||
var footer = grunt.file.read('fixtures/binary-footer'); | ||
|
||
var opts = { | ||
process: function(content) { | ||
return shebang +'\n' + | ||
content.replace(' git = require(\'./gitlog\'),\n', ''); | ||
return shebang + '\n' + | ||
grunt.config.process('<%= banner %>') + | ||
content + '\n' + | ||
footer + '\n'; | ||
} | ||
}; | ||
|
||
var src = grunt.config.process('tmp/<%= pkg.name %>.js'); | ||
var src = grunt.config.process('lib/<%= pkg.name %>.js'); | ||
var dest = grunt.config.process('bin/<%= pkg.name %>'); | ||
|
||
grunt.file.mkdir('bin'); | ||
grunt.file.copy('lib/_cli.js', 'bin/_cli.js'); | ||
grunt.file.copy('lib/gitlog.js', 'bin/gitlog.js'); | ||
|
||
grunt.file.copy(src, dest, opts); | ||
|
||
require('fs').chmodSync(dest, '755'); | ||
}); | ||
|
||
}; |