mirror of
https://github.com/bower/bower.git
synced 2026-02-19 10:14:21 -05:00
Config improv.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var mout = require('mout');
|
||||
var tmp = require('tmp');
|
||||
var mkdirp = require('mkdirp');
|
||||
|
||||
// Guess some needed properties based on the user OS
|
||||
var temp = process.env.TMPDIR
|
||||
@@ -26,6 +26,8 @@ var proxy = process.env.HTTPS_PROXY
|
||||
|| process.env.HTTP_PROXY
|
||||
|| process.env.http_proxy;
|
||||
|
||||
// -----------
|
||||
|
||||
// Setup bower config
|
||||
var config;
|
||||
try {
|
||||
@@ -51,8 +53,23 @@ try {
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
// Configure tmp package to use graceful degradation
|
||||
// If an uncaught exception occurs, the temporary directories will be deleted nevertheless
|
||||
tmp.setGracefulCleanup();
|
||||
// Add aliases that is meant to be used internally
|
||||
mout.object.mixIn(config, {
|
||||
cache: path.join(config.roaming, 'cache'),
|
||||
links: path.join(config.roaming, 'links'),
|
||||
completion: path.join(config.roaming, 'completion'),
|
||||
gitTemplate: path.join(config.roaming, 'git_template')
|
||||
});
|
||||
|
||||
// -----------
|
||||
|
||||
// Make sure that we have our git template directory
|
||||
// The git template directory is an empty dir that will be set up for every git command
|
||||
// So that the user git hooks won't be used
|
||||
try {
|
||||
mkdirp.sync(config.gitTemplate);
|
||||
} catch (e) {
|
||||
throw new Error('Unable to create git_template directory: ' + e.message);
|
||||
}
|
||||
|
||||
module.exports = config;
|
||||
|
||||
Reference in New Issue
Block a user