Skip to content

Commit

Permalink
More manual test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ajoberstar committed Jun 26, 2018
1 parent 08fd599 commit fcf5bf3
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 8 deletions.
52 changes: 45 additions & 7 deletions manual-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,16 @@ repositories {
}

dependencies {
// clojure
implementation 'org.clojure:clojure:1.10.0-alpha4'
implementation 'org.clojure:clojurescript:1.10.238'
implementation 'org.clojure:clojurescript:1.10.339'

// testing
testImplementation 'junit:junit:4.12'

// frontend
implementation 'org.omcljs:om:1.0.0-beta4'
devImplementation 'devcards:devcards:0.2.5'
}

clojureRepl {
Expand All @@ -34,21 +41,52 @@ clojurescript {
builds {
all {
compiler {
outputTo = 'public/js/main.js'
outputDir = 'public/js/out'
assetPath = 'js/out'
main = 'sample.main'
outputDir = "public/js/${name}-out"
assetPath = "js/${name}-out"
}
}
main {
compiler {
outputTo = 'public/js/main.js'
sourceMap = 'public/js/main.js.map'
optimizations = 'advanced'
sourceMap = 'js/main.js.map'
main = 'sample.main'
}
}
dev {
compiler {
preloads = ['sample.dev']
outputTo = 'public/js/main.js'
main = 'sample.main'
preloads = ['sample.dev', 'devtools.preload']
}
}
cards {
sourceSet.set(sourceSets.dev)
compiler {
preloads = ['sample.dev', 'devtools.preload']
outputTo = 'public/js/cards.js'
main = 'sample.cards'
devcards = true
}
}
mods {
sourceSet.set(sourceSets.dev)
compiler {
preloads = ['sample.dev', 'devtools.preload']
devcards = true
module('main') {
outputTo = 'public/js/main.js'
entries = ['sample.main']
dependsOn = ['cljs-base']
}
module('cards') {
outputTo = 'public/js/cards.js'
entries = ['sample.cards']
dependsOn = ['cljs-base']
}
}
figwheel {
openUrl = 'http://localhost:9500/mods-index.html'
}
}
}
Expand Down
15 changes: 15 additions & 0 deletions manual-test/src/dev/clojurescript/sample/cards.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(ns sample.cards
(:require [devcards.core :as dc :refer-macros [defcard start-devcard-ui!]]
[om.dom :as dom]))

(start-devcard-ui!)


(defcard main-doc
"## This is the best!
ClojureScript! Parens!
")

(defcard more-doc
(dom/p nil "Stuff"))
15 changes: 15 additions & 0 deletions manual-test/src/dev/resources/public/cards.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8">

<title>Gradle Clojure DevCards</title>
</head>

<body>
<div id="app"></div>
<script src="js/cards.js"></script>
</body>

</html>
16 changes: 16 additions & 0 deletions manual-test/src/dev/resources/public/mods-cards.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8">

<title>Gradle Clojure Mods DevCards</title>
</head>

<body>
<div id="app"></div>
<script src="js/mods-out/cljs_base.js"></script>
<script src="js/cards.js"></script>
</body>

</html>
5 changes: 4 additions & 1 deletion manual-test/src/main/clojurescript/sample/main.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
(defn work! []
(let [header (.createElement js/document "h1")
body (.-body js/document)]
(set! (.-innerText header) (str "Now! 1 + 2 is " (add 1 2)))
(set! (.-innerText header) (str "Now! 2 + 2 is " (add 2 2)))
(.appendChild body header)))

(work!)
(work!)
15 changes: 15 additions & 0 deletions manual-test/src/main/resources/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8">

<title>Gradle Clojure Main</title>
</head>

<body>
<div id="app"></div>
<script src="js/main.js"></script>
</body>

</html>
16 changes: 16 additions & 0 deletions manual-test/src/main/resources/public/mods-index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8">

<title>Gradle Clojure Mods Main</title>
</head>

<body>
<div id="app"></div>
<script src="js/mods-out/cljs_base.js"></script>
<script src="js/main.js"></script>
</body>

</html>

0 comments on commit fcf5bf3

Please sign in to comment.