Permalink
Browse files

removing lein ring plugin abstraction layer, adding loop timer to mai…

…n process
  • Loading branch information...
1 parent 377511b commit 9a3f0d36868a958fa1c3600efaf51da00fb04068 @eggsby committed Apr 17, 2012
Showing with 24 additions and 4 deletions.
  1. +5 −3 project.clj
  2. +19 −1 src/circle_eater/core.clj
View
@@ -1,9 +1,11 @@
(defproject circle-eater "0.0.1"
:description "A project which generate, consumes, and logs random json data"
:dependencies [[org.clojure/clojure "1.3.0"]
+ [ring/ring-core "1.0.0"]
+ [ring/ring-jetty-adapter "1.0.0"]
[cheshire "4.0.0"]
[compojure "1.0.1"]
[clj-http "0.3.6"]
- [amon-log "0.1.0"]]
- :plugins [[lein-ring "0.6.3"]]
- :ring {:handler circle-eater.core/app})
+ [amon-log "0.1.1"]]
+; :plugins [[lein-ring "0.6.3"]]
+ :main circle-eater.core)
View
@@ -1,7 +1,9 @@
(ns circle-eater.core
(:use compojure.core)
+ (:use ring.adapter.jetty)
(:require [circle-eater.views :as views]
- [compojure.handler :as handler]))
+ [compojure.handler :as handler])
+ (:gen-class))
(defroutes circle-routes
views/home
@@ -11,3 +13,19 @@
(def app
(handler/site circle-routes))
+
+(defn loop-with-timer
+ [f wait]
+ (while true
+ (do (f) (Thread/sleep wait))))
+
+(defn print-date [wait]
+ (loop-with-timer #(println (java.util.Date.)) wait))
+
+; TODO: write an actual populate implementation
+(def populate #(print-date 1000))
+
+(defn -main [& args]
+ (do
+ (run-jetty app {:port 4000 :join? false})
+ (populate)))

0 comments on commit 9a3f0d3

Please sign in to comment.