# HG changeset patch # User Steve Losh # Date 1341698161 14400 # Node ID 28faced3ca080c1e8038e84ddbdca83f31717bd6 Initial commit. diff -r 000000000000 -r 28faced3ca08 .gitignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.gitignore Sat Jul 07 17:56:01 2012 -0400 @@ -0,0 +1,10 @@ +/target +/lib +/classes +/checkouts +pom.xml +*.jar +*.class +.lein-deps-sum +.lein-failures +.lein-plugins diff -r 000000000000 -r 28faced3ca08 .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Sat Jul 07 17:56:01 2012 -0400 @@ -0,0 +1,11 @@ +syntax:glob +target/ +lib/ +classes/ +checkouts/ +pom.xml +*.jar +*.class +.lein-deps-sum +.lein-failures +.lein-plugins diff -r 000000000000 -r 28faced3ca08 README.markdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.markdown Sat Jul 07 17:56:01 2012 -0400 @@ -0,0 +1,30 @@ +# The Caves of Clojure + +The code for my [Caves of Clojure][caves] series of blog posts. + +[caves]: http://stevelosh.com/blog/ + +## Usage + +Clone the repo. + +Run `lein deps` to pull down deps. + +Follow along with the entries by using tags: + + hg update entry-06 + git checkout entry-06o + +That will put you at the code as it stood right at the *end* of entry number +six, so you can see how it all works together. + +You can run the program by running `lein trampoline run` twice. No, I don't +know why you need to do it twice -- you just do. + +You can also just load it up in your Swank/Eclipse/whatever setup. + +## License + +Copyright 2012 Steve Losh + +Distributed under the MIT/X11 License. diff -r 000000000000 -r 28faced3ca08 project.clj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project.clj Sat Jul 07 17:56:01 2012 -0400 @@ -0,0 +1,7 @@ +(defproject caves "0.1.0-SNAPSHOT" + :description "The Caves of Clojure" + :url "http://stevelosh.com/blog/2012/07/caves-of-clojure-01/" + :license {:name "MIT/X11"} + :dependencies [[org.clojure/clojure "1.4.0"] + [clojure-lanterna "0.9.0"]] + :main caves.core) diff -r 000000000000 -r 28faced3ca08 src/caves/core.clj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/caves/core.clj Sat Jul 07 17:56:01 2012 -0400 @@ -0,0 +1,23 @@ +(ns caves.core + (:require [lanterna.screen :as s])) + + +(defn main [screen-type] + (let [screen (s/get-screen screen-type)] + (s/in-screen screen + (s/put-string screen 0 0 "Welcome to the Caves of Clojure!") + (s/put-string screen 0 1 "Press any key to exit...") + (s/redraw screen) + (s/get-key-blocking screen)))) + + +(defn -main [& args] + (let [args (set args) + screen-type (cond + (args ":swing") :swing + (args ":text") :text + :else :auto)] + (main screen-type))) + +(comment + (main :swing))