[project] add windows runner and archive packer
This commit is contained in:
43
haxetool/project.js
Normal file → Executable file
43
haxetool/project.js
Normal file → Executable file
@@ -20,6 +20,7 @@ const rename = require('gulp-rename');
|
|||||||
const template = require('lodash.template');
|
const template = require('lodash.template');
|
||||||
const tar = require('gulp-tar');
|
const tar = require('gulp-tar');
|
||||||
const gzip = require('gulp-gzip');
|
const gzip = require('gulp-gzip');
|
||||||
|
const zip = require('gulp-zip');
|
||||||
|
|
||||||
const streamToPromise = (stream) => {
|
const streamToPromise = (stream) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@@ -243,6 +244,28 @@ LinuxArchivePacker.NAME = 'archive';
|
|||||||
|
|
||||||
Packer.register(Platform.LINUX, LinuxArchivePacker.NAME, LinuxArchivePacker);
|
Packer.register(Platform.LINUX, LinuxArchivePacker.NAME, LinuxArchivePacker);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class WindowsArchivePacker extends Packer {
|
||||||
|
|
||||||
|
constructor(config) {
|
||||||
|
super(config, Platform.WINDOWS);
|
||||||
|
}
|
||||||
|
|
||||||
|
call() {
|
||||||
|
const target = this.targetPath;
|
||||||
|
const archiveName = `${this.config.meta.filename}_${this.config.meta.version}.zip`;
|
||||||
|
return gulp.src(`${target}/**/*`)
|
||||||
|
.pipe(zip(archiveName))
|
||||||
|
.pipe(gulp.dest(path.join(target, '..', 'archive')))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WindowsArchivePacker.NAME = 'archive';
|
||||||
|
|
||||||
|
Packer.register(Platform.WINDOWS, WindowsArchivePacker.NAME, WindowsArchivePacker);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -335,7 +358,25 @@ class LinuxRunner extends Runner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Runner.register(Platform.LINUX, LinuxRunner);
|
Runner.register(Platform.LINUX, LinuxRunner);
|
||||||
Runner.register(Platform.WINDOWS, LinuxRunner); //ToDo:
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class WindowsRunner extends Runner {
|
||||||
|
|
||||||
|
constructor(config, debug) {
|
||||||
|
super(config, Platform.WINDOWS, debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
call() {
|
||||||
|
const target = this.targetPath;
|
||||||
|
const filename = path.resolve(target, this.config.meta.filename + '.exe');
|
||||||
|
const result = gulp.src(filename).pipe(run("<%=file.basename%>", {cwd: target, verbosity: 0}));
|
||||||
|
return this.log(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Runner.register(Platform.WINDOWS, WindowsRunner);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
1
package.json
Normal file → Executable file
1
package.json
Normal file → Executable file
@@ -17,6 +17,7 @@
|
|||||||
"gulp-spawn": "^0.4.0",
|
"gulp-spawn": "^0.4.0",
|
||||||
"gulp-tar": "^3.0.0",
|
"gulp-tar": "^3.0.0",
|
||||||
"gulp-webserver": "^0.9.1",
|
"gulp-webserver": "^0.9.1",
|
||||||
|
"gulp-zip": "^5.0.0",
|
||||||
"lodash.defaults": "^4.2.0",
|
"lodash.defaults": "^4.2.0",
|
||||||
"lodash.template": "^4.4.0",
|
"lodash.template": "^4.4.0",
|
||||||
"plugin-error": "^1.0.1",
|
"plugin-error": "^1.0.1",
|
||||||
|
|||||||
Reference in New Issue
Block a user