Skip to content

Commit

Permalink
Initial commit. :)
Browse files Browse the repository at this point in the history
  • Loading branch information
Raynes committed May 8, 2010
0 parents commit b2b6d1d
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pom.xml
*jar
lib
classes
15 changes: 15 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# tryclojure

FIXME: write description

## Usage

FIXME: write

## Installation

FIXME: write

## License

FIXME: write
12 changes: 12 additions & 0 deletions project.clj
Original file line number Diff line number Diff line change
@@ -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"]])
27 changes: 27 additions & 0 deletions resources/public/css/tryclojure.css
Original file line number Diff line number Diff line change
@@ -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;
}
34 changes: 34 additions & 0 deletions src/tryclojure/core.clj
Original file line number Diff line number Diff line change
@@ -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}))
6 changes: 6 additions & 0 deletions test/tryclojure/core_test.clj
Original file line number Diff line number Diff line change
@@ -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.