Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 26ACDD8EA for ; Tue, 14 May 2013 17:35:07 +0000 (UTC) Received: (qmail 31847 invoked by uid 500); 14 May 2013 17:35:07 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 31813 invoked by uid 500); 14 May 2013 17:35:07 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 31805 invoked by uid 99); 14 May 2013 17:35:07 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 May 2013 17:35:07 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C81FC86F2; Tue, 14 May 2013 17:35:06 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: agrieve@apache.org To: commits@cordova.apache.org Message-Id: <2f3bc38d42744be680e3185e75868579@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: js commit: [all] Fail to package if git version is not available. Date: Tue, 14 May 2013 17:35:06 +0000 (UTC) Updated Branches: refs/heads/master 3baed3b63 -> 82c2664c4 [all] Fail to package if git version is not available. Also helps jake find git path on windows. Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/82c2664c Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/82c2664c Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/82c2664c Branch: refs/heads/master Commit: 82c2664c43c6f5058aec94cf99f25c38bc285900 Parents: 3baed3b Author: Andrew Grieve Authored: Tue May 14 13:34:26 2013 -0400 Committer: Andrew Grieve Committed: Tue May 14 13:34:26 2013 -0400 ---------------------------------------------------------------------- Jakefile | 30 ++++++++++++++++++++++++++++-- 1 files changed, 28 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-js/blob/82c2664c/Jakefile ---------------------------------------------------------------------- diff --git a/Jakefile b/Jakefile index bd1639e..0ac574c 100644 --- a/Jakefile +++ b/Jakefile @@ -61,10 +61,36 @@ function forEachFile(root, cbFile, cbDone) { } function computeGitVersion(callback) { - childProcess.exec('git describe --tags --long', function(err, stdout, stderr) { + var gitPath = 'git'; + var args = 'describe --tags --long'; + childProcess.exec(gitPath + ' ' + args, function(err, stdout, stderr) { + var isWindows = process.platform.slice(0, 3) == 'win'; + if (err && isWindows) { + gitPath = '"' + path.join(process.env['ProgramFiles'], 'Git', 'bin', 'git.exe') + '"'; + childProcess.exec(gitPath + ' ' + args, function(err, stdout, stderr) { + if (err) { + error(err); + } else { + done(stdout); + } + }); + } else if (err) { + error(err); + } else { + done(stdout); + } + }); + + function error(err) { + console.error('Git command failed: git ' + args); + console.error('Error: ' + err); + process.exit(1); + } + + function done(stdout) { var version = stdout.trim().replace(/^2.5.0-.*?-/, 'dev-'); callback(version); - }); + }; } desc("runs build");