Initial commit

This commit is contained in:
Nicholas Kariniemi 2013-07-24 20:39:02 +03:00
commit 77c8d55a31
8 changed files with 21781 additions and 0 deletions

12
.gitignore vendored Normal file
View file

@ -0,0 +1,12 @@
/target
/lib
/classes
/checkouts
pom.xml
pom.xml.asc
*.jar
*.class
.lein-deps-sum
.lein-failures
.lein-plugins
.lein-repl-history

13
README.md Normal file
View file

@ -0,0 +1,13 @@
# grub
A Clojure library designed to ... well, that part is up to you.
## Usage
FIXME
## License
Copyright © 2013 FIXME
Distributed under the Eclipse Public License, the same as Clojure.

3
doc/intro.md Normal file
View file

@ -0,0 +1,3 @@
# Introduction to grub
TODO: write [great documentation](http://jacobian.org/writing/great-documentation/what-to-write/)

24
project.clj Normal file
View file

@ -0,0 +1,24 @@
(defproject grub "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:source-paths ["src-clj"]
:dependencies [[org.clojure/clojure "1.5.1"]
[http-kit "2.1.5"]
[compojure "1.1.5"]
[ring/ring-devel "1.2.0"]
[ring/ring-core "1.2.0"]]
:plugins [[lein-cljsbuild "0.3.2"]
[lein-ring "0.8.6"]]
:cljsbuild {
:builds [{
; The path to the top-level ClojureScript source directory:
:source-paths ["src-cljs"]
; The standard ClojureScript compiler options:
; (See the ClojureScript compiler documentation for details.)
:compiler {
:output-to "public/js/main.js" ; default: target/cljsbuild-main.js
:optimizations :whitespace
:pretty-print true}}]}
:ring {:handler grub.core/async-handler})

21688
public/js/main.js Normal file

File diff suppressed because it is too large Load diff

31
src-clj/grub/core.clj Normal file
View file

@ -0,0 +1,31 @@
(ns grub.core
(:use [org.httpkit.server :only [run-server]])
(:require [ring.middleware.reload :as reload]
[compojure.handler :only [site]]
[compojure.core :only [defroutes GET POST]]))
(defroutes routes
(GET "/" [] "handling-page")
(GET "/save" [] handler) ;; websocket
(route/not-found "<p>Page not found.</p>")) ;; all other, return 404
(defn -main [& args] ;; entry point, lein run will pick up and start from here
(let [handler (if (in-dev? args)
(reload/wrap-reload (site #'routes)) ;; only reload when dev
(site routes))]
(run-server handler {:port 8080})))
(comment
(defn async-handler [ring-request]
(with-channel ring-request channel
(if (websocket? channel)
(println "WebSocket channel")
(println "HTTP channel"))
(on-receive channel (fn [data]
(send! channel data)))
(send! channel {:status 200
:headers {"Content-Type" "text/plain"}
:body "Long polling?"})))
(run-server async-handler {:port 8080})
)

View file

@ -0,0 +1,3 @@
(ns grub-client.core)
(js/alert "Hello from ClojureScript!")

7
test/grub/core_test.clj Normal file
View file

@ -0,0 +1,7 @@
(ns grub.core-test
(:use clojure.test
grub.core))
(deftest a-test
(testing "FIXME, I fail."
(is (= 0 1))))