Permalink
Browse files

Initial commit; nothing to see here, move along.

  • Loading branch information...
0 parents commit 2fcb89fd80e4e6ef46c255fda505da0f4f1ae8e0 @budu committed Mar 31, 2012
Showing with 91 additions and 0 deletions.
  1. +8 −0 .gitignore
  2. +15 −0 project.clj
  3. +13 −0 readme.md
  4. +45 −0 src/clj/board/core.clj
  5. +4 −0 src/cljs/board/core.cljs
  6. +6 −0 test/board/test/core.clj
@@ -0,0 +1,8 @@
+/pom.xml
+*jar
+/lib
+/classes
+/native
+/checkouts
+/.lein*
+/resources/public/js/app.js
@@ -0,0 +1,15 @@
+(defproject board "0.1.0-SNAPSHOT"
+ :description "Experimental drawing board"
+ :dependencies [[org.clojure/clojure "1.3.0"]
+ [aleph "0.2.1-SNAPSHOT"]
+ [ring "1.1.0-beta2"]
+ [hiccup "1.0.0-beta1"]
+ [org.clojure/clojurescript "0.0-993"]]
+ :source-path "src/clj"
+ :extra-classpath-dirs ["src/cljs"]
+ :plugins [[lein-cljsbuild "0.1.4"]]
+ :cljsbuild {:builds
+ [{:source-path "src/cljs"
+ :compiler {:output-to "resources/public/js/app.js"
+ :optimizations :advanced}}]}
+ :ring {:handler board.core/app})
@@ -0,0 +1,13 @@
+# Board
+
+Experimental drawing board.
+
+## Usage
+
+FIXME: write
+
+## License
+
+Copyright (C) 2012 Nicolas Buduroi
+
+Distributed under the Eclipse Public License, the same as Clojure.
@@ -0,0 +1,45 @@
+(ns board.core
+ (:use (lamina [core :only [enqueue]])
+ aleph.http
+ (ring.middleware resource file-info)
+ (hiccup core page)))
+
+(defn page []
+ (html5
+ [:head]
+ [:body
+ [:p "OK"]
+ (include-js "/js/app.js")]))
+
+(defn sync-app [request]
+ {:status 200
+ :headers {"content-type" "text/html"}
+ :body (page)})
+
+(def wrapped-sync-app
+ (-> sync-app
+ (wrap-resource "public")
+ (wrap-file-info)))
+
+(defn app [channel request]
+ (if (:websocket request)
+ nil ;; TODO: fun stuff
+ (enqueue channel (wrapped-sync-app request))))
+
+(defonce stopper (atom nil))
+
+(defn start []
+ (when-not @stopper
+ (reset! stopper
+ (start-http-server app
+ {:port 8080
+ :websocket true}))))
+
+(defn stop []
+ (when @stopper
+ (@stopper)
+ (reset! stopper nil)))
+
+(defn restart []
+ (stop)
+ (start))
@@ -0,0 +1,4 @@
+(ns board.core)
+
+(defn ^:export greet [name]
+ (str "Hello " name))
@@ -0,0 +1,6 @@
+(ns board.test.core
+ (:use [board.core])
+ (:use [clojure.test]))
+
+(deftest replace-me ;; FIXME: write
+ (is false "No tests have been written."))

0 comments on commit 2fcb89f

Please sign in to comment.