Skip to content

Commit

Permalink
Get gulp file working for now, even if it's not exactly the best way …
Browse files Browse the repository at this point in the history
…possible to say the least.
  • Loading branch information
kylemhall authored and Koha instance kohadev-koha committed Aug 8, 2016
1 parent 968f66e commit 3e5294e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
32 changes: 19 additions & 13 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -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('./'));
*/
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 3e5294e

Please sign in to comment.