added log module
This commit is contained in:
@@ -4,9 +4,8 @@ const fse = require('fs-extra');
|
||||
const path = require('path');
|
||||
const exec = require('./exec');
|
||||
const Sdk = require('./sdk');
|
||||
const Env = require('./env');
|
||||
const Neko = require('./neko');
|
||||
const colors = require('ansi-colors');
|
||||
const log = require('fancy-log');
|
||||
const vfs = require('vinyl-fs');
|
||||
const template = require('lodash.template');
|
||||
|
||||
@@ -15,9 +14,9 @@ class Haxe extends Sdk {
|
||||
|
||||
getBin(name) {
|
||||
if (Sdk.System.isWindows) {
|
||||
return path.join(this.binPath, name + '.exe');
|
||||
return path.join(this.path, name + '.exe');
|
||||
} else if (Sdk.System.isLinux) {
|
||||
const binPath = path.join(this.binPath, name);
|
||||
const binPath = path.join(this.path, name);
|
||||
if (fs.existsSync(binPath)) {
|
||||
fs.chmodSync(binPath, 0o755);
|
||||
}
|
||||
@@ -26,10 +25,6 @@ class Haxe extends Sdk {
|
||||
throw `Unsupported OS: ${os.type()}`;
|
||||
}
|
||||
|
||||
get binPath() {
|
||||
return `${this.path}`;
|
||||
}
|
||||
|
||||
get haxeBin() {
|
||||
return this.getBin('haxe');
|
||||
}
|
||||
@@ -52,13 +47,12 @@ class Haxe extends Sdk {
|
||||
}
|
||||
|
||||
activate() {
|
||||
this.neko.activate()
|
||||
process.env.HAXE_VERSION = this.version;
|
||||
process.env.HAXE_STD_PATH = path.join(this.binPath, 'std');
|
||||
process.env.HAXE_HOME = this.binPath;
|
||||
if (process.env.PATH.split(path.delimiter).indexOf(this.binPath) === -1) {
|
||||
process.env.PATH = [process.env.PATH, this.binPath].join(path.delimiter);
|
||||
}
|
||||
this.neko.activate();
|
||||
Env.set('HAXE_VERSION', this.version);
|
||||
Env.set('HAXE_STD_PATH', path.join(this.path, 'std'));
|
||||
Env.set('HAXE_HOME', this.path);
|
||||
Env.addPath(this.path);
|
||||
Env.addPath(this.path, 'LD_LIBRARY_PATH');
|
||||
}
|
||||
|
||||
prepare() {
|
||||
@@ -83,8 +77,8 @@ class Haxe extends Sdk {
|
||||
}
|
||||
|
||||
openfl(command, platform, config, debug=false) {
|
||||
log(this.tag, colors.cyan(`openfl build ${platform}`));
|
||||
this.activate()
|
||||
this.log.i('_openfl_ _build_ *%s*', platform);
|
||||
this.activate();
|
||||
const buildDir = path.join(os.tmpdir(), 'build', config.name);
|
||||
fse.ensureDirSync(buildDir);
|
||||
|
||||
@@ -102,8 +96,8 @@ class Haxe extends Sdk {
|
||||
}
|
||||
|
||||
build(platform, config, debug=false) {
|
||||
log(this.tag, colors.cyan(`build ${platform}`));
|
||||
this.activate()
|
||||
this.log.i('_build_ *%s*', platform);
|
||||
this.activate();
|
||||
const buildDir = path.join(os.tmpdir(), 'build', config.name);
|
||||
fse.ensureDirSync(buildDir);
|
||||
|
||||
@@ -135,10 +129,10 @@ class Haxe extends Sdk {
|
||||
}
|
||||
|
||||
install(packages) {
|
||||
this.activate()
|
||||
this.activate();
|
||||
let promise = this.haxelib(['setup', path.join(this.path, 'lib')]);
|
||||
const next = (args) => () => {
|
||||
log(this.tag, colors.cyan('haxelib', 'install'), colors.magenta(args[1]));
|
||||
this.log.i('_haxelib_ _install_ *%s*', args[1]);
|
||||
return this.haxelib(args);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user