Skip to content

Commit

Permalink
Merge pull request #219 from chrisbutler/master
Browse files Browse the repository at this point in the history
big improvements to mup integration to fix #206
  • Loading branch information
Chris Butler committed Oct 20, 2015
2 parents efbe040 + aa3f5c2 commit eb27796
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,8 @@ The following configuration options are supported in `config.json`:

```
"mup": {
"version": "mup|mupx",
"development": "/config/development",
"anyenv": "/any/folder"
"version": "mup" or "mupx",
"environment": "/path/to/environment"
}
```

Expand Down
33 changes: 29 additions & 4 deletions lib/commands/mup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var path = require('path');
var fs = require('fs');
var _ = require('underscore');

var MUP_COMMAND_DESCRIPTION = 'Deploy an app using iron and mup. \n\n' +
Expand Down Expand Up @@ -52,29 +53,53 @@ Command.create({
// if (!_.contains(mupConfigKeys, destinationKey))
// throw new Command.UsageError;



// Default to config directory
var destination = mupConfig[destinationKey] || 'config/' + destinationKey;
var destination = mupConfig && mupConfig[destinationKey] || 'config/' + destinationKey;
var cwd = path.join(this.pathFromProject(), destination);

// Can we print the mup stdout with execSync
// while it's happening, instead of using the spinner?
var spinHandle = this.logWithSpinner('Deploying with ' + mupVersion);
var mupCommand;

if (opts.init) {
if (this.isFile(destination + '/mup.json')) {
this.logError("MUP already initialized.");
return false;
}
if (this.isFile(destination + '/settings.json')) {
if (!this.confirm("This will temporarily back up your settings.json file, and replace it after MUP is initialized. Continue?")) {
return false;
} else {
fs.renameSync(destination + '/settings.json', destination + '/settings.bak');
}
}
mupCommand = mupVersion + ' init';
} else if (opts.setup) {
mupCommand = mupVersion + ' setup';
} else {
mupCommand = mupVersion + ' deploy';
}

// Can we print the mup stdout with execSync
// while it's happening, instead of using the spinner?
var spinHandle = this.logWithSpinner('Running ' + mupCommand);

try {
this.execSync(mupCommand, {cwd: cwd});
} catch(e) {
this.logError(e);
} finally {
spinHandle.stop();
if (opts.init) {
var mupJson = fs.readFileSync(destination + '/mup.json', 'utf8');
mupJson = mupJson.replace('"enableUploadProgressBar": true', '"enableUploadProgressBar": false');
fs.writeFileSync(destination + '/mup.json', mupJson);

if (this.isFile(destination + '/settings.bak')) {
fs.unlinkSync(destination + '/settings.json');
fs.renameSync(destination + '/settings.bak', destination + '/settings.json');
}
}
}

});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iron-meteor",
"version": "1.4.2",
"version": "1.5.0",
"description": "A command line tool for scaffolding Meteor applications.",
"homepage": "https://github.com/iron-meteor/iron-cli",
"bugs": {
Expand Down

0 comments on commit eb27796

Please sign in to comment.