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';
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,
}));
});
+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');
});
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) {
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',
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');
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
});
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,