From e0b1bda4f86b89d4e39c5983da3b94b8fc7da0b6 Mon Sep 17 00:00:00 2001 From: Starzu Date: Mon, 19 Dec 2016 12:35:59 +0100 Subject: [PATCH] Scala 2.12 --- .travis.yml | 23 +++++++++++++++++-- build.sbt | 16 ++++++++----- example/build.sbt | 8 +------ example/project/Dependencies.scala | 4 ++-- example/project/build.properties | 2 +- example/project/plugins.sbt | 2 +- .../udash/demos/jquery/views/ErrorView.scala | 11 +++------ .../demos/jquery/views/FunctionView.scala | 9 +++----- .../udash/demos/jquery/views/IndexView.scala | 8 +++---- .../udash/demos/jquery/views/RootView.scala | 10 ++++---- project/build.properties | 2 +- project/plugins.sbt | 4 +++- 12 files changed, 54 insertions(+), 45 deletions(-) diff --git a/.travis.yml b/.travis.yml index 610ec25..556f7d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,27 @@ language: scala +dist: trusty +jdk: oraclejdk8 scala: - 2.11.8 + - 2.12.1 + +before_script: + - "export DISPLAY=:99.0" + - "sh -e /etc/init.d/xvfb start" + - sleep 3 # give xvfb some time to start + # Instal google-chrome + - export CHROME_BIN=/usr/bin/google-chrome + - sudo apt-get update + - sudo apt-get install -y libappindicator1 fonts-liberation + - wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb + - sudo dpkg -i google-chrome*.deb + # Install Selenium chromedriver + - wget http://chromedriver.storage.googleapis.com/2.25/chromedriver_linux64.zip + - unzip chromedriver_linux64.zip -d selenium-bin + - export PATH=$PWD/selenium-bin:$PATH script: - - sbt ++$TRAVIS_SCALA_VERSION test - - cd example && sbt ++$TRAVIS_SCALA_VERSION compile \ No newline at end of file + - sbt ++$TRAVIS_SCALA_VERSION "set (jsEnv in Test := new org.scalajs.jsenv.selenium.SeleniumJSEnv(org.scalajs.jsenv.selenium.Chrome))" test + - sbt ++$TRAVIS_SCALA_VERSION publishLocal + # - cd example && sbt ++$TRAVIS_SCALA_VERSION compile \ No newline at end of file diff --git a/build.sbt b/build.sbt index 36e1b7f..2d41939 100644 --- a/build.sbt +++ b/build.sbt @@ -1,8 +1,10 @@ + name := "udash-jquery" -version := "1.0.0" +version := "1.0.1" organization := "io.udash" -scalaVersion := "2.11.8" +scalaVersion := "2.12.1" +crossScalaVersions := Seq("2.11.8", "2.12.1") scalacOptions in ThisBuild ++= Seq( "-feature", "-deprecation", @@ -15,14 +17,16 @@ scalacOptions in ThisBuild ++= Seq( "-Xlint:_,-missing-interpolator,-adapted-args" ) +jsEnv in Test := new org.scalajs.jsenv.selenium.SeleniumJSEnv(org.scalajs.jsenv.selenium.Firefox) + libraryDependencies ++= Seq( - "org.scala-js" %%% "scalajs-dom" % "0.9.0", - "org.scalatest" %%% "scalatest" % "3.0.0-M15" % Test, - "com.lihaoyi" %%% "scalatags" % "0.5.4" % Test + "org.scala-js" %%% "scalajs-dom" % "0.9.1", + "org.scalatest" %%% "scalatest" % "3.0.1" % Test, + "com.lihaoyi" %%% "scalatags" % "0.6.2" % Test ) jsDependencies += - "org.webjars" % "jquery" % "2.2.3" / "2.2.3/jquery.js" minified "2.2.3/jquery.min.js" + "org.webjars" % "jquery" % "2.2.4" / "2.2.4/jquery.js" minified "2.2.4/jquery.min.js" requiresDOM in Test := true persistLauncher in Test := false diff --git a/example/build.sbt b/example/build.sbt index 18ca035..19f5556 100644 --- a/example/build.sbt +++ b/example/build.sbt @@ -1,6 +1,6 @@ name := "jquery-demo" -version in ThisBuild := "1.0.0-SNAPSHOT" +version in ThisBuild := "1.0.1-SNAPSHOT" scalaVersion in ThisBuild := "2.11.8" organization in ThisBuild := "io.udash" crossPaths in ThisBuild := false @@ -16,12 +16,6 @@ scalacOptions in ThisBuild ++= Seq( "-Xlint:_,-missing-interpolator,-adapted-args" ) -//TODO: remove it after scala-js-jquery 1.0 release -externalResolvers in ThisBuild := Seq( - DefaultMavenRepository, - Resolver.file("local", file(System.getProperty("user.home") + "/.ivy2/local"))(Resolver.ivyStylePatterns) -) - val generatedDir = file("generated") val `jquery-demo` = project.in(file(".")).enablePlugins(ScalaJSPlugin) .settings( diff --git a/example/project/Dependencies.scala b/example/project/Dependencies.scala index d580f92..9364f20 100644 --- a/example/project/Dependencies.scala +++ b/example/project/Dependencies.scala @@ -2,8 +2,8 @@ import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._ import sbt._ object Dependencies extends Build { - val udashCoreVersion = "0.1.1" - val udashJQueryVersion = "1.0.0" + val udashCoreVersion = "0.4.0" + val udashJQueryVersion = "1.0.1" val deps = Def.setting(Seq[ModuleID]( "io.udash" %%% "udash-core-frontend" % udashCoreVersion, diff --git a/example/project/build.properties b/example/project/build.properties index e6a3739..e0cbc71 100644 --- a/example/project/build.properties +++ b/example/project/build.properties @@ -1 +1 @@ -sbt.version = 0.13.11 \ No newline at end of file +sbt.version = 0.13.13 \ No newline at end of file diff --git a/example/project/plugins.sbt b/example/project/plugins.sbt index 2c9f86d..26a69b3 100644 --- a/example/project/plugins.sbt +++ b/example/project/plugins.sbt @@ -1,2 +1,2 @@ logLevel := Level.Warn -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.8") \ No newline at end of file +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.13") \ No newline at end of file diff --git a/example/src/main/scala/io/udash/demos/jquery/views/ErrorView.scala b/example/src/main/scala/io/udash/demos/jquery/views/ErrorView.scala index 98fc2d9..2a427cf 100644 --- a/example/src/main/scala/io/udash/demos/jquery/views/ErrorView.scala +++ b/example/src/main/scala/io/udash/demos/jquery/views/ErrorView.scala @@ -6,14 +6,9 @@ import org.scalajs.dom.Element object ErrorViewPresenter extends DefaultViewPresenterFactory[IndexState.type](() => new ErrorView) -class ErrorView extends View { +class ErrorView extends FinalView { import scalatags.JsDom.all._ - private val content = h3( - "URL not found!" - ).render - - override def getTemplate: Element = content - - override def renderChild(view: View): Unit = {} + override def getTemplate: Modifier = + h3("URL not found!") } \ No newline at end of file diff --git a/example/src/main/scala/io/udash/demos/jquery/views/FunctionView.scala b/example/src/main/scala/io/udash/demos/jquery/views/FunctionView.scala index c5c14b4..5874d47 100644 --- a/example/src/main/scala/io/udash/demos/jquery/views/FunctionView.scala +++ b/example/src/main/scala/io/udash/demos/jquery/views/FunctionView.scala @@ -3,13 +3,13 @@ package io.udash.demos.jquery.views import io.udash._ import org.scalajs.dom.{Element, Event} -abstract class FunctionView extends View { +abstract class FunctionView extends FinalView { import scalatags.JsDom.all._ protected val content: Element protected val script: () => Any - override def getTemplate: Element = { + override def getTemplate: Modifier = div( content, button( @@ -18,8 +18,5 @@ abstract class FunctionView extends View { false }) )("Run script") - ).render - } - - override def renderChild(view: View): Unit = {} + ) } \ No newline at end of file diff --git a/example/src/main/scala/io/udash/demos/jquery/views/IndexView.scala b/example/src/main/scala/io/udash/demos/jquery/views/IndexView.scala index 946e02c..aaf2e46 100644 --- a/example/src/main/scala/io/udash/demos/jquery/views/IndexView.scala +++ b/example/src/main/scala/io/udash/demos/jquery/views/IndexView.scala @@ -6,7 +6,7 @@ import org.scalajs.dom.Element object IndexViewPresenter extends DefaultViewPresenterFactory[IndexState.type](() => new IndexView) -class IndexView extends View { +class IndexView extends FinalView { import Context._ import scalatags.JsDom.all._ @@ -29,9 +29,7 @@ class IndexView extends View { li(a(href := OnOneOffState.url)(".on() & .one() & .off()")), li(a(href := OffsetPositionState.url)(".offset() & .position()")) ) - ).render + ) - override def getTemplate: Element = content - - override def renderChild(view: View): Unit = {} + override def getTemplate: Modifier = content } \ No newline at end of file diff --git a/example/src/main/scala/io/udash/demos/jquery/views/RootView.scala b/example/src/main/scala/io/udash/demos/jquery/views/RootView.scala index 64d870b..c58cf5d 100644 --- a/example/src/main/scala/io/udash/demos/jquery/views/RootView.scala +++ b/example/src/main/scala/io/udash/demos/jquery/views/RootView.scala @@ -16,14 +16,14 @@ class RootView extends View { private val content = div( a(href := IndexState.url)(h1("jquery-demo")), child - ).render + ) - override def getTemplate: Element = content + override def getTemplate: Modifier = content override def renderChild(view: View): Unit = { import io.udash.wrappers.jquery._ - val newChild = view.getTemplate - jQ(child).replaceWith(newChild) - child = newChild + + jQ(child).children().remove() + view.getTemplate.applyTo(child) } } \ No newline at end of file diff --git a/project/build.properties b/project/build.properties index e6a3739..e0cbc71 100755 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version = 0.13.11 \ No newline at end of file +sbt.version = 0.13.13 \ No newline at end of file diff --git a/project/plugins.sbt b/project/plugins.sbt index e513ea5..5aec49e 100755 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,5 @@ logLevel := Level.Warn -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.9") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.13") + +libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "0.1.3"