summaryrefslogtreecommitdiffstats
path: root/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'tasks')
-rw-r--r--tasks/cdn.js12
-rw-r--r--tasks/common.js11
-rw-r--r--tasks/zip.js53
3 files changed, 36 insertions, 40 deletions
diff --git a/tasks/cdn.js b/tasks/cdn.js
index 80771c8..9ff994a 100644
--- a/tasks/cdn.js
+++ b/tasks/cdn.js
@@ -69,17 +69,7 @@ gulp.task('deploy:cdn', ['upload:cdn'], function(done) {
if (permalink) {
var cmd = 'rm -f ' + args.cdnDestination + permalink + '; ln -s ' + version + ' ' + args.cdnDestination + permalink + '; ls -l ' + args.cdnDestination;
gutil.log('Deploying CDN : ssh ' + args.cdnUsername + '@' + host + ' ' + cmd);
- require('node-ssh-exec')({
- host: host,
- username: args.cdnUsername,
- privateKey: config.paths.privateKey()
- }, cmd, function (error, response) {
- if (error) {
- throw error;
- }
- gutil.log(response);
- done();
- });
+ common.ssh(args.cdnUsername, host, cmd, done);
} else {
done();
}
diff --git a/tasks/common.js b/tasks/common.js
index d4ba658..316d245 100644
--- a/tasks/common.js
+++ b/tasks/common.js
@@ -3,6 +3,7 @@ var chalk = require('chalk');
var wct = require('web-component-tester').test;
var _ = require('lodash');
var gutil = require('gulp-util');
+var config = require('./config');
function cleanDone(done) {
return function(error) {
@@ -40,9 +41,19 @@ function test(options, done) {
wct(options, cleanDone(done));
}
+function ssh(user, host, command, done) {
+ gutil.log('SSH: ' + host + ' -> ' + command);
+ require('node-ssh-exec')({
+ host: host,
+ username: user,
+ privateKey: config.paths.privateKey()
+ }, command, done);
+}
+
module.exports = {
localAddress: localAddress,
test: test,
+ ssh: ssh,
checkArguments: checkArguments,
testSauce: function(suites, browsers, build, done) {
diff --git a/tasks/zip.js b/tasks/zip.js
index d3e6945..2900275 100644
--- a/tasks/zip.js
+++ b/tasks/zip.js
@@ -14,10 +14,10 @@ var zip = require('gulp-zip');
var stagingPath = config.paths.staging.zip;
var version = config.version;
var host = config.zipHost;
+var user = args.zipUsername;
var filename = 'vaadin-elements-' + version + '.zip';
var majorMinorVersion = version.replace(/(\d+\.\d+)(\.|-)(.*)/, '$1');
-
gulp.task('clean:zip', function() {
fs.removeSync(stagingPath);
});
@@ -28,44 +28,40 @@ gulp.task('stage:zip', ['clean:zip', 'stage:cdn'], function() {
.pipe(gulp.dest(stagingPath));
});
-gulp.task('zip:upload', ['stage:zip'], function(done) {
+function computeDestination() {
common.checkArguments(['zipUsername', 'zipDestination']);
- var path = args.zipDestination + majorMinorVersion + '/' + version + '/' + filename;
-
- gutil.log('Uploading zip package (scp): ' + stagingPath + '/' + filename + ' -> ' + args.zipUsername + '@' + host + ':' + path);
+ var path = majorMinorVersion != version ? majorMinorVersion + '/' + version : version;
+ path = args.zipDestination + path + '/' + filename;
+ return path;
+}
- require('scp2').scp(stagingPath + '/' + filename, {
+gulp.task('zip:upload', ['stage:zip'], function(done) {
+ done();
+ return;
+ var src = stagingPath + '/' + filename;
+ var dst = computeDestination();
+ gutil.log('Uploading zip package (scp): ' + src + ' -> ' + user + '@' + host + ':' + dst);
+ require('scp2').scp(src, {
host: host,
- username: args.zipUsername,
+ username: user,
privateKey: config.paths.privateKey(),
- path: path
+ path: dst
}, function(err) {
done(err);
})
});
-function ssh(command, done) {
- gutil.log('SSH: ' + host + ' -> ' + command);
-
- require('node-ssh-exec')({
- host: host,
- username: args.zipUsername,
- privateKey: config.paths.privateKey()
- }, command,
- function (err) {
- done(err);
- });
-}
-
gulp.task('zip:update-references', ['zip:upload'], function(done) {
- common.checkArguments(['zipUsername', 'zipDestination']);
-
+ var dst = computeDestination();
+ var latest = '/var/www/vaadin/download/elements/latest/vaadin-elements-latest.zip';
+ var cmd = 'rm -f ' + latest + '; ln -s ' + dst + ' ' + latest;
+ common.ssh(user, host, cmd);
if(args.release) {
- ssh("sed -i '1i elements/" + majorMinorVersion + '/' + version + "' " + args.zipDestination + 'VERSIONS', done);
+ common.ssh(user, host, "sed -i '1i elements/" + majorMinorVersion + '/' + version + "' " + args.zipDestination + 'VERSIONS', done);
} else if(args.preRelease) {
- ssh("sed -i '1i elements/" + majorMinorVersion + '/' + version + "' " + args.zipDestination + 'PRERELEASES', done);
+ common.ssh(user, host, "sed -i '1i elements/" + majorMinorVersion + '/' + version + "' " + args.zipDestination + 'PRERELEASES', done);
} else {
- ssh('echo elements/' + majorMinorVersion + '/' + version + ' > ' + args.zipDestination + 'SNAPSHOT', done);
+ common.ssh(user, host, 'echo elements/' + majorMinorVersion + '/' + version + ' > ' + args.zipDestination + 'SNAPSHOT', done);
}
});
@@ -127,12 +123,11 @@ gulp.task('verify:zip', ['zip-test:unzip', 'zip-test:install-wct', 'zip-test:sta
gutil.log('Deleting package ' + path);
// remove the version from VERSIONS
- ssh('grep -v "elements/' + majorMinorVersion + '/' + version + '" ' +
+ common.ssh(user, host, 'grep -v "elements/' + majorMinorVersion + '/' + version + '" ' +
args.zipDestination + 'VERSIONS > temp && mv temp ' + args.zipDestination + 'VERSIONS', function(error) {
if(error) done(error);
-
// remove the package
- ssh('rm -rf ' + path, done);
+ common.ssh(user, host, 'rm -rf ' + path, done);
});
}, done);
});