Skip to content

Project organization

pashields edited this page Feb 5, 2012 · 11 revisions

Project organization

There are four top level directories in this project that a designer or developer will need to work with: public, templates, src and test.

public

public
├── 404.html
├── css
├── design.html
├── images
├── index.html
├── javascripts
└── js

The public directory contains files that are publicly available. With a running server, 404.html can be reached at http://localhost:8080/404.html.

JavaScript source generated by the ClojureScript compiler will be put into public/javascripts. The public/js directory contains static (i.e. not generated) JavaScript files; you can put third-party JavaScript files here if they will not be processed by the Google Closure compiler. Images and CSS should be put into public/images and public/css.

A designer may also want to change the links on the design page. This can be done by editing the public/design.html file and following the conventions in that file.

templates

templates
├── application.html
├── form.html
├── greeting.html
└── toolbar.html

The templates directory contains template HTML files which will become part of the running application. See the Design and templating page for more information about how to use these templates.

src

├── app
│   ├── clj
│   │   └── one
│   │       └── sample
│   │           └── ...
│   ├── cljs
│   │   └── one
│   │       └── sample
│   │           └── ...
│   └── cljs-macros
│       └── one
│           └── sample
│               └── ...
└── leiningen
└── lib
    ├── clj
    │   └── one
    │       └── ...
    └── cljs
        └── one
            ├── browser
            │   └── ...
            └── ...

Source code is split into three directories: app, lib, and leiningen. The app directory is for code that is specific to the application that you are building. Initially, this directory contains code for the sample application. This code should be changed frequently. The lib directory contains library code that is not specific to the current application. The leiningen directory contains the code that implements the lein bootstrap and lein git-deps commands. See Dependencies for more information about how ClojureScript One integrates with Leiningen.

Even though the code in lib is "general purpose" and not specific to the application you are building, it may still need to be changed and should be easy for you to change. When useful changes are made to these libraries please consider contributing them back to ClojureScript One. Once this library code becomes mature, it will be extracted into an external library.

In both the app and lib directories, code is organized into clj, cljs and cljs-macros directories for Clojure, ClojureScript and macros.

test

Test code is located in the test directory. ClojureScript One provides support for testing ClojureScript code and Clojure code from your favorite Clojure testing framework. A few unit-level tests are provided as a starting point for your own testing needs.

Additionally, the project comes with an interesting integration test in the test directory under the one.sample.test.integration namespace. This test uses ClojureScript's Browser-connected REPL and a few utility functions to drive a browser session in much the same way that Selenium operates.

Clone this wiki locally