From 3e5294e93c2f9f5d0a6856e384b72a09a233f541 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 8 Aug 2016 10:34:17 +0000 Subject: [PATCH] Get gulp file working for now, even if it's not exactly the best way possible to say the least. --- gulpfile.js | 32 +++++++++++++++++++------------- package.json | 2 +- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 483b394..f2db56e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,37 +1,43 @@ const gulp = require('gulp'); -const zip = require('gulp-zip'); +//const zip = require('gulp-zip'); const release = require('gulp-github-release'); const fs = require('fs'); const replace = require('gulp-replace'); -const git = require('gulp-git'); +const run = require('gulp-run'); var package_json = JSON.parse(fs.readFileSync('./package.json')); var release_filename = package_json.name + '-v' + package_json.version + '.kpz'; var pm_file = 'CoverFlow.pm'; -var pm_file_path = './Koha/Plugin/Com/ByWaterSolutions/'; +var pm_file_path = 'Koha/Plugin/Com/ByWaterSolutions/'; var pm_file_path_full = pm_file_path + pm_file; +var pm_file_path_dist = 'dist/' + pm_file_path; +var pm_file_path_full_dist = pm_file_path_dist + pm_file; console.log(release_filename); +console.log(pm_file_path_full_dist); gulp.task('build', () => { - // Set module version - gulp.src(pm_file_path_full) - .pipe(replace('{VERSION}', package_json.version)) - .pipe(gulp.dest(pm_file_path)); + run('mkdir dist ; cp -ar Koha dist/. ; cp -ar JavaScript dist/. ; sed -i -e "s/{VERSION}/' + package_json.version + '/g" ' + pm_file_path_full_dist + ' ; cd dist ; zip -r ../' + release_filename + ' ./Koha ./JavaScript ; cd .. ; rm -rf dist').exec(); - //FIXME: This doesn't work! It only zips of the first level of directories, leaving them empty - gulp.src(['./*', '!gulpfile.js', '!node_modules', '!package.json', '!README.md']) - .pipe(zip(release_filename)) - .pipe(gulp.dest('./')); }); gulp.task('release', () => { gulp.src(release_filename) .pipe(release({ manifest: require('./package.json') // package.json from which default values will be extracted if they're missing - })) - .pipe(git.checkoutFiles()); + })); }); +/* + // Set module version + gulp.src(pm_file_path_full) + .pipe(replace('{VERSION}', package_json.version)) + .pipe(gulp.dest(pm_file_path_dist)); + + //FIXME: This doesn't work! It only zips of the first level of directories, leaving them empty + gulp.src(['./*', '!gulpfile.js', '!node_modules', '!package.json', '!README.md']) + .pipe(zip(release_filename)) + .pipe(gulp.dest('./')); +*/ diff --git a/package.json b/package.json index 83351ca..8bc88cc 100644 --- a/package.json +++ b/package.json @@ -4,13 +4,13 @@ "description": "Koha CoverFlow Plugin", "main": "index.js", "dependencies": { - "gulp-git": "^1.11.0", "gulp-zip": "^3.2.0" }, "devDependencies": { "gulp": "^3.9.1", "gulp-cli": "^1.2.2", "gulp-github-release": "^1.1.5", + "gulp-run": "^1.7.1", "gulp-zip": "^3.2.0" }, "scripts": {