Commit ed8b2175 authored by Sebastian Hönel's avatar Sebastian Hönel

Updated the Builder and the index.ts files

parent 4bb3824f
......@@ -14,11 +14,4 @@ function deploy(folder, endpointUri, password) {
}
exports.deploy = deploy;
;
var deployFolder = 'C:/iGoTerra/workspace/server-php', deployEndpoint = 'http://dev.igoterra.com:9696/server_api', deployPassword = '95f1b6e0c8e092887008c5f0eec399264ea6bf1e547ef50d292bd8e6';
deploy(deployFolder, deployEndpoint, deployPassword).then(function () {
console.log('Deployed.');
console.error('>>> Deploy finished!');
}).catch(function (e) {
console.error('>>> Deploy failed. <<<');
});
//# sourceMappingURL=index.js.map
\ No newline at end of file
......@@ -30,8 +30,8 @@ export function deploy(folder: string, endpointUri: string, password: string): P
console.error('>>> Deploy failed. <<<');
});*/
var
deployFolder = 'C:/iGoTerra/workspace/server-php',
/*var
deployFolder = 'C:/repos/iGoTerra/workspace/server-php',
deployEndpoint = 'http://dev.igoterra.com:9696/server_api',
deployPassword = '95f1b6e0c8e092887008c5f0eec399264ea6bf1e547ef50d292bd8e6';
......@@ -40,4 +40,4 @@ var
console.error('>>> Deploy finished!');
}).catch(function(e:any) {
console.error('>>> Deploy failed. <<<');
});
\ No newline at end of file
});*/
\ No newline at end of file
......@@ -8,13 +8,37 @@ var Builder = (function () {
Builder.prototype.build = function () {
var _this = this;
return new Promise(function (resolve, reject) {
ChildProc.execFile('composer', ['install'], {
cwd: _this.projectRoot
var composer;
var composerPath;
if (/win/i.test(process.platform)) {
var raw = ChildProc.execSync('where composer').toString().split("\r\n").filter(function (temp) { return temp.endsWith('.bat'); });
if (raw.length === 0) {
reject('Composer not found.');
return;
}
composer = raw[0].substr(raw[0].lastIndexOf('\\') + 1);
composerPath = raw[0].substr(0, raw[0].lastIndexOf('\\'));
}
else {
var raw = ChildProc.execSync('whereis composer').toString().split("\n");
if (raw.length === 0) {
reject('Composer not found.');
return;
}
var split = raw[0].split(': ')[1];
composer = split.substr(split.lastIndexOf('/') + 1);
composerPath = split.substr(0, split.lastIndexOf('/'));
}
ChildProc.execFile(composer, ['install', '-d', ("" + _this.projectRoot)], {
cwd: composerPath
}, function (err, stdOut, stdErr) {
if (err) {
reject(err);
}
else {
if (stdErr.length > 0) {
console.warn(stdErr);
}
resolve();
}
});
......
......@@ -11,15 +11,42 @@ export class Builder {
public build(): Promise<void> {
return new Promise<void>((resolve, reject) => {
ChildProc.execFile('composer', ['install'], {
cwd: this.projectRoot
let composer: string;
let composerPath: string;
if (/win/i.test(process.platform)) {
const raw = ChildProc.execSync('where composer').toString().split("\r\n").filter((temp: any) => temp.endsWith('.bat'));
if (raw.length === 0) {
reject('Composer not found.');
return;
}
composer = raw[0].substr(raw[0].lastIndexOf('\\') + 1);
composerPath = raw[0].substr(0, raw[0].lastIndexOf('\\'));
} else {
const raw = ChildProc.execSync('whereis composer').toString().split("\n");
if (raw.length === 0) {
reject('Composer not found.');
return;
}
//composer: /usr/local/bin/composer
const split = raw[0].split(': ')[1];
composer = split.substr(split.lastIndexOf('/') + 1);
composerPath = split.substr(0, split.lastIndexOf('/'));
}
ChildProc.execFile(composer, ['install', '-d', `${this.projectRoot}`], {
cwd: composerPath
}, (err, stdOut, stdErr) => {
if (err) {
reject(err);
} else {
if (stdErr.length > 0) {
console.warn(stdErr);
}
resolve();
}
})
});
});
};
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment