Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial version

  • Loading branch information...
commit 4ea90643c3b5b7f7495ba8deab1b4451723eecbf 0 parents
@seancorfield authored
5 .gitignore
@@ -0,0 +1,5 @@
+pom.xml
+*jar
+/lib/
+/classes/
+.lein-deps-sum
43 README.md
@@ -0,0 +1,43 @@
+# fw1-template
+
+A Leiningen template for FW/1 (Framework One).
+
+## Usage
+
+### One-Off Setup
+
+For Leiningen 1.x, first install the [newnew plugin](https://github.com/Raynes/lein-newnew):
+
+```
+lein plugin install lein-newnew X.Y.Z
+```
+
+where X.Y.Z is the latest [version from Clojars](http://clojars.org/lein-newnew).
+
+For Leiningen 2.x, the updated 'new' task already supports templates.
+
+Then install fw1-template:
+
+```
+lein plugin install fw1-template 0.0.6
+```
+
+### Creating a New FW/1 Project
+
+To use the template to create a new FW/1 project:
+
+```
+lein new fw1 mywebapp
+```
+
+This will create a new FW/1 project called mywebapp. You should be able to just drop into the folder and start FW/1:
+
+```
+PORT=8888 lein run
+```
+
+## License
+
+Copyright © 2012 FIXME
+
+Distributed under the Eclipse Public License, the same as Clojure.
2  project.clj
@@ -0,0 +1,2 @@
+(defproject fw1-template "0.0.6"
+ :description "FW/1 template for lein newnew")
21 src/leiningen/new/fw1.clj
@@ -0,0 +1,21 @@
+(ns leiningen.new.fw1
+ (:use leiningen.new.templates))
+
+(def render (renderer "fw1"))
+
+(defn fw1
+ "A FW/1 web application template"
+ [name]
+ (let [data {:name name
+ :sanitized (sanitize name)}]
+ (->files data
+ ["README.md" (render "README.md" data)]
+ ["project.clj" (render "project.clj" data)]
+ [".gitignore" (render "gitignore" data)]
+ ["src/{{sanitized}}/main.clj" (render "main.clj" data)]
+ ["src/{{sanitized}}/controllers/main.clj" (render "controller.clj" data)]
+ ["src/{{sanitized}}/layouts/main/default.html" (render "layout.html" data)]
+ ["src/{{sanitized}}/views/main/default.html" (render "view.html" data)]
+ ["src/{{sanitized}}/assets/css/main.css" (render "main.css" data)]
+ "src/{{sanitized}}/assets/js"
+ "src/{{sanitized}}/assets/img")))
17 src/leiningen/new/fw1/README.md
@@ -0,0 +1,17 @@
+# {{name}}
+
+A website written in FW/1 (Framework One).
+
+## Usage
+
+```bash
+lein deps
+lein run
+```
+
+## License
+
+Copyright (C) 2012 FIXME
+
+Distributed under the Eclipse Public License, the same as Clojure.
+
14 src/leiningen/new/fw1/controller.clj
@@ -0,0 +1,14 @@
+(ns {{name}}.controllers.main
+ (:use framework.one))
+
+(defn default "/main/default handler" [rc]
+ rc)
+
+(defn default-view "/main/default view render" [rc nodes]
+ nodes)
+
+(defn default-layout "/main/default layout render" [rc nodes]
+ nodes)
+
+(defn layout "/main section layout render" [rc nodes]
+ nodes)
5 src/leiningen/new/fw1/gitignore
@@ -0,0 +1,5 @@
+pom.xml
+*jar
+/lib/
+/classes/
+.lein-deps-sum
10 src/leiningen/new/fw1/layout.html
@@ -0,0 +1,10 @@
+<html>
+<head>
+<title>FW/1 Skeleton</title>
+<link rel="stylesheet" type="text/css" href="/assets/css/main.css" />
+</head>
+<body>
+<h1>Framework One</h1>
+<div id="body"/>
+<p>Added by the default layout.</p>
+</body>
10 src/leiningen/new/fw1/main.clj
@@ -0,0 +1,10 @@
+(ns {{name}}.main
+ (:require [framework.one :as fw1])
+ (:use [ring.adapter.jetty])
+ (:use [ring.middleware.reload]))
+
+(defn -main[]
+ (let [port (Integer/parseInt (get (System/getenv) "PORT" "8080"))]
+ (run-jetty
+ (fw1/start :application-key "{{name}}")
+ {:port port})))
1  src/leiningen/new/fw1/main.css
@@ -0,0 +1 @@
+h1 { color: green; }
5 src/leiningen/new/fw1/project.clj
@@ -0,0 +1,5 @@
+(defproject {{name}} ".0.1-SNAPSHOT"
+ :description "FIXME: write this!"
+ :dependencies [[org.clojure/clojure "1.3.0"]
+ [framework-one "0.0.6"]]
+ :main {{name}}.main)
2  src/leiningen/new/fw1/view.html
@@ -0,0 +1,2 @@
+<h2>Welcome to FW/1</h2>
+<p>This is the default view in the main section.</p>
Please sign in to comment.
Something went wrong with that request. Please try again.