Skip to content

Commit 1318cec

Browse files
committed
Replaced cljx with cljc. cljs tests are passing but lein test runs no tests.
1 parent 5bd8c4f commit 1318cec

File tree

16 files changed

+225
-299
lines changed

16 files changed

+225
-299
lines changed

project.clj

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,24 @@
77
[org.clojure/clojurescript "0.0-3196"]
88
[org.clojure/core.async "0.1.346.0-17112a-alpha"]]
99
:plugins [[lein-cljsbuild "1.0.5"]
10-
[com.keminglabs/cljx "0.6.0" :exclusions [org.clojure/clojure
11-
com.cemerick/piggieback
12-
net.cgrand/parsley]]
1310
[com.cemerick/clojurescript.test "0.3.3"]]
14-
:jar-exclusions [#"\.cljx"]
15-
:aliases {"repl" ["with-profile" "repl" "repl"]
16-
"clj-test" ["with-profile" "clj" "test"]
17-
"cljs-test" ["do" "cljx" ["cljsbuild" "test"]]
18-
"cljs-autotest" ["do" "cljx" ["cljsbuild" "auto" "test"]]
19-
"all-tests" ["do" "clean" ["clj-test"] ["cljs-test"]]}
11+
:aliases {"cljs-test" ["cljsbuild" "test"]
12+
"cljs-autotest" ["cljsbuild" "auto" "test"]
13+
"all-tests" ["do" "clean" ["test"] ["cljs-test"]]}
2014
:profiles {:dev {:dependencies [[org.clojure/tools.namespace "0.2.10"]
2115
[org.clojure/tools.nrepl "0.2.10"]
2216
[com.cemerick/piggieback "0.2.0"]
2317
[net.cgrand/parsley "0.9.3" :exclusions [org.clojure/clojure]]]
24-
:source-paths ["target/classes"]}
25-
:repl [:dev {:source-paths ["repl" "target/classes" "target/generated/test/clj" "target/generated/test/cljs"]
26-
:test-paths ["target/generated/test/clj" "target/generated/test/cljs"]}]
27-
:clj [:dev {:source-paths ["target/classes"]
28-
:test-paths ["target/generated/test/clj"]}]
29-
:cljs [:dev]}
30-
:prep-tasks [["cljx" "once"] "javac" "compile"]
18+
:source-paths ["src"]}}
19+
:prep-tasks ["javac" "compile"]
3120
:cljsbuild {:test-commands {"phantom" ["phantomjs" :runner "target/testable.js"]
3221
"node" ["node" :node-runner "target/testable.js"]}
3322
:builds [{:id "test"
34-
:source-paths ["target/classes" "target/generated/test/clj" "target/generated/test/cljs"]
23+
:source-paths ["src" "test"]
3524
:notify-command ["phantomjs" :cljs.test/runner "target/testable.js"]
3625
:compiler {:output-to "target/testable.js"
3726
:libs [""]
3827
; node doesn't like source maps I guess?
3928
;:source-map "target/testable.js.map"
4029
:optimizations :simple
41-
:pretty-print true}}]}
42-
:cljx {:builds [{:source-paths ["src/cljx"]
43-
:output-path "target/classes"
44-
:rules :clj}
45-
{:source-paths ["src/cljx"]
46-
:output-path "target/classes"
47-
:rules :cljs}
48-
{:source-paths ["test/cljx"]
49-
:output-path "target/generated/test/clj"
50-
:rules :clj}
51-
{:source-paths ["test/cljx"]
52-
:output-path "target/generated/test/cljs"
53-
:rules :cljs}]})
30+
:pretty-print true}}]})
File renamed without changes.

src/cljx/jamesmacaulay/zelkova/window.cljx

Lines changed: 0 additions & 57 deletions
This file was deleted.

src/cljx/jamesmacaulay/async_tools/core.cljx renamed to src/jamesmacaulay/async_tools/core.cljc

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
#+clj
21
(ns jamesmacaulay.async-tools.core
32
(:refer-clojure :exclude [concat])
4-
(:require [clojure.core.async :as async :refer [go go-loop >! <! chan]]
5-
[clojure.core.async.impl.protocols :as impl]
6-
[clojure.core.async.impl.channels :as channels]))
7-
8-
#+cljs
9-
(ns jamesmacaulay.async-tools.core
10-
(:refer-clojure :exclude [concat])
11-
(:require [cljs.core.async :as async :refer [>! <! chan]]
12-
[cljs.core.async.impl.protocols :as impl]
13-
[cljs.core.async.impl.channels :as channels])
14-
(:require-macros [cljs.core.async.macros :refer [go go-loop]]))
3+
#?(:cljs (:require [cljs.core.async :as async :refer [>! <! chan]]
4+
[cljs.core.async.impl.protocols :as impl]
5+
[cljs.core.async.impl.channels :as channels])
6+
:clj (:require [clojure.core.async :as async :refer [go go-loop >! <! chan]]
7+
[clojure.core.async.impl.protocols :as impl]
8+
[clojure.core.async.impl.channels :as channels]))
9+
#?(:cljs (:require-macros [cljs.core.async.macros :refer [go go-loop]])))
1510

1611
(defn concat
1712
[& chs]

src/cljx/jamesmacaulay/async_tools/test.cljx renamed to src/jamesmacaulay/async_tools/test.clj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
(ns jamesmacaulay.async-tools.test
22
(:require [jamesmacaulay.async-tools.core :as tools]
33
[cemerick.cljs.test]
4-
#+clj [clojure.test]))
4+
[clojure.test]))
55

6-
#+clj
76
(defmacro deftest-async
87
[name & body]
98
(let [deftest-sym (if (:ns &env)

src/cljx/jamesmacaulay/zelkova/impl/signal.cljx renamed to src/jamesmacaulay/zelkova/impl/signal.cljc

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
(ns jamesmacaulay.zelkova.impl.signal
22
"Implementation details for `jamesmacaulay.zelkova.signal`."
3-
#+clj
4-
(:require [jamesmacaulay.async-tools.core :as tools]
5-
[jamesmacaulay.zelkova.impl.time :as time]
6-
[clojure.zip :as zip]
7-
[clojure.set]
8-
[alandipert.kahn :as kahn]
9-
[clojure.core.async :as async :refer [go go-loop <! >!]]
10-
[clojure.core.async.impl.protocols :as async-impl])
11-
#+cljs
12-
(:require [jamesmacaulay.async-tools.core :as tools]
13-
[jamesmacaulay.zelkova.impl.time :as time]
14-
[clojure.zip :as zip]
15-
[clojure.set]
16-
[alandipert.kahn :as kahn]
17-
[cljs.core.async :as async :refer [<! >!]]
18-
[cljs.core.async.impl.protocols :as async-impl])
19-
#+cljs
20-
(:require-macros [cljs.core.async.macros :refer [go go-loop]]))
3+
#?(:cljs (:require [jamesmacaulay.async-tools.core :as tools]
4+
[jamesmacaulay.zelkova.impl.time :as time]
5+
[clojure.zip :as zip]
6+
[clojure.set]
7+
[alandipert.kahn :as kahn]
8+
[cljs.core.async :as async :refer [<! >!]]
9+
[cljs.core.async.impl.protocols :as async-impl])
10+
11+
:clj (:require [jamesmacaulay.async-tools.core :as tools]
12+
[jamesmacaulay.zelkova.impl.time :as time]
13+
[clojure.zip :as zip]
14+
[clojure.set]
15+
[alandipert.kahn :as kahn]
16+
[clojure.core.async :as async :refer [go go-loop <! >!]]
17+
[clojure.core.async.impl.protocols :as async-impl]))
18+
#?(:cljs (:require-macros [cljs.core.async.macros :refer [go go-loop]])))
2119

2220
(defprotocol BoxedValueProtocol
2321
(value [boxed]))
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
(ns jamesmacaulay.zelkova.impl.time
22
"Implementation details for `jamesmacaulay.zelkova.time`.")
33

4-
#+clj
5-
(defn now [] (System/currentTimeMillis))
6-
#+cljs
7-
(defn now [] (.valueOf (js/Date.)))
4+
(defn now []
5+
#?(:clj (System/currentTimeMillis)
6+
:cljs (.valueOf (js/Date.))))

src/cljx/jamesmacaulay/zelkova/keyboard.cljx renamed to src/jamesmacaulay/zelkova/keyboard.cljc

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,34 @@
11
(ns jamesmacaulay.zelkova.keyboard
22
"This namespace provides keyboard-related signals."
33
(:refer-clojure :exclude [meta])
4-
#+clj
5-
(:require [jamesmacaulay.zelkova.signal :as z]
6-
[clojure.core.async :as async])
7-
#+cljs
8-
(:require [jamesmacaulay.zelkova.signal :as z]
9-
[goog.events :as events]
10-
[cljs.core.async :as async :refer [>! <!]])
11-
#+cljs
12-
(:require-macros [cljs.core.async.macros :refer [go go-loop]]))
13-
14-
#+cljs
15-
(defn- listen
16-
[el type & args]
17-
(let [out (apply async/chan 1 args)]
18-
(events/listen el type (fn [e] (async/put! out e)))
19-
out))
4+
#?(:clj (:require [jamesmacaulay.zelkova.signal :as z]
5+
[clojure.core.async :as async])
6+
:cljs (:require [jamesmacaulay.zelkova.signal :as z]
7+
[goog.events :as events]
8+
[cljs.core.async :as async :refer [>! <!]]))
9+
#?(:cljs (:require-macros [cljs.core.async.macros :refer [go go-loop]])))
10+
11+
#?(:cljs
12+
(defn- listen
13+
[el type & args]
14+
(let [out (apply async/chan 1 args)]
15+
(events/listen el type (fn [e] (async/put! out e)))
16+
out)))
2017

2118
(defn- keydown-channel
2219
[graph opts]
23-
#+cljs
24-
(listen js/document "keydown")
25-
#+clj
26-
(async/chan))
20+
#?(:cljs (listen js/document "keydown")
21+
:clj (async/chan)))
2722

2823
(defn- keyup-channel
2924
[graph opts]
30-
#+cljs
31-
(listen js/document "keyup")
32-
#+clj
33-
(async/chan))
25+
#?(:cljs (listen js/document "keyup")
26+
:clj (async/chan)))
3427

3528
(defn- blur-channel
3629
[graph opts]
37-
#+cljs
38-
(listen js/window "blur")
39-
#+clj
40-
(async/chan))
30+
#?(:cljs (listen js/window "blur")
31+
:clj (async/chan)))
4132

4233
(def ^:private down-events
4334
(z/input 0 ::down-events keydown-channel))
@@ -141,7 +132,7 @@ depressed."}
141132
enter
142133
(down? 13))
143134

144-
#+cljs
145-
(def ^{:doc "A signal of the code of the last pressed key."}
146-
last-pressed
147-
(z/map #(.-keyCode %) down-events))
135+
#?(:cljs
136+
(def ^{:doc "A signal of the code of the last pressed key."}
137+
last-pressed
138+
(z/map #(.-keyCode %) down-events)))

src/cljx/jamesmacaulay/zelkova/mouse.cljx renamed to src/jamesmacaulay/zelkova/mouse.cljs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,51 @@
11
(ns jamesmacaulay.zelkova.mouse
22
"This namespace provides keyboard-related signals."
3-
#+cljs
3+
(:require-macros [cljs.core.async.macros :refer [go go-loop]])
44
(:require [jamesmacaulay.zelkova.signal :as z]
55
[goog.events :as events]
6-
[cljs.core.async :as async :refer [>! <!]])
7-
#+cljs
8-
(:require-macros [cljs.core.async.macros :refer [go go-loop]]))
6+
[cljs.core.async :as async :refer [>! <!]]))
97

10-
#+cljs
118
(defn- listen
129
[el type & args]
1310
(let [out (apply async/chan 1 args)]
1411
(events/listen el type (fn [e] (async/put! out e)))
1512
out))
1613

17-
#+cljs
1814
(defn- position-channel
1915
[graph opts]
2016
(listen js/document
2117
"mousemove"
2218
(map (fn [e] [(.-pageX (.-event_ e)) (.-pageY (.-event_ e))]))))
2319

24-
#+cljs
2520
(def ^{:doc "A signal of mouse positions as `[x y]` vectors. Initial value is `[0 0]`."}
2621
position
2722
(z/input [0 0] ::position position-channel))
2823

29-
#+cljs
3024
(def ^{:doc "A signal of mouse x-coordinates. Initial value is 0."}
3125
x
3226
(z/map first position))
3327

34-
#+cljs
3528
(def ^{:doc "A signal of mouse y-coordinates. Initial value is 0."}
3629
y
3730
(z/map second position))
3831

39-
#+cljs
4032
(defn- clicks-channel
4133
[graph opts]
4234
(listen js/document
4335
"click"
4436
(map (constantly :click))))
4537

46-
#+cljs
4738
(def ^{:doc "A signal which is updated every time the mouse is clicked. The
4839
value of the signal is always the keyword `:click`."}
4940
clicks
5041
(z/input :click ::clicks clicks-channel))
5142

52-
#+cljs
5343
(defn- down?-channel
5444
[graph opts]
5545
(let [down-events (listen js/document "mousedown" (map (constantly true)))
5646
up-events (listen js/document "mouseup" (map (constantly false)))]
5747
(async/merge [down-events up-events])))
5848

59-
#+cljs
6049
(def ^{:doc "A signal of boolean values, true when the primary mouse button is
6150
depressed."}
6251
down?

src/cljx/jamesmacaulay/zelkova/signal.cljx renamed to src/jamesmacaulay/zelkova/signal.cljc

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
(ns jamesmacaulay.zelkova.signal
22
"This is Zelkova's core namespace."
33
(:refer-clojure :exclude [map merge count reductions])
4-
#+clj
5-
(:require [clojure.core :as core]
6-
[clojure.core.async :as async :refer [go go-loop <! >!]]
7-
[clojure.core.async.impl.protocols :as async-impl]
8-
[jamesmacaulay.zelkova.impl.signal :as impl])
9-
#+cljs
10-
(:require [cljs.core :as core]
11-
[cljs.core.async :as async :refer [<! >!]]
12-
[cljs.core.async.impl.protocols :as async-impl]
13-
[jamesmacaulay.zelkova.impl.signal :as impl])
14-
#+cljs
15-
(:require-macros [cljs.core.async.macros :refer [go go-loop]]))
4+
#?(:clj (:require [clojure.core :as core]
5+
[clojure.core.async :as async :refer [go go-loop <! >!]]
6+
[clojure.core.async.impl.protocols :as async-impl]
7+
[jamesmacaulay.zelkova.impl.signal :as impl])
8+
:cljs (:require [cljs.core :as core]
9+
[cljs.core.async :as async :refer [<! >!]]
10+
[cljs.core.async.impl.protocols :as async-impl]
11+
[jamesmacaulay.zelkova.impl.signal :as impl]))
12+
#?(:cljs (:require-macros [cljs.core.async.macros :refer [go go-loop]])))
1613

1714
(defn input
1815
"Returns an input signal with initial value `init`. The signal propagates values

0 commit comments

Comments
 (0)