CommandLine

Jesse Gumm edited this page Jul 6, 2013 · 2 revisions

First of all follow Installing Nitrogen instructions to make sure you have the nitrogen utility.

Currently there are 2 utilities for using Nitrogen's command line tools

bin/nitrogen

The launcher script, which can be used for starting your Nitrogen application.

  • bin/nitrogen console - Launch Nitrogen and start connected to the Erlang Shell
  • bin/nitrogen start - Launch Nitrogen as a daemon
  • bin/nitrogen attach - Connect to the shell of a running Nitrogen daemon. Disconnect from the shell with CTRL+D. If you CTRL+C, you will kill the running daemon.
  • bin/nitrogen restart - Restart the Nitrogen daemon
  • bin/nitrogen stop - Stop the Nitrogen daemon

bin/dev

Helper utility for creating pages/elements/actions, and dealing with compilation

  • bin/dev page some_page should be run inside the root of a nitrogen project and create a new module at site/src/some_page.erl
  • bin/dev element some_element should be run inside the root of a nitrogen project and create a new Nitrogen element module at site/src/elements/element_some_element.erl
  • bin/dev action some_action should be run inside the root of a nitrogen project and create a new module at site/src/actions/action_some_action.erl
  • bin/dev compile will start the sync application for automatic recompiling

Helper Script so you don't have to type bin/ each time

There is a helper script included with Nitrogen that will install itself into bin, allowing you to call Nitrogen commands from anywhere withing a Nitrogen installation.

For example, if you're in site/src/pages, and you want to make a new page, you would have to type ../../../bin/dev page my_new_page. All that "../../../" gets tedius, so with the helper script, you can do the same by simply typing dev page my_new_page, without dealing with figuring out where you are in the directory structure.

The same goes with bin/nitrogen. If, in development, you need to restart the Nitrogen daemon, you can simply type nitrogen restart from within the Nitrogen installation, and it'll restart the proper daemon.

To install the helper script, head to your Nitrogen repository (where you typed make rel_server or make slim_server), and type:

make install-helper-script