summaryrefslogtreecommitdiffstats
path: root/debian/missing-sources/epoch/gulpfile.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:26:01 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:26:01 +0000
commitef03469fec14f1f0358b690934fc173d744f4e7d (patch)
tree8be439d7b2f1d7c8283b745919b9e66481a950e7 /debian/missing-sources/epoch/gulpfile.js
parentAdding upstream version 5.6.0. (diff)
downloadknot-resolver-debian/5.6.0-1.tar.xz
knot-resolver-debian/5.6.0-1.zip
Adding debian version 5.6.0-1.debian/5.6.0-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/missing-sources/epoch/gulpfile.js')
-rw-r--r--debian/missing-sources/epoch/gulpfile.js108
1 files changed, 108 insertions, 0 deletions
diff --git a/debian/missing-sources/epoch/gulpfile.js b/debian/missing-sources/epoch/gulpfile.js
new file mode 100644
index 0000000..4f3b975
--- /dev/null
+++ b/debian/missing-sources/epoch/gulpfile.js
@@ -0,0 +1,108 @@
+'use strict';
+
+require('coffee-script/register'); // For coffee-script mocha unit tests
+
+var gulp = require('gulp');
+var coffee = require('gulp-coffee');
+var concat = require('gulp-concat');
+var mocha = require('gulp-mocha');
+var order = require('gulp-order');
+var rename = require('gulp-rename');
+var sass = require('gulp-sass');
+var uglify = require('gulp-uglify');
+var gutil = require('gulp-util');
+var del = require('del');
+var exec = require('child_process').exec;
+
+/**
+ * Common directories used by tasks below.
+ * @type {object}
+ */
+var path = {
+ source: {
+ coffee: 'src/',
+ sass: 'sass/'
+ },
+ dist: {
+ js: 'dist/js/',
+ css: 'dist/css/'
+ },
+ test: {
+ unit: 'tests/unit/'
+ },
+ doc: 'doc/'
+};
+
+/**
+ * The default task simply calls the master 'build' task.
+ */
+gulp.task('default', ['build']);
+
+/**
+ * Builds the distribution files by packaging the compiled javascript source
+ * into the `dist/js/` directory and building the css into the `dist/css`
+ * directory
+ */
+gulp.task('build', ['sass', 'sass-minify'], function () {
+ gulp.src(path.source.coffee + '**/*.coffee')
+ .pipe(coffee({bare: true}).on('error', gutil.log))
+ .pipe(order([
+ 'epoch.js',
+ 'core/context.js',
+ 'core/util.js',
+ 'core/d3.js',
+ 'core/format.js',
+ 'core/chart.js',
+ 'core/css.js',
+ 'data.js',
+ 'model.js',
+ 'basic.js',
+ 'basic/*.js',
+ 'time.js',
+ 'time/*.js',
+ 'adapters.js',
+ 'adapters/*.js'
+ ]))
+ .pipe(concat('epoch.js'))
+ .pipe(gulp.dest(path.dist.js))
+ .pipe(uglify().on('error', gutil.log))
+ .pipe(rename('epoch.min.js'))
+ .pipe(gulp.dest(path.dist.js));
+});
+
+/**
+ * Generates epoch CSS from Sass source.
+ */
+gulp.task('sass', function () {
+ gulp.src(path.source.sass + 'epoch.scss')
+ .pipe(sass({ outputStyle: 'compact' }))
+ .pipe(rename('epoch.css'))
+ .pipe(gulp.dest(path.dist.css));
+});
+
+/**
+ * Generates the minified version of the epoch css from sass source.
+ */
+gulp.task('sass-minify', function () {
+ gulp.src(path.source.sass + 'epoch.scss')
+ .pipe(sass({ outputStyle: 'compressed' }))
+ .pipe(rename('epoch.min.css'))
+ .pipe(gulp.dest(path.dist.css));
+});
+
+/**
+ * Watch script for recompiling JavaScript and CSS
+ */
+gulp.task('watch', function () {
+ gulp.watch(path.source.coffee + '**/*.coffee', ['build']);
+ gulp.watch(path.source.sass + '**/*.scss', ['sass', 'sass-minify']);
+});
+
+/**
+ * Cleans all build and distribution files.
+ */
+gulp.task('clean', function (cb) {
+ del([ path.dist.js, path.dist.css]).then(function () {
+ cb();
+ });
+});