summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Haoyi <haoyi@dropbox.com>2015-01-25 18:47:43 -0800
committerLi Haoyi <haoyi@dropbox.com>2015-01-25 18:47:43 -0800
commit2e9a726bfbea4a25183a2649e4e0b85519fe8e8a (patch)
tree4b16125360ea8c98bee2e2fec935dfe2d3796329
parentd66fd4a85cd13006acad380dd36634277fdf4988 (diff)
downloadhands-on-scala-js-2e9a726bfbea4a25183a2649e4e0b85519fe8e8a.tar.gz
hands-on-scala-js-2e9a726bfbea4a25183a2649e4e0b85519fe8e8a.tar.bz2
hands-on-scala-js-2e9a726bfbea4a25183a2649e4e0b85519fe8e8a.zip
afaict everything works
-rw-r--r--book/src/main/scala/book/BookData.scala5
-rw-r--r--book/src/main/scala/book/Main.scala26
-rw-r--r--book/src/main/scalatex/book/Index.scalatex2
-rw-r--r--book/src/main/scalatex/book/handson/ClientServer.scalatex5
-rw-r--r--book/src/main/scalatex/book/handson/WebPage.scalatex2
5 files changed, 21 insertions, 19 deletions
diff --git a/book/src/main/scala/book/BookData.scala b/book/src/main/scala/book/BookData.scala
index b21f660..9fa4d5e 100644
--- a/book/src/main/scala/book/BookData.scala
+++ b/book/src/main/scala/book/BookData.scala
@@ -4,11 +4,12 @@ import java.io.File
import acyclic.file
import ammonite.all._
+import ammonite.ops.Path
import scalatags.Text.TypedTag
import scalatags.Text.all._
object BookData {
val wd = processWorkingDir
- val cloneRoot = root/System.getProperty("clone.root").split('/')
+ val cloneRoot = Path(System.getProperty("clone.root"))
lazy val javaAPIs = {
@@ -25,7 +26,7 @@ object BookData {
if file.ext == "scala"
} yield{
- val path = (file - cloneRoot).toString.stripSuffix(".scala")
+ val path = (file - cloneRoot - root).toString.stripSuffix(".scala")
val filename = path.replace('/', '.')
val docpath = s"https://docs.oracle.com/javase/7/docs/api/$path.html"
diff --git a/book/src/main/scala/book/Main.scala b/book/src/main/scala/book/Main.scala
index 9696874..1f8521a 100644
--- a/book/src/main/scala/book/Main.scala
+++ b/book/src/main/scala/book/Main.scala
@@ -31,22 +31,22 @@ object Main {
def content = Map("index.html" -> Index())
override def autoResources = super.autoResources ++ Seq(
- wd/"META-INF"/'resources/'webjars/'pure/"0.5.0"/"grids-responsive-min.css",
- wd/'css/"side-menu.css",
- wd/"example-opt.js",
- wd/'webpage/"weather.js",
- wd/"favicon.svg",
- wd/"favicon.png"
+ root/"META-INF"/'resources/'webjars/'pure/"0.5.0"/"grids-responsive-min.css",
+ root/'css/"side-menu.css",
+ root/"example-opt.js",
+ root/'webpage/"weather.js",
+ root/"favicon.svg",
+ root/"favicon.png"
)
override def manualResources = super.manualResources ++ Seq(
- wd/'images/"javascript-the-good-parts-the-definitive-guide.jpg",
- wd/'images/"Hello World.png",
- wd/'images/"Hello World White.png",
- wd/'images/"Hello World Console.png",
- wd/'images/"IntelliJ Hello.png",
- wd/'images/"Dropdown.png",
- wd/'images/"Scalatags Downloads.png"
+ root/'images/"javascript-the-good-parts-the-definitive-guide.jpg",
+ root/'images/"Hello World.png",
+ root/'images/"Hello World White.png",
+ root/'images/"Hello World Console.png",
+ root/'images/"IntelliJ Hello.png",
+ root/'images/"Dropdown.png",
+ root/'images/"Scalatags Downloads.png"
)
override def headFrags = super.headFrags ++ Seq(
meta(charset:="utf-8"),
diff --git a/book/src/main/scalatex/book/Index.scalatex b/book/src/main/scalatex/book/Index.scalatex
index 35c2fb5..e1a7f69 100644
--- a/book/src/main/scalatex/book/Index.scalatex
+++ b/book/src/main/scalatex/book/Index.scalatex
@@ -24,7 +24,7 @@ is a set of detailed expositions on various parts of the Scala.js platform. Noth
Even if we do not require any familiarity of Scala.js, this book nonetheless assumes a good amount of background knowledge: of Scala, of Javascript, and of web development as a whole. In general, you will not need deep knowledge of any of these subjects, though if you are coming in entirely without knowledge of any one of them, you'll have to be willing to spend time Google-ing things and picking things up as we go along. Someone who comes in without previous web-dev experience may miss or not-notice many of the nice touches and benefits that Scala.js brings to the table, having never done web-dev any other way,
@p
- Many of the code samples are taken from examples available on the book's @lnk("Github Page", "https://github.com/lihaoyi/scala-js-book"); for those code samples (e.g. the animation above), there is a @i(cls:="fa fa-link ") link in the bottom-right corner of the snippet that you can click on to go to the original code. These come in handy if you find you need additional context around the snippet, e.g. what imports you need for the code to work, or what the complete executable example looks like.
+ Many of the code samples are taken from examples available on the book's @lnk("Github Page", "https://github.com/lihaoyi/scala-js-book"); for those code samples (e.g. the animation above), there is a @i(cls:="fa fa-link ") link in the top-right corner of the snippet that you can click on to go to the original code. These come in handy if you find you need additional context around the snippet, e.g. what imports you need for the code to work, or what the complete executable example looks like.
@p
This book is roughly divided into two sections:
diff --git a/book/src/main/scalatex/book/handson/ClientServer.scalatex b/book/src/main/scalatex/book/handson/ClientServer.scalatex
index 8cbf9cf..87c959d 100644
--- a/book/src/main/scalatex/book/handson/ClientServer.scalatex
+++ b/book/src/main/scalatex/book/handson/ClientServer.scalatex
@@ -81,7 +81,8 @@
@p
You may have noticed in both client and server, we have made reference to a mysterious @hl.scala{FileData} type which holds the name and size of each file. @hl.scala{FileData} is defined in the @code{shared/} folder, so it can be accessed from both Scala-JVM and Scala.js:
- @hl.ref(client/"FileData.scala")
+
+ @hl.ref(wd/'examples/'crossBuilds/'clientserver/'client/'shared/'main/'scala/'simple/"FileData.scala")
@p
Now, if we go to the browser at @code{localhost:8080}, we should see our web-page!
@@ -178,7 +179,7 @@
@p
Let's start with our client-server interface definition
- @hl.ref(client2/"Shared.scala")
+ @hl.ref(wd/'examples/'crossBuilds/'clientserver2/'client/'shared/'main/'scala/'simple/"Shared.scala")
@p
Here, you can see that in addition to sharing the @hl.scala{FileData} class, we are also creating an @hl.scala{Api} trait which contains the signature of our @hl.scala{list} method. The exact name of the trait doesn't matter. We need it to be in @code{shared/} so that the code in both client and server can reference it.
diff --git a/book/src/main/scalatex/book/handson/WebPage.scalatex b/book/src/main/scalatex/book/handson/WebPage.scalatex
index df60176..1078d7d 100644
--- a/book/src/main/scalatex/book/handson/WebPage.scalatex
+++ b/book/src/main/scalatex/book/handson/WebPage.scalatex
@@ -147,7 +147,7 @@
@split
@more
- @hl.ref(webpage/"weather.js", "var xhr")
+ @hl.ref(wd/'examples/'demos/'src/'main/'resources/'webpage/"weather.js", "var xhr")
@less
@BookData.example(div, "WeatherJs")