refactor(post): use git-head instead of exec

This commit is contained in:
Christoph Witzko 2015-02-09 00:08:52 +01:00
parent 19af8b7ef2
commit e43ff5573b
2 changed files with 3 additions and 2 deletions

View File

@ -11,6 +11,7 @@
"abbrev": "^1.0.5", "abbrev": "^1.0.5",
"conventional-changelog": "0.0.11", "conventional-changelog": "0.0.11",
"error-first-handler": "^1.0.1", "error-first-handler": "^1.0.1",
"git-head": "^1.0.0",
"github": "^0.2.3", "github": "^0.2.3",
"github-url-from-git": "^1.4.0", "github-url-from-git": "^1.4.0",
"ini": "^1.3.2", "ini": "^1.3.2",

View File

@ -1,10 +1,10 @@
'use strict' 'use strict'
var exec = require('child_process').exec
var readFile = require('fs').readFileSync var readFile = require('fs').readFileSync
var url = require('url') var url = require('url')
var changelog = require('conventional-changelog') var changelog = require('conventional-changelog')
var gitHead = require('git-head')
var GitHubApi = require('github') var GitHubApi = require('github')
var parseSlug = require('parse-github-repo-url') var parseSlug = require('parse-github-repo-url')
var parseUrl = require('github-url-from-git') var parseUrl = require('github-url-from-git')
@ -31,7 +31,7 @@ module.exports = function (options, cb) {
repository: parseUrl(repository), repository: parseUrl(repository),
file: false file: false
}, efh(cb)(function (log) { }, efh(cb)(function (log) {
exec('git rev-parse HEAD', efh(cb)(function (hash) { gitHead(efh(cb)(function (hash) {
var ghRepo = parseSlug(repository) var ghRepo = parseSlug(repository)
var release = { var release = {
owner: ghRepo[0], owner: ghRepo[0],