-
Notifications
You must be signed in to change notification settings - Fork 9
command line
pineapple supports a set of useful commands that make using pineapple with your application mush easier. Here you can read about the various commands the are available and how to extend the command line interface within your pineapple application
[app] => Found the Paplfile file. => /Users/werle/repos/pineapple/examples/resource-service/PaplfileThe Paplfile is a file that is bootstrapped automatically if it exists in the current working directory. It is useful hooking into the execution process before a command is interpreted from the command line.
example:
Consider wanting to set some variables based on the environment during the beging of each bootstrap. The Paplfile could look like this:
if (pineapple.isProduction) {
pineapple.DEBUG = false;
pineapple.LOG_MODE = 'production';
pineapple.GLOBAL_RATE_LIMIT = 1000;
}The debug flag is set to false, log mode set to production, and the global rate limit set to 1000. This is all done before the bin executable is processed. Many options and overrides can be set during this process to alter the behavior our your pineapple application will handle the command.
--
$ pineapple help - Shows a list of the possible commands and a description of their usage.
example:
$ pineapple help
...
Usage
pineapple help - Display this message
pineapple update - Updates all the necessary dependents for Pineapple. (May require sudo)
pineapple test - <namespace> <suite> Execute test suites.
pineapple server - Starts a pineapple server
pineapple noop - A no operation command. This command doesn't exit, catch or throw exceptions, or log any output.
pineapple git - <command> <args> Execute git commands on your current pineapple repository
pineapple gen - Generates a new pineapple api application.
pineapple console - Start a console with your Pineapple app--
$ pineapple app [,<property>] - Parses and reads the package.json file in the directory of invocation.
examples:
$ pineapple app
...
{ name: 'new-app',
version: '0.0.1',
dependencies: { pineapple: '>=0.2.x' } }$ pineapple app name
...
new-app $ pineapple app version
...
0.0.1--
$ pineapple gen <name> - Creates a new pineapple application with a basic skeleton.
example:
$ pineapple gen resource-service
[pineapple] => Sweet! I've created a new Pineapple application here => /Users/werle/repos/pineapple/examples/resource-service
[pineapple] => WARN Going to grab all of those dependencies now..
[pineapple] => WARN This may take a while..
[pineapple] => SUCCESS All dependencies installed! =)
$ cd resource-service/--
$ pineapple server [-e|--environment] <env> - Starts a pineapple server from a working pineapple application directory with a given environment flag (defaults to development).
examples:
$ pineapple server
Requiring app module /config/environment
Requiring app module /config/development
Requiring app module /config/application
Requiring app module /config/routes.js
Requiring app module /app/controllers
Requiring app module /app/models
[app] => Found the Paplfile file. => /Users/werle/repos/pineapple/examples/resource-service/Paplfile
[server] => Listening on port 4000Start in production environment (defaults to development)
$ pineapple server -e production
Requiring app module /config/environment
Requiring app module /config/development
Requiring app module /config/application
Requiring app module /config/routes.js
Requiring app module /app/controllers
Requiring app module /app/models
[app] => Found the Paplfile file. => /Users/werle/repos/pineapple/examples/resource-service/Paplfile
[pineapple] => Requiring app module /config/environment
[pineapple] => Requiring app module /config/production
[server] => Listening on port 4000--
$ pineapple console [-e|--environment] <env> [--no-server] - Starts a pineapple console session with a given environment (defaults to development) and a connection to the database.
From a console you can interact with the pineapple namespace and the models you've created in your application directory. example:
$ pineapple c --no-server
...
[console] => Starting pineapple console..
[console] => SUCCESS Have fun!
Starting REPLConsole session with name pineapple with locale local
pineapple-local> pineapple.models.TestModel = function TestModel(){ this.define(); this.field({property : String}); };
[Function: TestModel]
pineapple-local> TestModel = pineapple.models.get('TestModel');
pineapple-local> TestModel.create({property : "foo"}, function(e, tm){
..... if (e) throw e;
..... console.log(tm);
..... TestModel.find({_id : tm._id}, function(e, tmf){
....... console.log(tm, tmf)
....... })});
...
undefined
pineapple-local> { __v: 0, property: 'foo', _id: 50f6d69f2b97029539000001 }
{ __v: 0, property: 'foo', _id: 50f6d69f2b97029539000001 } [ { property: 'foo', _id: 50f6d69f2b97029539000001, __v: 0 } ]$ pineapple noop - Performs a no operation. Does nothing.
example:
$ pineapple noop
Requiring app module /config/environment
Requiring app module /config/development
Requiring app module /config/application
Requiring app module /config/routes.js
Requiring app module /app/controllers
Requiring app module /app/models
[app] => Found the Paplfile file. => /Users/werle/repos/pineapple/examples/resource-service/Paplfile
[pineapple] => No-operation.--
$ [sudo] pineapple update - Warning: May require sudo rights. Updates pineapple and its core dependencies.
example:
$ sudo pineapple update
[pineapple] => Updating... (This may take a while)
[pineapple] => SUCCESS Update successful!--
Paplfile