tabs lmao

master
Marcus 2018-10-30 18:17:19 -04:00
parent 0e9e72efc1
commit ab54372d16
1 changed files with 58 additions and 58 deletions

View File

@ -7,68 +7,68 @@ let path = require('path');
let waitOn = require('wait-on'); let waitOn = require('wait-on');
request({ request({
uri: "https://www.python.org/downloads/", uri: "https://www.python.org/downloads/",
}, function (error, response, body) { }, function (error, response, body) {
let os_string = os.platform(); let os_string = os.platform();
let current_os = ''; let current_os = '';
switch (os_string) switch (os_string)
{ {
case 'darwin': case 'darwin':
current_os = "download-os-mac-osx"; current_os = "download-os-mac-osx";
break; break;
case 'linux': case 'linux':
current_os = "download-os-source"; current_os = "download-os-source";
break; break;
case 'win32': case 'win32':
current_os = "download-os-windows"; current_os = "download-os-windows";
break; break;
default: default:
current_os = "download-os-source"; current_os = "download-os-source";
break; break;
} }
let current_download_start = body.indexOf("href=",body.indexOf(current_os)) + 6; let current_download_start = body.indexOf("href=",body.indexOf(current_os)) + 6;
let current_download_end = body.indexOf('">', current_download_start); let current_download_end = body.indexOf('">', current_download_start);
let current_download = body.substring(current_download_start, current_download_end); let current_download = body.substring(current_download_start, current_download_end);
// function downlaod_python() // function downlaod_python()
// { // {
// return new Promise(function (resolve, reject) { // return new Promise(function (resolve, reject) {
let file_name = current_download.substring(current_download.indexOf('/', current_download.indexOf('/python/') + 8) + 1); let file_name = current_download.substring(current_download.indexOf('/', current_download.indexOf('/python/') + 8) + 1);
// console.log(file_name); // console.log(file_name);
let out_file = fs.createWriteStream(`../Python-Installer/${file_name}`); let out_file = fs.createWriteStream(`../Python-Installer/${file_name}`);
let file_request = https.get(current_download, function (response) { let file_request = https.get(current_download, function (response) {
response.pipe(out_file); response.pipe(out_file);
}); });
// resolve("Python Downloaded"); // resolve("Python Downloaded");
// }) // })
// } // }
// function install_python() // function install_python()
// { // {
// return new Promise(function (resolve, reject) // return new Promise(function (resolve, reject)
// { // {
switch (os_string) switch (os_string)
{ {
case 'win32': case 'win32':
try { try {
cmd.run(`${path.join(__dirname, '/../', 'Python-Installer/', file_name)} /quiet DefaultJustForMeTargetDir=${path.join(__dirname, '/../', 'Python/')}`); cmd.run(`${path.join(__dirname, '/../', 'Python-Installer/', file_name)} /quiet DefaultJustForMeTargetDir=${path.join(__dirname, '/../', 'Python/')}`);
resolve("Python Installed"); resolve("Python Installed");
} catch (err) { } catch (err) {
console.log(err); console.log(err);
} }
break; break;
} }
// }) // })
// } // }
// async function main() // async function main()
// { // {
// await downlaod_python(); // await downlaod_python();
// await install_python(); // await install_python();
// console.log("Done"); // console.log("Done");
// } // }
}); });