Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ecd278a

Browse files
committed
Merge branch 'master' into drawing
Conflicts: build.sbt
2 parents 3fdb949 + 5c299d3 commit ecd278a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+6725
-186
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1-
# JavaScript as an embedded DSL in Scala #
1+
# js.scala: JavaScript as an embedded DSL in Scala #
22

3-
### Presentations / Papers
3+
### Documentation
44

5-
* _draft_ ECOOP 2012 paper ([PDF](http://dl.dropbox.com/u/12870350/article.pdf))
6-
* [_upcoming_ Scala Days 2012 talk](http://days2012.scala-lang.org/node/383)
5+
* ECOOP 2012 paper ([PDF](http://infoscience.epfl.ch/record/179888/files/js-scala-ecoop.pdf)) and slides ([PDF](http://pldi12.cs.purdue.edu/sites/default/files/slides_ecoop_gkossakowski.pdf))
6+
* [Scala Days 2012 talk](http://skillsmatter.com/podcast/scala/javascript-embedded-dsl-scala)
77

88
### Setup
99

10-
1. Setup [virtualization-lms-core](http://github.com/gkossakowski/virtualization-lms-core), including Scala-Virtualized.
10+
1. Setup [virtualization-lms-core](http://github.com/js-scala/virtualization-lms-core), including [Scala-Virtualized](http://github.com/js-scala/scala/tree/js). If you deploy locally, ensure the `SCALA_VIRTUALIZED_VERSION` environment variable is set consistently.
1111

12-
2. Copy the file `local.properties` from virtualization-lms-core to this root project directory.
12+
2. Run `sbt`. `test` to ensure everything works. Then `publish-local`.
1313

14-
3. Run `sbt`. `test` to ensure everything works. Then `publish-local`. You can also run the dummy `Main` program with `run`.
14+
### Use it in Play 2!
15+
16+
* [build-play20](http://github.com/js-scala/build-play20) builds Play 2! and all its transitive Scala dependencies with Scala-Virtualized, for compatibility with this DSL. Deployment on [dotcloud](http://github.com/js-scala/play2-on-dotcloud) is an option.
1517

1618
### Further projects
1719

18-
[play-js-validation](http://github.com/namin/play-js-validation) uses this DSL to enable form validation code in Play 2.0 to be written once and checked on both client and server sides.
20+
* [play-js-validation](http://github.com/js-scala/play-js-validation) uses this DSL to enable form validation code in Play 2.0 to be written once and checked on both client and server sides.
21+
22+
* [forest](http://github.com/js-scala/forest) uses this DSL to enable HTML templates to be written once and shared between client and server sides, both for initial rendering and automatic updating.

build.sbt

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,10 @@
1-
name := "lms-sandbox"
1+
name := "js-scala"
22

33
organization := "EPFL"
44

5-
version := "0.1"
5+
version := "0.2-SNAPSHOT"
66

7-
//--- Local Scala
8-
9-
scalaHome <<= baseDirectory { f =>
10-
//val scalaVirtualizedHome = SettingKey[File]("scala-virtualized-home","Location of local Scala virtualized checkout")
11-
val props = new java.util.Properties()
12-
IO.load(props, f / "local.properties")
13-
val x = props.getProperty("scala.virtualized.home")
14-
if (x == null)
15-
sys.error("Did you forget to set scala.virtualized.home property in local.properties file?")
16-
else Some(file(x))
17-
}
18-
19-
scalaVersion := "2.10.0-virtualized-SNAPSHOT"
20-
21-
scalacOptions <+= scalaHome map (_.map(f => "-Xplugin:"+f+"/misc/scala-devel/plugins/continuations.jar").get)
7+
scalaVersion := Option(System.getenv("SCALA_VIRTUALIZED_VERSION")).getOrElse("2.10.0-M1-virtualized")
228

239
//--- Dependencies
2410

@@ -30,22 +16,30 @@ resolvers ++= Seq(
3016

3117
libraryDependencies ++= Seq(
3218
"org.scalatest" % "scalatest_2.10.0-virtualized-SNAPSHOT" % "1.6.1-SNAPSHOT" % "test",
33-
"scala" % "virtualization-lms-core_2.10.0-virtualized-SNAPSHOT" % "0.1",
19+
"EPFL" %% "lms" % "0.2",
3420
"org.eclipse.jetty" % "jetty-webapp" % "8.0.1.v20110908" % "container",
3521
"org.eclipse.jetty" % "jetty-websocket" % "8.0.1.v20110908",
3622
"org.eclipse.jetty" % "jetty-servlet" % "8.0.1.v20110908",
3723
"javax.servlet" % "servlet-api" % "2.5" % "provided->default")
38-
39-
24+
4025
//--- End of Dependencies
4126

4227
scalacOptions ++= Seq("-deprecation", "-unchecked", "-Xexperimental", "-P:continuations:enable", "-Yvirtualize")
4328

4429
//Our tests are not threadsafe so disabling parallel execution for now
4530
parallelExecution in Test := false
4631

47-
//import web plugin keys
32+
// import web plugin keys
4833
seq(webSettings :_*)
4934

5035
// disable publishing of main docs
5136
publishArtifact in (Compile, packageDoc) := false
37+
38+
// continuations
39+
autoCompilerPlugins := true
40+
41+
libraryDependencies <<= (scalaVersion, libraryDependencies) { (ver, deps) =>
42+
deps :+ compilerPlugin("org.scala-lang.plugins" % "continuations" % ver)
43+
}
44+
45+
scalacOptions += "-P:continuations:enable"

papers/ecoop2012/article.pdf

512 KB
Binary file not shown.

papers/ecoop2012/article.tex

Lines changed: 1145 additions & 0 deletions
Large diffs are not rendered by default.

papers/ecoop2012/drawing.png

147 KB
Loading

papers/ecoop2012/fetchTweets.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
function fetchTweets(username, callback) {
2+
jQuery.ajax({
3+
url: "http://api.twitter.com/1/
4+
statuses/user_timeline.json/",
5+
type: "GET",
6+
dataType: "jsonp",
7+
data: {
8+
screen_name : username,
9+
include_rts : true,
10+
count : 5,
11+
include_entities : true
12+
},
13+
success: callback
14+
})
15+
}

papers/ecoop2012/fetchTweets.scala

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
def fetchTweets(username: Rep[String]) =
2+
(ajax.get {
3+
new JSLiteral {
4+
val url = "http://api.twitter.com/1/
5+
statuses/user_timeline.json"
6+
val `type` = "GET"
7+
val dataType = "jsonp"
8+
val data = new JSLiteral {
9+
val screen_name = username
10+
val include_rts = true
11+
val count = 5
12+
val include_entities = true
13+
}
14+
}
15+
}).as[TwitterResponse]
16+
17+
type TwitterResponse =
18+
Array[JSLiteral {val text: String}]

papers/ecoop2012/koch-browser.png

61.2 KB
Loading

papers/ecoop2012/koch-java2d.png

38.3 KB
Loading

0 commit comments

Comments
 (0)