Skip to content

Commit

Permalink
Expose require('sails').Sails.generate() for programmatic use.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikermcneil committed Oct 7, 2016
1 parent 54a3162 commit e008a6b
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

var Sails = require('./app');

// * * See also the require for `sails-generate` below. * *


// Instantiate and expose a Sails singleton
Expand All @@ -21,3 +21,27 @@ module.exports.Sails = Sails;
//
// Then:
// var newApp = new Sails();




/**
* Sails.generate()
*
* Generate files or folders.
*
* >This is an exposed version of sails-generate for programmatic use.
* > (available on `require('sails').Sails.generate()`)
*
* @param {Dictionary} scope
* @param {Function} cb
*/
module.exports.Sails.generate = function (){

// Wait until this function is actually called to do this require.
// (no reason to slow down production lifts)
var sailsgen = require('sails-generate');

return sailsgen.apply(this, Array.prototype.slice.call(arguments));

};

0 comments on commit e008a6b

Please sign in to comment.