Skip to content
Browse files

Move all string manipulation to use clojure-1.3 built-ins. Drop the d…

…ependency on contrib
  • Loading branch information...
1 parent 63c6e39 commit ccde1a0ed4b9419c9253cb6cfab2e290d32135e7 @arohner committed
Showing with 11 additions and 11 deletions.
  1. +2 −3 project.clj
  2. +7 −6 src/com/reasonr/scriptjure.clj
  3. +2 −2 test/test_scriptjure.clj
View
5 project.clj
@@ -1,5 +1,4 @@
-(defproject scriptjure "0.1.20"
+(defproject scriptjure "0.1.21"
:description "a clojure DSL for generating javascript"
:url "http://github.com/arohner/scriptjure"
- :dependencies [[org.clojure/clojure "1.2.0"]
- [org.clojure/clojure-contrib "1.2.0"]])
+ :dependencies [[org.clojure/clojure "1.2.0"]])
View
13 src/com/reasonr/scriptjure.clj
@@ -28,10 +28,11 @@
:doc "A library for generating javascript from Clojure."}
com.reasonr.scriptjure
(:require [clojure.string :as str])
- (:require [clojure.contrib.string :as cstr])
- (:use [clojure.contrib.except :only (throwf)])
+ (:require [com.reasonr.string :as rstr])
(:use clojure.walk))
+(defn throwf [& message]
+ (throw (Exception. (apply format message))))
(defmulti emit (fn [ expr ] (type expr)))
(defmulti emit-special (fn [ & args] (first args)))
@@ -39,7 +40,7 @@
(def statement-separator ";\n")
(defn statement [expr]
- (if (not (= statement-separator (cstr/tail (count statement-separator) expr)))
+ (if (not (= statement-separator (rstr/tail (count statement-separator) expr)))
(str expr statement-separator)
expr))
@@ -155,7 +156,7 @@
" }"))))
(defmethod emit-special 'dot-method [type [method obj & args]]
- (let [method (symbol (cstr/drop 1 (str method)))]
+ (let [method (symbol (rstr/drop 1 (str method)))]
(emit-method obj method args)))
(defmethod emit-special 'return [type [return expr]]
@@ -254,10 +255,10 @@
(let [head (symbol (name (first expr))) ; remove any ns resolution
expr (conj (rest expr) head)]
(cond
- (and (= (cstr/get (str head) 0) \.)
+ (and (= (rstr/get (str head) 0) \.)
(> (count (str head)) 1)
- (not (= (cstr/get (str head) 1) \.))) (emit-special 'dot-method expr)
+ (not (= (rstr/get (str head) 1) \.))) (emit-special 'dot-method expr)
(special-form? head) (emit-special head expr)
(infix-operator? head) (emit-infix head expr)
(prefix-unary? head) (emit-prefix-unary head expr)
View
4 test/test_scriptjure.clj
@@ -1,7 +1,7 @@
(ns test-scriptjure
(:use clojure.test)
- (:use com.reasonr.scriptjure)
- (:require [clojure.contrib.str-utils2 :as str]))
+ (:require [clojure.string :as str])
+ (:use com.reasonr.scriptjure))
(defn strip-whitespace
"strip extraneous whitespace so tests don't fail because of differences in whitespace"

0 comments on commit ccde1a0

Please sign in to comment.
Something went wrong with that request. Please try again.