Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update download status message #12

Merged
merged 1 commit into from
Jan 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"scripts": {
"install": "cd server && npm install && cd ../client && npm install",
"build":"npm run build:client && npm run build:server",
"build": "npm run build:client && npm run build:server",
"build:client": "cd client && npm run build",
"build:server": "cd server && npm run build",
"watch:client": "cd server && npm run build && cd ../client && npm run watch",
Expand Down
13 changes: 4 additions & 9 deletions server/src/TSQLLintToolsHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,12 @@ export default class TSQLLintRuntimeHelper {
}

private UnzipRuntime(path: string, tsqllintInstallDirectory: string) {
console.log('ONE')

return new Promise((resolve, reject) => {
decompress(path, `${tsqllintInstallDirectory}`, {
plugins: [
decompressTargz()
]
}).then(() => {
console.log('TWO')
TSQLLintRuntimeHelper._tsqllintToolsPath = tsqllintInstallDirectory;
return resolve(tsqllintInstallDirectory);
}).catch((err: Error) => {
Expand All @@ -82,16 +79,15 @@ export default class TSQLLintRuntimeHelper {
let downloadPath: string = `${installDirectory}/${TSQLLintRuntimeHelper._runTime}.tgz`

return new Promise((resolve, reject) => {
console.log('Installing TSQLLint Runtime');
console.log(`Installing TSQLLint Runtime: ${downloadUrl}`);
if (!fs.existsSync(installDirectory)) {
fs.mkdirSync(installDirectory);
}
var file = fs.createWriteStream(downloadFilePath)
var request = https.get(downloadUrl, (response: any) => {
const length = Number(response.headers['content-length']);
response.pipe(file)

process.stdout.write('downloading...');
process.stdout.write('Downloading...');

if (!isNaN(length)) {
process.stdout.write(' [');
Expand All @@ -104,16 +100,15 @@ export default class TSQLLintRuntimeHelper {
for (let i = char; i < fill; i++) process.stdout.write('=');
char = fill;
});
response.on('end', () => process.stdout.write(']'));
response.on('end', () => process.stdout.write(']\n'));
}
file.on('finish', function () {
console.log(' done!');
file.close(resolve(downloadPath))
});
}).on('response', (res: any) => {
if (res.statusCode != 200) {
fs.unlink(downloadPath)
return reject(new Error(`There was a problem downloading ${downloadUrl}`))
return reject(new Error(`There was a problem downloading the TSQLLint Runtime. Reload VS Code to try again`))
}
}).on('error', function (err: Error) {
fs.unlink(downloadPath)
Expand Down