Permalink
Browse files

Update VREPL dependencies and README.

  • Loading branch information...
1 parent b421305 commit 4d7c5730a7164cbf14b5c070b77e1d7779f4cbbd @lynaghk committed May 4, 2012
Showing with 18 additions and 15 deletions.
  1. +3 −3 vrepl/README.markdown
  2. +6 −6 vrepl/project.clj
  3. +1 −2 vrepl/src/vrepl/core.clj
  4. +8 −4 vrepl/src/vrepl/main.clj
@@ -3,16 +3,16 @@ C2 Visual REPL
Render your Clojure visualizations as you write 'em.
-To start:
+To start from this git repo:
lein run --port 8987 --path resources/samples/
Serves up the final form of the most recently changed file in `resources/samples/` and automatically refreshes your browser.
If you don't have Leiningen installed, you can download the pre-built JAR file:
- wget http://keminglabs.com/c2/c2-starter.jar
- java -jar c2-starter.jar --extract
+ wget http://keminglabs.com/c2/vrepl-1.1.0-standalone.jar
+ java -jar vrepl-1.1.0-standalone.jar --extract
which will extract pre-built sample visualizations to the default `samples/` directory and start watching.
Change any files in there (or add a new ones) to update the web server visualization.
View
@@ -1,14 +1,14 @@
-(defproject vrepl "1.0.0-SNAPSHOT"
- :description "FIXME: write description"
+(defproject vrepl "1.1.0"
+ :description "Standalone C2 Visual REPL / webserver."
:dependencies [[org.clojure/clojure "1.3.0"]
[org.clojure/data.json "0.1.2"]
[org.clojure/tools.cli "0.2.1"]
[org.apache.commons/commons-vfs2 "2.0"]
[compojure "1.0.1"]
- [hiccup "0.3.8"]
- [aleph "0.2.1-alpha2-SNAPSHOT"]
+ [hiccup "1.0.0"]
+ [aleph "0.2.1-beta2"]
[com.keminglabs/vomnibus "0.1.0"]
- [com.keminglabs/c2 "0.0.1-SNAPSHOT"]]
-
+ [com.keminglabs/c2 "0.1.0-beta2"]]
+ :min-lein-version "2.0.0"
:main vrepl.main)
@@ -1,13 +1,12 @@
(ns vrepl.core
- (:gen-class)
(:import org.apache.commons.vfs2.VFS
org.apache.commons.vfs2.impl.DefaultFileMonitor
org.apache.commons.vfs2.FileListener)
(:require [clojure.string :as str])
(:use [hiccup.core :only [html]]))
(def opts (atom {}))
-(def current-page (atom [:h1 "Visual REPL ready."]))
+(def current-page (atom [:div]))
(defn output-clj!
"Output result of freshly reloaded Clojure file"
@@ -8,7 +8,7 @@
(println "Extracting assets to" path)
(when (not (.exists (java.io.File. path)))
- (.mkdir (java.io.File. path)))
+ (.mkdirs (java.io.File. path)))
;;Hardcoded list of sample files in the JAR to extract.
;;Pull request if you want to write something more general.
@@ -28,7 +28,7 @@
["--compile-all" "Compile all files to HTML" :default false :flag true]
["--extract" "Extract built-in samples directory before starting watcher" :default false :flag true]
["--path" "Path to watch (recursive)"
- :default (str (System/getProperty "user.dir") "/" "resources/samples")
+ :default (str (System/getProperty "user.dir") "/" "samples")
:parse-fn #(str (System/getProperty "user.dir") "/" %)]
["--port" "Webserver port" :default 8987 :parse-fn #(Integer. %)])]
@@ -42,11 +42,15 @@
(core/compile-all! path)
(System/exit 0))
- (when (:extract opts)
- (extract-assets! path))
+ (if (:extract opts)
+ (extract-assets! path)
+ (println "Run with --extract flag to extract sample files."))
(when (not (.exists (java.io.File. path)))
(println "Path" (str "\"" path "\"") "not found")
(System/exit 1))
+
+ (reset! core/current-page [:div [:h1 "Visual REPL ready."]
+ [:span "Monitoring: " path]])
(monitor-and-start path port)))

0 comments on commit 4d7c573

Please sign in to comment.