cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject cordova-coho git commit: added an svnutil module. plugins releaser now interacts with svn!
Date Mon, 13 Feb 2017 20:42:53 GMT
Repository: cordova-coho
Updated Branches:
  refs/heads/plugins-releaser c63442e3b -> cfe9853e5


added an svnutil module. plugins releaser now interacts with svn!


Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/cfe9853e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/cfe9853e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/cfe9853e

Branch: refs/heads/plugins-releaser
Commit: cfe9853e5c31789093b34d4861c4a940d2966b51
Parents: c63442e
Author: filmaj <maj.fil@gmail.com>
Authored: Mon Feb 13 12:42:46 2017 -0800
Committer: filmaj <maj.fil@gmail.com>
Committed: Mon Feb 13 12:42:46 2017 -0800

----------------------------------------------------------------------
 src/plugin-release.js | 81 +++++++++++++++++++++++++++++-----------------
 src/svnutil.js        | 33 +++++++++++++++++++
 2 files changed, 84 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/cfe9853e/src/plugin-release.js
----------------------------------------------------------------------
diff --git a/src/plugin-release.js b/src/plugin-release.js
index 45869c3..e131073 100644
--- a/src/plugin-release.js
+++ b/src/plugin-release.js
@@ -30,6 +30,7 @@ var create_archive = require('./create-verify-archive');
 var executil = require('./executil');
 var flagutil = require('./flagutil');
 var gitutil = require('./gitutil');
+var svnutil = require('./svnutil');
 var repoutil = require('./repoutil');
 var versionutil = require('./versionutil');
 var repoupdate = require('./repo-update');
@@ -60,16 +61,23 @@ var svn_repos; // cordova dist and dist/dev svn repos
 var plugin_data = {}; // massive object containing plugin release-relevant information
 var plugins_to_release = []; // array of plugin names that need releasing
 var plugins_ommitted = []; // array of plugin names that DO NOT need releasing
+var svn_user; // username for apache svn
+var svn_password; // password for apache svn
 
 function *interactive_plugins_release() {
     console.log('Hi! So you want to do a plugins release, do you?');
-    // run a shelljs.which(gpg) to make sure RM has gpg on their path
+    // sanity check for tooling that will be needed during releaser.
     if (!shelljs.which('gpg')) {
         console.warn("You'll need gpg installed and have your Apache GPG keys all set up
to do a plugins release!");
         console.error('I did not find gpg on your PATH!');
         console.error('Refer to ' + create_archive.GPG_DOCS + ' for instructions on how to
get that set up as a first step.');
         process.exit(1);
     }
+    if (!shelljs.which('svn')) {
+        console.warn("You'll need svn installed to do a plugins release!");
+        console.error('I did not find `svn` on your PATH!');
+        process.exit(1);
+    }
     console.log('Let\'s start with your JIRA credentials - this system will be interacting
with Apache\'s JIRA instance (issues.apache.org) often.');
     inquirer.prompt([{
         type: 'input',
@@ -558,6 +566,16 @@ function *interactive_plugins_release() {
             })();
         }).then(function() {
             // 13. Publish to apache svn:
+            // - first update dist-dev repo
+            return co.wrap(function *() {
+                var orig_dir = process.cwd();
+                var dist_dev_repo = path.join(plugin_base, dist_dev_svn.repoName);
+                process.chdir(dist_dev_repo);
+                console.log('Updating dist-dev svn repo...');
+                yield svnutil.update();
+                process.chdir(orig_dir);
+            })();
+        }).then(function() {
             //   - create-archive -r $ACTIVE --dest cordova-dist-dev/$JIRA
             return co.wrap(function *() {
                 // location to store the archives in.
@@ -572,17 +590,44 @@ function *interactive_plugins_release() {
                     yield create_archive.verifyArchive(archive);
                 });
             })();
-            //   - upload by running `svn` commands.
+        }).then(function() {
+            console.log('We are about to push changes up to Apache SVN! Let me get your SVN
credentials.');
+            return inquirer.prompt([{
+                type: 'input',
+                name: 'username',
+                message: 'Please enter your svn username'
+            },{
+                type: 'password',
+                name: 'password',
+                message: 'Please enter your svn password'
+            }]);
+        }).then(function(answers) {
+            svn_user = answers.username;
+            svn_password = answers.password;
+            //   - upload by running `svn` add and commit commands.
+            return co.wrap(function *() {
+                var orig_dir = process.cwd();
+                var dist_dev_repo = path.join(plugin_base, dist_dev_svn.repoName);
+                process.chdir(dist_dev_repo);
+                // svn add the CB-xxxxx issue key for the plugins release, which is a directory,
to the svn repo
+                yield svnutil.add(plugins_release_issue.key);
+                yield svnutil.commit(svn_user, svn_password, plugins_release_issue.key +
' Uploading release candidates for plugins release');
+                process.chdir(orig_dir);
+            })();
+        }).then(function() {
+            console.log('Nicely done! Last two things you should do:');
+            /* 14. Dump instructions only? Prepare blog post - perhaps can dump out release
notes-based blog content.
+             *   - TODO: this apparently ends up as a .md file in cordova-docs. perhaps can
dump this as a shell of a file into the cordova-docs repo? maybe even auto-branch the docs
repo in prep for a PR?*/
+            console.log('1. Prepare a blog post: https://github.com/apache/cordova-coho/blob/master/docs/plugins-release-process.md#prepare-blog-post');
+            console.log('2. Start a vote thread! https://github.com/apache/cordova-coho/blob/master/docs/plugins-release-process.md#start-vote-thread');
+            process.exit(0);
         });
     }, function(auth_err) {
         var keys = Object.keys(auth_err);
         console.error('ERROR! There was a problem connecting to JIRA, received a', auth_err.statusCode,
'status code.');
         process.exit(1);
     });
-    /* 14. Dump instructions only? Prepare blog post - perhaps can dump out release notes-based
blog content.
-     *   - this apparently ends up as a .md file in cordova-docs. perhaps can dump this as
a shell of a file into the cordova-docs repo? maybe even auto-branch the docs repo in prep
for a PR?
-     * 15. Dump instructions only? Start a vote thread.
-     * 16. Bonus: separate script to 'approve' a plugins release, which would:
+     /* 16. Bonus: separate script to 'approve' a plugins release, which would:
      *   - publish the artifacts to dist/ in apache
      *   - "tell apache about the release" which has a TODO to write a helper to POST the
request appropriately.
      *   - publish to npm
@@ -597,30 +642,6 @@ function *interactive_plugins_release() {
      */
 }
 module.exports.interactive = interactive_plugins_release;
-// TODO: what is shared between plugin-release and platform-release helpers? factor out into
util/lib/whatever helper modules
-
-/*
-function createPlatformDevVersion(version) {
-    // e.g. "3.1.0" -> "3.2.0-dev".
-    // e.g. "3.1.2-0.8.0-rc2" -> "3.2.0-0.8.0-dev".
-    version = version.replace(/-rc.*$/, '');
-    var parts = version.split('.');
-    parts[1] = String(+parts[1] + 1);
-    var cliSafeParts = parts[2].split('-');
-    cliSafeParts[0] = '0';
-    parts[2] = cliSafeParts.join('-');
-    return parts.join('.') + '-dev';
-}
-
-function cpAndLog(src, dest) {
-    print('Coping File:', src, '->', dest);
-    // Throws upon failure.
-    shelljs.cp('-f', src, dest);
-    if (shelljs.error()) {
-        apputil.fatal('Copy failed.');
-    }
-}
-*/
 
 /*
  * A function that handles version if it is defined or undefined

http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/cfe9853e/src/svnutil.js
----------------------------------------------------------------------
diff --git a/src/svnutil.js b/src/svnutil.js
new file mode 100644
index 0000000..0e2a3e2
--- /dev/null
+++ b/src/svnutil.js
@@ -0,0 +1,33 @@
+/*
+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 path = require('path');
+var executil = require('./executil');
+
+exports.update = function*() {
+    yield executil.execHelper(executil.ARGS('svn update'), false, false);
+}
+
+exports.add = function*(location) {
+    yield executil.execHelper(executil.ARGS('svn add ' + location), false, false);
+}
+
+exports.commit = function*(username, password, msg) {
+    yield executil.execHelper(executil.ARGS('svn commit --username ' + username + ' --password
' + password + ' -m ' + msg), true, false);
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message