-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathgulpfile.js
41 lines (34 loc) · 1.29 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const gulp = require('gulp');
const release = require('gulp-github-release');
const fs = require('fs');
const run = require('gulp-run');
const dateTime = require('node-datetime');
const dt = dateTime.create();
const today = dt.format('Y-m-d');
const package_json = JSON.parse(fs.readFileSync('./package.json'));
const release_filename = `${package_json.name}-v${package_json.version}.kpz`;
const pm_file = 'RoomReservations.pm';
const pm_file_path = 'Koha/Plugin/Com/MarywoodUniversity/';
const pm_file_path_full = pm_file_path + pm_file;
const pm_file_path_dist = 'dist/' + pm_file_path;
const 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', () => {
run(`
mkdir dist ;
cp -r Koha dist/. ;
sed -i -e "s/{VERSION}/${package_json.version}/g" ${pm_file_path_full_dist} ;
sed -i -e "s/1900-01-01/${today}/g" ${pm_file_path_full_dist} ;
cd dist ;
zip -r ../${release_filename} ./Koha ;
cd .. ;
rm -rf dist ;
`).exec();
});
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
}));
});