Comparing version 1.49.0 to 1.50.0
{ | ||
"name": "dugite", | ||
"version": "1.49.0", | ||
"version": "1.50.0", | ||
"description": "Elegant bindings for Git", | ||
@@ -5,0 +5,0 @@ "main": "./build/lib/index.js", |
@@ -29,20 +29,22 @@ const URL = require('url') | ||
// compute the filename from the download source | ||
const url = URL.parse(config.source) | ||
const pathName = url.pathname | ||
const index = pathName.lastIndexOf('/') | ||
config.fileName = pathName.substr(index + 1) | ||
if (config.source !== '') { | ||
// compute the filename from the download source | ||
const url = URL.parse(config.source) | ||
const pathName = url.pathname | ||
const index = pathName.lastIndexOf('/') | ||
config.fileName = pathName.substr(index + 1) | ||
const cacheDirEnv = process.env.DUGITE_CACHE_DIR | ||
const cacheDirEnv = process.env.DUGITE_CACHE_DIR | ||
const cacheDir = cacheDirEnv ? path.resolve(cacheDirEnv) : os.tmpdir() | ||
const cacheDir = cacheDirEnv ? path.resolve(cacheDirEnv) : os.tmpdir() | ||
try { | ||
fs.statSync(cacheDir) | ||
} catch (e) { | ||
fs.mkdirSync(cacheDir) | ||
try { | ||
fs.statSync(cacheDir) | ||
} catch (e) { | ||
fs.mkdirSync(cacheDir) | ||
} | ||
config.tempFile = path.join(cacheDir, config.fileName) | ||
} | ||
config.tempFile = path.join(cacheDir, config.fileName) | ||
return config | ||
@@ -49,0 +51,0 @@ } |
@@ -13,4 +13,4 @@ const fs = require('fs') | ||
function extract (source, callback) { | ||
const extractor = tar.Extract({path: config.outputPath}) | ||
function extract(source, callback) { | ||
const extractor = tar.Extract({ path: config.outputPath }) | ||
.on('error', function (error) { callback(error) }) | ||
@@ -64,3 +64,12 @@ .on('end', function () { callback() }) | ||
req.on('error', function (error) { | ||
console.log(`Error raised while downloading ${config.source}`, error) | ||
if (error.code === 'ETIMEDOUT') { | ||
console.log( | ||
`A timeout has occurred while downloading '${config.source}' - check ` + | ||
`your internet connection and try again. If you are using a proxy, ` + | ||
`make sure that the HTTP_PROXY and HTTPS_PROXY environment variables are set.`, | ||
error | ||
) | ||
} else { | ||
console.log(`Error raised while downloading ${config.source}`, error) | ||
} | ||
process.exit(1) | ||
@@ -104,3 +113,11 @@ }) | ||
mkdirp(config.outputPath, function (error) { | ||
if (config.source === '') { | ||
console.log( | ||
`Skipping downloading embedded Git as platform '${process.platform}' is not supported.` | ||
) | ||
console.log(`To learn more about using dugite with a system Git: https://git.io/vF5oj`) | ||
process.exit(0) | ||
} | ||
mkdirp(config.outputPath, function(error) { | ||
if (error) { | ||
@@ -107,0 +124,0 @@ console.log(`Unable to create directory at ${config.outputPath}`, error) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51414
705