28faced3ca08 entry-01

Initial commit.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sat, 07 Jul 2012 17:56:01 -0400
parents
children 482b0abcd05e
branches/tags entry-01
files .gitignore .hgignore README.markdown project.clj src/caves/core.clj

Changes

--- /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
--- /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
--- /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.
--- /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)
--- /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))