Permalink
Browse files

Initial commit. :)

  • Loading branch information...
0 parents commit b2b6d1d6cb5407fe4b77512f7bc690b2d66cdfba @Raynes committed May 8, 2010
Showing with 98 additions and 0 deletions.
  1. +4 −0 .gitignore
  2. +15 −0 README
  3. +12 −0 project.clj
  4. +27 −0 resources/public/css/tryclojure.css
  5. +34 −0 src/tryclojure/core.clj
  6. +6 −0 test/tryclojure/core_test.clj
@@ -0,0 +1,4 @@
+pom.xml
+*jar
+lib
+classes
15 README
@@ -0,0 +1,15 @@
+# tryclojure
+
+FIXME: write description
+
+## Usage
+
+FIXME: write
+
+## Installation
+
+FIXME: write
+
+## License
+
+FIXME: write
@@ -0,0 +1,12 @@
+(defproject tryclojure "0.1.0-SNAPSHOT"
+ :description "A simple web-based Clojure REPL for trying out Clojure without having to install it."
+ :dependencies [[org.clojure/clojure "1.1.0"]
+ [org.clojure/clojure-contrib "1.1.0"]
+ [net.cgrand/moustache "1.0.0-SNAPSHOT"]
+ [ring/ring-jetty-adapter "0.2.0"]
+ [clj-sandbox "0.3.4"]
+ [hiccup "0.2.3"]]
+ :dev-dependencies [[swank-clojure "1.2.0-SNAPSHOT"]
+ [leiningen/lein-swank "1.1.0"]
+ [lein-search "0.3.0-SNAPSHOT"]
+ [ring/ring-devel "0.2.0"]])
@@ -0,0 +1,27 @@
+body
+{
+ text-align:center;
+ background-color:#071019;
+}
+p
+{
+ font-family:\"Times New Roman\";
+ font-size:20px;
+}
+h1
+{
+ color:#19A3A3;
+}
+div.scroll
+{
+ text-align:left;
+ height:300px;
+ width:800px;
+ word-wrap: break-word;
+ margin-left:auto;
+ margin-right:auto;
+ overflow-x:auto;
+ border: 1px solid #666;
+ background-color: #FFFFFF;
+ padding: 8px;
+}
@@ -0,0 +1,34 @@
+(ns tryclojure.core
+ (:use ring.adapter.jetty
+ [hiccup core form-helpers page-helpers]
+ [ring.middleware reload stacktrace params file]
+ net.cgrand.moustache))
+
+(defn fire-html [text]
+ (html
+ (:html5 doctype)
+ (include-css "/resources/public/css/tryclojure.css")
+ [:head
+ [:title "TryClojure"]]
+ [:body
+ [:h1 "Welcome to TryClojure!"]
+ [:div.scroll text]
+ (form-to [:post "/"]
+ [:input {:name "code" :size 99}]
+ [:p]
+ (submit-button "Make Magic Happen"))]))
+
+(defn handler [{fparams :form-params}]
+ {:status 200
+ :headers {"Content-Type" "text/html"}
+ :body (fire-html (fparams "code"))})
+
+(def clojureroutes
+ (app
+ (wrap-reload '(tryclojure.core))
+ (wrap-file (System/getProperty "user.dir"))
+ (wrap-params)
+ (wrap-stacktrace)
+ [""] handler))
+
+(defn tryclj [] (run-jetty #'clojureroutes {:port 8081}))
@@ -0,0 +1,6 @@
+(ns tryclojure.core-test
+ (:use [tryclojure.core] :reload-all)
+ (:use [clojure.test]))
+
+(deftest replace-me ;; FIXME: write
+ (is false))

0 comments on commit b2b6d1d

Please sign in to comment.