Skip to content

Commit 46783e3

Browse files
committed
Warn if home is not set.
1 parent 2eafac3 commit 46783e3

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

bin/bower

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var path = require('path');
66
var mout = require('mout');
77
var updateNotifier = require('update-notifier');
88
var Logger = require('bower-logger');
9+
var osenv = require('osenv');
910
var bower = require('../lib');
1011
var pkg = require(path.join(__dirname, '..', 'package.json'));
1112
var cli = require('../lib/util/cli');
@@ -18,7 +19,7 @@ var renderer;
1819
var loglevel;
1920
var command;
2021
var commandFunc;
21-
var emitter;
22+
var logger;
2223
var notifier;
2324
var levels = Logger.LEVELS;
2425

@@ -75,29 +76,29 @@ command = command && command.replace(/\./g, ' ');
7576
// If no command was specified, show bower help
7677
// Do the same if the command is unknown
7778
if (!commandFunc) {
78-
emitter = bower.commands.help();
79+
logger = bower.commands.help();
7980
command = 'help';
8081
// If the user requested help, show the command's help
8182
// Do the same if the actual command is a group of other commands (e.g.: cache)
8283
} else if (options.help || !commandFunc.line) {
83-
emitter = bower.commands.help(command);
84+
logger = bower.commands.help(command);
8485
command = 'help';
8586
// Call the line method
8687
} else {
87-
emitter = commandFunc.line(process.argv);
88+
logger = commandFunc.line(process.argv);
8889

8990
// If the method failed to interpret the process arguments
9091
// show the command help
91-
if (!emitter) {
92-
emitter = bower.commands.help(command);
92+
if (!logger) {
93+
logger = bower.commands.help(command);
9394
command = 'help';
9495
}
9596
}
9697

9798
// Get the renderer and configure it with the executed command
98-
renderer = cli.getRenderer(command, emitter.json, bower.config);
99+
renderer = cli.getRenderer(command, logger.json, bower.config);
99100

100-
emitter
101+
logger
101102
.on('end', function (data) {
102103
if (!bower.config.silent) {
103104
renderer.end(data);
@@ -122,6 +123,11 @@ emitter
122123
});
123124
});
124125

126+
// Warn if HOME is not SET
127+
if (!osenv.home()) {
128+
logger.warn('no-home', 'HOME not set, user configuration will not be loaded');
129+
}
130+
125131
// Check for newer version of Bower
126132
notifier = updateNotifier({
127133
packageName: pkg.name,

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"nopt": "~2.1.1",
4242
"lru-cache": "~2.3.0",
4343
"open": "~0.0.3",
44+
"osenv": "0.0.3",
4445
"promptly": "~0.2.0",
4546
"q": "~0.9.2",
4647
"request": "~2.27.0",

0 commit comments

Comments
 (0)