diff options
author | Manolo Carrasco <manolo@apache.org> | 2015-09-17 20:39:12 +0200 |
---|---|---|
committer | Manolo Carrasco <manolo@apache.org> | 2015-09-17 21:18:23 +0200 |
commit | fe993897f3cd44d8f40d95be7b064d5c36d4eebb (patch) | |
tree | a254e508f69d2c64029b59b6cdecc33abda0fc37 /tasks | |
parent | ca9c00e809fd686c7cd533d982e6bd37e64cc7e6 (diff) | |
download | vaadin-core-fe993897f3cd44d8f40d95be7b064d5c36d4eebb.tar.gz vaadin-core-fe993897f3cd44d8f40d95be7b064d5c36d4eebb.zip |
Adding command to make a remote symlink
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/cdn.js | 35 | ||||
-rw-r--r-- | tasks/config.js | 6 | ||||
-rw-r--r-- | tasks/zip.js | 13 |
3 files changed, 37 insertions, 17 deletions
diff --git a/tasks/cdn.js b/tasks/cdn.js index 481a3c9..d81eef7 100644 --- a/tasks/cdn.js +++ b/tasks/cdn.js @@ -12,7 +12,9 @@ var args = require('yargs').argv; var git = require('gulp-git'); var stagingBasePath = config.paths.staging.cdn; -var version = args.release || args.preRelease || args.autoRevert ? config.version : config.snapshotVersion; +var version = config.version; +var host = config.cdnHost; +var permalink = config.permalink; var stagingPath = stagingBasePath + '/' + version; var testPath = process.cwd() + '/' + stagingPath + '/test'; @@ -36,16 +38,13 @@ gulp.task('cdn:stage-vaadin-components', function() { gulp.task('stage:cdn', [ 'clean:cdn', 'cdn:stage-bower_components', 'cdn:stage-vaadin-components' ]); -gulp.task('deploy:cdn', ['stage:cdn'], function() { +gulp.task('upload:cdn', ['stage:cdn'], function() { common.checkArguments(['cdnUsername', 'cdnDestination']); - var hostName = args.cdnHostname || 'cdn.vaadin.com'; - - gutil.log('Uploading to cdn (rsync): ' + stagingPath + ' -> '+ args.cdnUsername + '@' + hostName + ':' + args.cdnDestination + version); - + gutil.log('Uploading to cdn (rsync): ' + stagingPath + ' -> '+ args.cdnUsername + '@' + host + ':' + args.cdnDestination + version); return gulp.src(stagingPath) .pipe(rsync({ username: args.cdnUsername, - hostname: hostName, + hostname: host, root: stagingPath, emptyDirectories: false, recursive: true, @@ -55,6 +54,26 @@ gulp.task('deploy:cdn', ['stage:cdn'], function() { })); }); +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(); + }); + } else { + done(); + } +}); + gulp.task('cdn-test:clean', function() { fs.removeSync(stagingPath + '/test'); }); @@ -100,7 +119,7 @@ gulp.task('verify:cdn', ['cdn-test:stage'], function(done) { gutil.log('Deleting folder ' + args.cdnDestination + version); require('node-ssh-exec')({ - host: 'cdn.vaadin.com', + host: host, username: args.cdnUsername, privateKey: config.paths.privateKey() }, 'rm -rf ' + args.cdnDestination + version, function (error, response) { diff --git a/tasks/config.js b/tasks/config.js index 248a927..dc48921 100644 --- a/tasks/config.js +++ b/tasks/config.js @@ -5,8 +5,10 @@ var userhome = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFI module.exports = { components: ['vaadin-grid'], - snapshotVersion: 'master', - version: args.version || this.snapshotVersion, + version: args.version || 'master', + permalink: args.version ? 'latest' : '', + cdnHost: args.cdnHostname || 'cdn.vaadin.com', + zipHost: args.zipHostname || 'vaadin.com', paths: { staging: { bower: 'target/bower', diff --git a/tasks/zip.js b/tasks/zip.js index fc0f854..f649d98 100644 --- a/tasks/zip.js +++ b/tasks/zip.js @@ -12,7 +12,8 @@ var unzip = require('gulp-unzip'); var zip = require('gulp-zip'); var stagingPath = config.paths.staging.zip; -var version = args.release || args.preRelease ? config.version : config.snapshotVersion; +var version = config.version; +var host = config.zipHost; var filename = 'vaadin-components-' + version + '.zip'; var majorMinorVersion = version.replace(/(\d+\.\d+)(\.|-)(.*)/, '$1'); @@ -29,13 +30,12 @@ gulp.task('stage:zip', ['clean:zip', 'stage:cdn'], function() { gulp.task('zip:upload', ['stage:zip'], function(done) { common.checkArguments(['zipUsername', 'zipDestination']); - var hostName = args.zipHostname || 'vaadin.com'; var path = args.zipDestination + majorMinorVersion + '/' + version + '/' + filename; - gutil.log('Uploading zip package (scp): ' + stagingPath + '/' + filename + ' -> ' + args.zipUsername + '@' + hostName + ':' + path); + gutil.log('Uploading zip package (scp): ' + stagingPath + '/' + filename + ' -> ' + args.zipUsername + '@' + host + ':' + path); require('scp2').scp(stagingPath + '/' + filename, { - host: hostName, + host: host, username: args.zipUsername, privateKey: config.paths.privateKey(), path: path @@ -45,11 +45,10 @@ gulp.task('zip:upload', ['stage:zip'], function(done) { }); function ssh(command, done) { - var hostName = args.sshHostname || 'vaadin.com'; - gutil.log('SSH: ' + hostName + ' -> ' + command); + gutil.log('SSH: ' + host + ' -> ' + command); require('node-ssh-exec')({ - host: hostName, + host: host, username: args.zipUsername, privateKey: config.paths.privateKey() }, command, |