Lucerne ยป Starting a Project

Lucerne includes a project skeleton generator, which asks you some questions about the project and generates it accordingly.

The generated app is a runnable application with views and unit tests. To run it:

CL-USER> (ql:quickload :my-app)
To load "my-app":
  Load 1 ASDF system:
    my-app
; Loading "my-app"
[package my-app]............
(:MY-APP)

CL-USER> (lucerne:start my-app:app :port 8000)
To load "clack-handler-hunchentoot":
  Load 1 ASDF system:
    clack-handler-hunchentoot
; Loading "clack-handler-hunchentoot"

Hunchentoot server is started.
Listening on localhost:8000.
T
CL-USER> 

To run the tests:

(ql:quickload :my-app-test)

Usage

CL-USER> (lucerne.skeleton:make-project)

Project name (e.g. 'my-app'): my-app

Author's full name: Fernando Borretti

Author's email: eudoxiahp@gmail.com

License (e.g. 'MIT', 'GPLv3'): MIT

One-line project description: A simple example app.

Dependencies (e.g. 'drakma, quri, clack'): drakma, cl-gists, jonathan

Use Sass as the CSS preprocessor? (yes or no) yes

Use Travis for continuous integration? (yes or no) no

Add .gitignore? (yes or no) yes

Do you have a GitHub username? (yes or no) yes

GitHub username: eudoxia0

Finally, where do we put the project directory? (e.g. '/code/lisp/' will put the project in '/code/lisp/my-app'): /home/eudoxia/code/
;; Writing /home/eudoxia/code/my-app/README.md
;; Writing /home/eudoxia/code/my-app/.gitignore
;; Writing /home/eudoxia/code/my-app/my-app.asd
;; Writing /home/eudoxia/code/my-app/src/my-app.lisp
;; Writing /home/eudoxia/code/my-app/my-app-test.asd
;; Writing /home/eudoxia/code/my-app/t/my-app.lisp
;; Writing /home/eudoxia/code/my-app/templates/base.html
;; Writing /home/eudoxia/code/my-app/templates/includes/head.html
;; Writing /home/eudoxia/code/my-app/templates/index.html
;; Writing /home/eudoxia/code/my-app/assets/css/style.scss
;; Writing /home/eudoxia/code/my-app/assets/js/scripts.js
;; Writing /home/eudoxia/code/my-app/docs/manifest.lisp
;; Writing /home/eudoxia/code/my-app/docs/manual.scr
T

The resulting files and directories, created in /home/eudoxia/code/my-app/, look like this:


my-app/
    assets/
        css/
            style.scss
        js/
            scripts.js
    src/
        my-app.lisp
    templates/
        includes/
            head.html
        base.html
        index.html
    docs/
        manifest.lisp
        manual.scr
    t/
        my-app.lisp
    .gitignore
    .travis.yml
    my-app.asd
    my-app-test.asd
    README.md

Roles of the Files

README.md
The app's README, where you describe what it is and how to set it up and use it.
my-app.asd
The system definition file, where you describe the application's metadata, dependencies, and the files that make it up.
my-app-test.asd
The system definition file for the tests.
.travis.yml
This file provides integration with Travis for easily testing the application on the cloud.
src/my-app.lisp
This is the application's main file. It defines the Lucerne application object, adds an example route, and sets up the templates and assets. As the application grows, you will find it convenient to split these up into other files.
t/my-app.lisp
The main tests file, defines an example test suite, a couple of tests and runs them.
templates/base.html
The base template.
templates/index.html
The template for the main page.