For the following commands, keep in mind that Lisp functions and modules do not use underscores by convention, but rather dashes. When naming your project, it is recommended that you do this as well. Also note that it's probably best to use just alphanumerica characters, dashes, and nothing else in your project names.
The new command supports the following sub-commands:
scriptlibraryserviceyaws
To create an lfescript, simply run the following:
$ lfetool new script my-scriptTo create a "library" project, run the following:
$ lfetool new library my-new-libNote: upon running this script, not only will your project be set up with a skeleton, but also:
- the dependencies for your project will be downloaded to your new project's
depsdir; - the stubbed unit test will be run and will fail (it's stubbed to fail because of TDD ;-));
- the project will be set up with a newly initialized github repo; and
- the new project files will be added to the repo.
One may create a "service" project by running the following:
$ lfetool new service my-new-serviceThis will create an LFE OTP application skeleton for your project, complete with unit tests and an initialized git repo.
To run your new server:
$ cd my-new-service
$ make shellAnd then:
> (: application start 'my-new-service)
ok
> (: my-new-service-server test-call '"a call message")
Call: "a call message"
ok
> (: my-new-service-server test-cast '"a cast message")
ok
Cast: "a cast message"
>You may also start the application ahead of time, as is done in the run
target:
$ make run
Erlang R16B (erts-5.10.1) [source] [smp:8:8] [async-threads:10] [hipe] ...
LFE Shell V5.10.1 (abort with ^G)
> (: my-new-service-server test-call '"a call message")
Call: "a call message"
ok
> (: my-new-service-server test-cast '"a cast message")
ok
Cast: "a cast message"
>Note that the call to start the application wasn't needed, since it was started
via a command line option in the Makefile.
If you would simply like to run in daemon mode, you may do that as well with the
supplied daemon target.
The yaws command builds out a number of skeleton web projects that are
powered by the YAWS web server.
yaws takes several subcommands:
default- creates a basic, multi-module web project using the `exemplar`_ library for generating HTML with S-expressions.
bootstrap- creates a `Twitter Bootsrap`_ version of thedefaultproject.
Note that new yaws is an alias for new yaws default; if a subcommand is not passed, the
default subcommand is assumed.
Example usage:
$ lfetool new yaws my-web-projector
$ lfetool new yaws default my-web-projectAnother example:
$ lfetool new yaws bootstrap my-web-projectHere is a screenshot of the lfetool demo bootstrap project:
After this, you can view your new project by executing these commands:
$ cd my-web-project
$ make devand then pointing your web browser at http://localhost:5099/.
One may create a "presentation" project (slide deck) by running the following:
$ lfetool new presentation my-slide-deckThis command will create a new project with the following deps:
- yaws
- lfe-reveal-js
Once the project has been built, do the following to try it out:
$ cd my-slide-deck
$ make devAnd then load up localhost:5099 in your browser.
lfetool only supports the Reveal.js presentation library.
At a future date we will also support the e2 project in a similar fashion:
$ lfetool new e2-service my-new-service