Skip to content

Commit

Permalink
Refactor verbose mode and add doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Sung Won Cho committed Mar 15, 2016
1 parent 891bee8 commit 0554416
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ Create a Meteor application using Mantra spec under `path`.
It creates a Meteor app, prepares the directories and files, adds Meteor and
NPM dependencies, and installs the NPM dependencies.

**Options**

* `--verbose, -v`

Log the output of the scripts in the console, rather than silencing them.

---------------------------------------

### mantra generate [type] [name]
Expand Down Expand Up @@ -90,11 +96,11 @@ inserts `import` and `export` statements to the relevant `index.js` file.
### mantra destroy [type] [name]
*alias: d*

**This command removes files.**

Destroys all files that its counterpart `mantra generate` command would generate.
You can provide all `types` supported by the `generate` command.

**This command removes files.**

---------------------------------------

## Contributor Guide
Expand Down
2 changes: 1 addition & 1 deletion lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ program
program
.command('create [appPath]')
.alias('c')
.option('-v, --verbose', 'turns on the display of STDOUT info logs during create')
.option('-v, --verbose', 'show output of scripts in the console')
.description('create a new application')
.action(function (appPath, options) {
create(appPath, options);
Expand Down
11 changes: 4 additions & 7 deletions lib/commands/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import shelljs from 'shelljs/shell';

export default function create(appPath, options) {
if (!appPath) {
console.log('Error: Please supply the path of project');
console.log('Please supply the path of project');
console.log('Run `mantra create --help` for more options.');
return;
}
const lineBreak = getLineBreak();
Expand All @@ -19,11 +20,7 @@ export default function create(appPath, options) {
logger.invoke('init');
shelljs.set('-e');
let currentPath = shelljs.pwd();
if (options.verbose) {
shelljs.exec(`meteor create ${appPath} --release 1.3-beta.16`, {silent: false});
} else {
shelljs.exec(`meteor create ${appPath} --release 1.3-beta.16`, {silent: true});
}
shelljs.exec(`meteor create ${appPath} --release 1.3-rc.1`, {silent: !options.verbose});
shelljs.cd(appPath);
shelljs.rm('*.css','*.html','*.js');
`kadira:flow-router${lineBreak}`.toEnd('.meteor/packages');
Expand Down Expand Up @@ -68,7 +65,7 @@ export default function create(appPath, options) {
shelljs.set('-e');
let currentPath = shelljs.pwd();
shelljs.cd(appPath);
shelljs.exec('npm install', {silent: true});
shelljs.exec('npm install', {silent: !options.verbose});
shelljs.cd(currentPath);
}

Expand Down

0 comments on commit 0554416

Please sign in to comment.