]> source.dussan.org Git - vaadin-core.git/commitdiff
Remove gulp tasks
authorManolo Carrasco <manolo@apache.org>
Mon, 30 Oct 2017 08:53:15 +0000 (09:53 +0100)
committerArtur <artur@vaadin.com>
Mon, 30 Oct 2017 09:12:42 +0000 (11:12 +0200)
gulpfile.js [deleted file]
package.json
tasks/cdn.js [deleted file]
tasks/common.js [deleted file]
tasks/config.js [deleted file]
tasks/docsite.js [deleted file]
tasks/zip.js [deleted file]

diff --git a/gulpfile.js b/gulpfile.js
deleted file mode 100644 (file)
index 9a87eff..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-"use strict";
-var gulp = require('gulp');
-require('require-dir')('./tasks');
-var args = require('yargs').argv;
-
-gulp.task('default', function() {
-  console.log('\n  Use:\n gulp <stage|deploy[:cdn]>|<zip>\n');
-});
-
-gulp.task('clean', ['clean:cdn', 'clean:zip']);
-
-gulp.task('deploy', ['deploy:cdn']);
\ No newline at end of file
index 9c98c325d381a88ec661f4610c327e7a667befb9..f76fd22ea2e51a34c5abe64b705e0ce74f9fc6ad 100644 (file)
@@ -5,31 +5,9 @@
   "author": "Vaadin Ltd",
   "license": "Apache-2.0",
   "dependencies": {
-    "bower": "latest",
-    "fs-extra": "2.0.x",
-    "gulp": "^3.9.1",
-    "gulp-add-src": "latest",
-    "gulp-git": "1.14.x",
-    "gulp-json-editor": "latest",
-    "gulp-markdown": "^1.0.0",
-    "gulp-modify": "^0.1.1",
-    "gulp-rename": "^1.2.2",
-    "gulp-replace": "latest",
-    "gulp-util": "latest",
-    "yargs": "latest"
-  },
-  "devDependencies": {
-    "chalk": "latest",
-    "gulp-bower": "0.0.10",
-    "gulp-insert": "latest",
-    "gulp-rsync": "0.0.5",
-    "gulp-unzip": "^0.1.3",
-    "gulp-zip": "^2.0.3",
-    "lodash": "^3.5.0",
-    "node-ssh-exec": "^0.1.1",
-    "require-dir": "^0.1.0",
-    "scp2": "^0.2.1"
+    "bower": "latest"
   },
+  "devDependencies": {},
   "keywords": [
     "vaadin",
     "core",
diff --git a/tasks/cdn.js b/tasks/cdn.js
deleted file mode 100644 (file)
index 237a6a2..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-var bower = require('gulp-bower');
-var config = require('./config');
-var common = require('./common');
-var gulp = require('gulp');
-var fs = require('fs-extra');
-var path = require('path');
-var modify = require('gulp-modify');
-var rsync = require('gulp-rsync');
-var gutil = require('gulp-util');
-var args = require('yargs').argv;
-var git = require('gulp-git');
-
-var stagingBasePath = config.paths.staging.cdn;
-var version = config.version;
-var host = config.toolsHost;
-var permalink = config.permalink;
-var stagingPath = path.join(process.cwd(), stagingBasePath, version);
-
-gulp.task('clean:cdn', function() {
-  fs.removeSync(stagingBasePath);
-});
-
-gulp.task('cdn:stage-bower.json', ['clean:cdn'], function() {
-  // Load the bower.json, assign overrides and write back to disk.
-  var bowerJson = JSON.parse(fs.readFileSync('./bower.json', 'utf-8'));
-
-  if (version === 'master') {
-    gutil.log('Applying overrides to ' + stagingPath + '/bower.json');
-
-    // Assign the override properties.
-    Object.keys(bowerJson.masterOverrides).forEach(function(override) {
-      bowerJson[override] = bowerJson.masterOverrides[override];
-    });
-    delete bowerJson.masterOverrides;
-  }
-
-  fs.mkdirsSync(stagingBasePath);
-  fs.mkdirsSync(stagingPath);
-  fs.writeFileSync(stagingPath + '/bower.json', JSON.stringify(bowerJson, null, '  '));
-});
-
-gulp.task('cdn:stage-bower_components', ['cdn:stage-bower.json'], function() {
-  return bower({
-    directory: '.',
-    cwd: stagingPath,
-    forceLatest: true,
-    cmd: 'install'
-  });
-});
-
-gulp.task('cdn:stage-vaadin-core-elements', function() {
-  return gulp.src(['LICENSE.html', 'README.md', 'index.html', 'vaadin-core-elements.html', 'demo/*', 'apidoc/*'], {
-      base: "."
-    })
-    .pipe(modify({
-      fileModifier: function(file, contents) {
-        if (/README.md/.test(file.path)) {
-          contents = contents.replace(/\/latest\//mg, '/' + version + '/');
-        } else {
-          contents.replace('https://cdn.vaadin.com/vaadin-core-elements/latest/', '../../');
-        }
-        return contents;
-      }
-    }))
-    .pipe(gulp.dest(stagingPath + '/vaadin-core-elements'));
-});
-
-gulp.task('stage:cdn', ['clean:cdn', 'cdn:stage-bower_components', 'cdn:stage-vaadin-core-elements']);
-
-gulp.task('upload:cdn', ['stage:cdn'], function() {
-  common.checkArguments(['cdnUsername', 'cdnDestination']);
-  gutil.log('Uploading to cdn (rsync): ' + stagingPath + ' -> ' + args.cdnUsername + '@' + host + ':' + args.cdnDestination + version);
-  return gulp.src(stagingPath)
-    .pipe(rsync({
-      username: args.cdnUsername,
-      hostname: host,
-      root: stagingPath,
-      emptyDirectories: false,
-      recursive: true,
-      clean: true,
-      silent: true,
-      destination: args.cdnDestination + version
-    }));
-});
-
-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);
-    common.ssh(args.cdnUsername, host, cmd, done);
-  } else {
-    done();
-  }
-});
-
-/* Above are the old tasks to publish the vaadin-core-elements package, below the tasks to publish a single element from a specific tag/branch. Sorry about the poor naming :-) */
-
-gulp.task('cdn:arguments', function(done) {
-  common.checkArguments(['element', 'tag']);
-  args.folder = args.tag.replace(/^v/g, '');
-  stagingPath = path.join(process.cwd(), stagingBasePath, args.element, args.folder);
-  done();
-});
-
-gulp.task('cdn:clone', ['clean:cdn', 'cdn:arguments'], function(done) {
-  git.clone('https://github.com/vaadin/' + args.element, {args: '-b ' + args.tag + ' ./target/cdn/' + args.element + '/' + args.folder }, function (err) {
-    if (err) throw err;
-    done();
-  });
-});
-
-gulp.task('cdn:install', ['cdn:arguments', 'cdn:clone'], function() {
-  return bower({
-    cwd: stagingPath,
-    forceLatest: true,
-    cmd: 'install'
-  });
-});
-
-gulp.task('cdn:stage', ['cdn:arguments', 'cdn:install'], function() {
-  return gulp.src([stagingPath + '/**/*.html',  '!**/bower_components/**'])
-    .pipe(modify({
-      fileModifier: function(file, contents) {
-        // magic regex trying to change import paths from:
-        // ../foo/foo.html to bower_components/foo/foo.html
-        // ../../foo/foo.html to ../bower_components/foo/foo.html
-        // ../my-element.html stays as it is.
-        contents = contents.replace(new RegExp(/([href|src].+)((\.\.\/)((?!bower_components|\.\.).+\/.+))/g), '$1bower_components/$4');
-        return contents;
-      }
-    }))
-    .pipe(gulp.dest(stagingPath));
-});
-
-gulp.task('cdn:upload', ['cdn:stage'], function() {
-  common.checkArguments(['cdnUsername', 'cdnDestination']);
-  var destination = path.join(args.cdnDestination, args.element, args.folder);
-  gutil.log('Uploading to cdn (rsync): ' + stagingPath + ' -> ' + args.cdnUsername + '@' + host + ':' + destination);
-  return gulp.src(stagingPath)
-    .pipe(rsync({
-      username: args.cdnUsername,
-      hostname: host,
-      root: stagingPath,
-      emptyDirectories: false,
-      recursive: true,
-      clean: true,
-      silent: true,
-      destination: destination
-    }));
-});
diff --git a/tasks/common.js b/tasks/common.js
deleted file mode 100644 (file)
index dd22520..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-var args = require('yargs').argv;
-var _ = require('lodash');
-var gutil = require('gulp-util');
-var config = require('./config');
-
-function checkArguments(arguments) {
-  _.forEach(arguments, function(a) {
-    if(!args.hasOwnProperty(a)) {
-      throw Error('Required argument \'--'+ a +'\' is missing.');
-    }
-  });
-}
-
-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 = {
-  ssh: ssh,
-  checkArguments: checkArguments
-};
diff --git a/tasks/config.js b/tasks/config.js
deleted file mode 100644 (file)
index 521a8ce..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-var args = require('yargs').argv;
-var fs = require('fs');
-
-var userhome = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
-
-module.exports = {
-  version: args.version || 'master',
-  permalink: args.version ? 'latest' : '',
-  toolsHost: args.toolsHostname || 'tools.vaadin.com',
-  paths: {
-    staging: {
-      bower: 'target/bower',
-      cdn: 'target/cdn',
-      zip: 'target/zip',
-      doc: 'target/docsite'
-    },
-    userhome: userhome,
-    privateKey: function() {
-      try {
-        return fs.readFileSync(userhome + '/.ssh/id_rsa');
-      } catch(error) {
-        return fs.readFileSync(userhome + '/.ssh/id_dsa');
-      }
-    }
-  }
-};
diff --git a/tasks/docsite.js b/tasks/docsite.js
deleted file mode 100644 (file)
index 46ecf68..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-var bower =  require('gulp-bower');
-var config = require('./config');
-var common = require('./common');
-var gulp = require('gulp');
-var fs = require('fs-extra');
-var replace = require('gulp-replace');
-var gutil = require('gulp-util');
-var zip = require('gulp-zip');
-var args = require('yargs').argv;
-var addsrc = require('gulp-add-src');
-var rename = require('gulp-rename');
-
-var stagingBasePath = config.paths.staging.cdn;
-var docPath = config.paths.staging.doc;
-var version = config.version;
-var host = config.toolsHost;
-var permalink = config.permalink;
-var stagingPath = stagingBasePath + '/' + version;
-var modify = require('gulp-modify');
-var rootZip = 'target/';
-var fileZip = 'docsite.zip';
-
-gulp.task('cdn:docsite:clean', function() {
-  fs.removeSync(docPath);
-  fs.removeSync(rootZip + fileZip);
-});
-
-gulp.task('cdn:docsite:bower_components', ['cdn:stage-bower_components'], function() {
-  gutil.log('Copying bower components from ' + stagingPath + ' to ' + docPath + '/bower_components');
-  return gulp.src([stagingPath + '/**'])
-    // Temporary patch until #180 is fixed:
-    // https://github.com/webcomponents/webcomponentsjs/issues/180
-    .pipe(modify({
-      fileModifier: function(file, contents) {
-        if (/webcomponents-lite.*js/.test(file.path)) {
-          contents = contents.replace(/(if ?\()(\w+\.log)(\))/mg, '$1$2 && $2.split$3');
-        }
-        return contents;
-      }
-    }))
-    .pipe(gulp.dest(docPath + '/bower_components'));
-});
-
-gulp.task('cdn:docsite:core-elements', function() {
-  return gulp.src(['docs/**']).pipe(gulp.dest(docPath));
-});
-
-
-gulp.task('cdn:docsite:core-elements-elements', ['cdn:docsite:bower_components'], function() {
-  var bowerJson = require('../' + stagingPath + '/bower.json');
-  var docsPaths = Object.keys(bowerJson.dependencies).map(function(c) {
-    return stagingPath + '/' + c + '/docs/**';
-  });
-
-  return gulp.src(docsPaths, {base: stagingPath})
-      .pipe(rename(function (path) {
-        path.dirname = path.dirname.replace('/docs', '/'); //leaves docs folders empty.
-      }))
-      .pipe(gulp.dest(docPath + '/'));
-});
-
-gulp.task('cdn:docsite:stage', ['cdn:docsite:core-elements',
-                                'cdn:docsite:core-elements-elements']);
-
-gulp.task('cdn:docsite:zip', ['cdn:docsite:stage'], function() {
-  var src = docPath + '/**/*';
-  gutil.log("Creating docsite zip " + docPath + " -> " + rootZip +  fileZip);
-  return gulp.src(src)
-    .pipe(zip(fileZip))
-    .pipe(gulp.dest(rootZip));
-});
-
-gulp.task('cdn:docsite:upload', ['cdn:docsite:clean', 'cdn:docsite:zip'], function(done) {
-  common.checkArguments(['cdnUsername', 'cdnDestination']);
-
-  gutil.log('Uploading docsite (scp): ' + rootZip + fileZip + ' -> ' + args.cdnUsername + '@' + host + ':' + args.cdnDestination + version);
-
-  require('scp2').scp(rootZip + fileZip, {
-    host: host,
-    username: args.cdnUsername,
-    privateKey: config.paths.privateKey(),
-    path: args.cdnDestination + version
-  }, function(err) {
-    done(err);
-  });
-});
-
-gulp.task('cdn:docsite', ['cdn:docsite:upload']);
diff --git a/tasks/zip.js b/tasks/zip.js
deleted file mode 100644 (file)
index cc469eb..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-var config = require('./config');
-var fs = require('fs-extra');
-var gulp = require('gulp');
-var zip = require('gulp-zip');
-
-var stagingPath = config.paths.staging.zip;
-var version = config.version;
-var filename = 'vaadin-core-elements-' + version + '.zip';
-var majorMinorVersion = version.replace(/(\d+\.\d+)(\.|-)(.*)/, '$1');
-
-gulp.task('clean:zip', function() {
-  fs.removeSync(stagingPath);
-});
-
-gulp.task('zip', ['clean:zip', 'stage:cdn'], function() {
-  return gulp.src(config.paths.staging.cdn + '/' + version + '/**/*')
-    .pipe(zip(filename))
-    .pipe(gulp.dest(stagingPath));
-});