You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/04/24 17:43:57 UTC
git commit: list-release-urls module
Repository: cordova-coho
Updated Branches:
refs/heads/master 1795102f5 -> 4a1a4f112
list-release-urls module
Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/4a1a4f11
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/4a1a4f11
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/4a1a4f11
Branch: refs/heads/master
Commit: 4a1a4f1124490f4ecce8177b222fadf3826b279d
Parents: 1795102
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Apr 24 11:43:48 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Apr 24 11:43:48 2014 -0400
----------------------------------------------------------------------
src/gitutil.js | 4 +++
src/list-release-urls.js | 57 +++++++++++++++++++++++++++++++++++++++++++
src/main.js | 40 ++----------------------------
3 files changed, 63 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/4a1a4f11/src/gitutil.js
----------------------------------------------------------------------
diff --git a/src/gitutil.js b/src/gitutil.js
index 9a528c7..3058905 100644
--- a/src/gitutil.js
+++ b/src/gitutil.js
@@ -24,3 +24,7 @@ exports.findMostRecentTag = function() {
return executil.execHelper(executil.ARGS('git describe --tags --abbrev=0 HEAD'), true);
}
+exports.tagExists = function*(tagName) {
+ return !!(yield executil.execHelper(executil.ARGS('git tag --list ' + tagName), true));
+}
+
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/4a1a4f11/src/list-release-urls.js
----------------------------------------------------------------------
diff --git a/src/list-release-urls.js b/src/list-release-urls.js
new file mode 100644
index 0000000..3aa7208
--- /dev/null
+++ b/src/list-release-urls.js
@@ -0,0 +1,57 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+var optimist = require('optimist');
+var executil = require('./executil');
+var flagutil = require('./flagutil');
+var gitutil = require('./gitutil');
+var repoutil = require('./repoutil');
+
+module.exports = function*(argv) {
+ var opt = flagutil.registerRepoFlag(optimist)
+ opt = opt
+ .options('version', {
+ desc: 'The version of the release. E.g. 2.7.1-rc2',
+ demand: true
+ })
+ opt = flagutil.registerHelpFlag(opt);
+ var argv = opt
+ .usage('.\n' +
+ 'Usage: $0 list-release-urls')
+ .argv;
+
+ if (argv.h) {
+ optimist.showHelp();
+ process.exit(1);
+ }
+ var repos = flagutil.computeReposFromFlag(argv.r);
+ var version = argv['version'];
+
+ var baseUrl = 'http://git-wip-us.apache.org/repos/asf?p=%s.git;a=shortlog;h=refs/tags/%s';
+ yield repoutil.forEachRepo(repos, function*(repo) {
+ if (!(yield gitutil.tagExists(version))) {
+ console.error('Tag "' + version + '" does not exist in repo ' + repo.repoName);
+ return;
+ }
+ var url = require('util').format(baseUrl, repo.repoName, version);
+ console.log(url);
+ yield executil.execHelper(executil.ARGS('git show-ref ' + version), 2, true);
+ });
+}
+
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/4a1a4f11/src/main.js
----------------------------------------------------------------------
diff --git a/src/main.js b/src/main.js
index aab09da..bcad09f 100644
--- a/src/main.js
+++ b/src/main.js
@@ -74,38 +74,6 @@ function createRepoUrl(repo) {
return 'https://git-wip-us.apache.org/repos/asf/' + repo.repoName + '.git';
}
-function *listReleaseUrls(argv) {
- var opt = flagutil.registerRepoFlag(optimist)
- opt = opt
- .options('version', {
- desc: 'The version of the release. E.g. 2.7.1-rc2',
- demand: true
- })
- opt = flagutil.registerHelpFlag(opt);
- var argv = opt
- .usage('.\n' +
- 'Usage: $0 list-release-urls')
- .argv;
-
- if (argv.h) {
- optimist.showHelp();
- process.exit(1);
- }
- var repos = flagutil.computeReposFromFlag(argv.r);
- var version = argv['version'];
-
- var baseUrl = 'http://git-wip-us.apache.org/repos/asf?p=%s.git;a=shortlog;h=refs/tags/%s';
- yield repoutil.forEachRepo(repos, function*(repo) {
- if (!(yield tagExists(version))) {
- console.error('Tag "' + version + '" does not exist in repo ' + repo.repoName);
- return;
- }
- var url = require('util').format(baseUrl, repo.repoName, version);
- console.log(url);
- yield executil.execHelper(executil.ARGS('git show-ref ' + version), 2, true);
- });
-}
-
function *localBranchExists(name) {
return !!(yield executil.execHelper(executil.ARGS('git branch --list ' + name), true));
}
@@ -136,10 +104,6 @@ function retrieveCurrentTagName() {
return executil.execHelper(executil.ARGS('git describe --tags HEAD'), true, true);
}
-function *tagExists(tagName) {
- return !!(yield executil.execHelper(executil.ARGS('git tag --list ' + tagName), true));
-}
-
function *listReposCommand(argv) {
console.log('Valid values for the --repo flag:');
console.log('');
@@ -716,7 +680,7 @@ function *tagReleaseBranchCommand(argv) {
// Create/update the tag.
var tagName = yield retrieveCurrentTagName();
if (tagName != version) {
- if (yield tagExists(version)) {
+ if (yield gitutil.tagExists(version)) {
yield execOrPretend(executil.ARGS('git tag ' + version + ' --force'));
} else {
yield execOrPretend(executil.ARGS('git tag ' + version));
@@ -801,7 +765,7 @@ function main() {
}, {
name: 'list-release-urls',
desc: 'List the apache git repo urls for release artifacts.',
- entryPoint: listReleaseUrls
+ entryPoint: require('./list-release-urls')
}
];
var commandMap = {};