Skip to content

Commit bc30bda

Browse files
committed
Merge branch 'development' of github.com:Unitech/PM2 into development
2 parents 04c72a7 + ff8915d commit bc30bda

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Disabled auto-gc on interactor
77
- Allow PM2 to execute binaries in $PATH
88
- pm2 link priv pub --recyle for elastic infrastructure
9+
- pm2 deploy now check default file ecosystem.js[on|on5], package.json
910

1011
# 0.14.6
1112

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ Your app is now put in background, monitored and kept alive forever.
3838

3939
## Module system
4040

41-
PM2 embbed a simple and powerful module system. Installing a module is straightforward:
41+
PM2 embeds a simple and powerful module system. Installing a module is straightforward:
4242

4343
```bash
4444
$ pm2 install <module_name>
4545
```
4646

47-
Here are some PM2 compatible modules (this is standalone Node.js softwares that are managed by PM2):
47+
Here are some PM2 compatible modules (standalone Node.js applications managed by PM2):
4848

4949
[**pm2-logrotate**](https://github.com/pm2-hive/pm2-logrotate) auto rotate logs of PM2 and applications managed<br/>
5050
[**pm2-webshell**](https://github.com/pm2-hive/pm2-webshell) expose a fully capable terminal in browsers<br/>

lib/CLI.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var extItps = require('./interpreter.json');
2424
var InteractorDaemonizer = require('./Interactor/InteractorDaemonizer');
2525
var json5 = require('./tools/json5.js');
2626
var Config = require('./tools/Config');
27+
var Utility = require('./Utility.js');
2728

2829
var Modularizer = require('./Modularizer.js');
2930
var Configuration = require('../lib/Configuration.js');
@@ -430,7 +431,12 @@ CLI.deploy = function(file, commands, cb) {
430431
// Find ecosystem file by default
431432
if (file.indexOf('.json') == -1) {
432433
env = args[0];
433-
file = 'ecosystem.json';
434+
file = Utility.whichFileExists(['ecosystem.js', 'ecosystem.json', 'ecosystem.json5', 'package.json']);
435+
436+
if (!file) {
437+
printError('Not any default deployment file exists');
438+
return cb ? cb('Not any default ecosystem file present') : exitCli(cst.ERROR_EXIT);
439+
}
434440
}
435441
else
436442
env = args[1];

lib/Utility.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ var Utility = module.exports = {
2020

2121
return obj;
2222
},
23+
whichFileExists : function(file_arr) {
24+
var f = null;
25+
26+
file_arr.some(function(file) {
27+
try {
28+
fs.statSync(file);
29+
} catch(e) {
30+
return false;
31+
}
32+
f = file;
33+
return true;
34+
});
35+
return f;
36+
},
2337
clone : function(obj) {
2438
if (obj === null || obj === undefined) return {};
2539
return clone(obj);

0 commit comments

Comments
 (0)