Permalink
Browse files

Stop running cli on import. This makes it untestable.

Running the cli on import makes it untestable. New version exports a run function the importer can invoke when ready.
  • Loading branch information...
1 parent 4d58858 commit 703a661241d801a031d2fd410b5537b1e9fe9495 @mojit0 mojit0 committed Nov 30, 2012
Showing with 5 additions and 6 deletions.
  1. +4 −2 bin/mojito
  2. +1 −4 lib/management/cli.js
View
@@ -4,7 +4,9 @@
* Copyrights licensed under the New BSD License.
* See the accompanying LICENSE file for terms.
*/
-var resolve = require('path').resolve,
+var cli,
+ resolve = require('path').resolve,
mojito = require(resolve(__dirname, '../lib/mojito'));
-mojito.include('management/cli');
+cli = mojito.include('management/cli');
+cli.run();
View
@@ -132,7 +132,4 @@ function main() {
});
}
-// Execute the main() function. Note that this occurs as part of the
-// require/import process so simply importing/require()ing the cli.js will cause
-// the main() operation to be invoked.
-main();
+exports.run = main;

0 comments on commit 703a661

Please sign in to comment.