Skip to content

Commit

Permalink
Upgraded project to Scala 2.11/Scalatra 2.4.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiw committed Jun 13, 2016
1 parent 17d0ad1 commit 26fd988
Show file tree
Hide file tree
Showing 20 changed files with 740 additions and 806 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jrebel.lic

.ensime*
*.sublime-*
.cache
.cache*

# intellij
*.eml
Expand Down
23 changes: 23 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
enablePlugins(JettyPlugin)

webappPostProcess := {
webappDir: File =>
def listFiles(level: Int)(f: File): Unit = {
val indent = ((1 until level) map { _ => " " }).mkString
if (f.isDirectory) {
streams.value.log.info(indent + f.getName + "/")
f.listFiles foreach { listFiles(level + 1) }
} else streams.value.log.info(indent + f.getName)
}

// XXX: hardcoding this is bad, m'kay?
IO.copyDirectory(webappDir / ".." / "scala-2.11" / "classes" / "webapp" / "js", webappDir / "js")

streams.value.log.info("webappDir: " + webappDir)
listFiles(1)(webappDir)
}

//javaOptions in Jetty ++= Seq(
// "-Xdebug",
// "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
//)
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.12.3
sbt.version=0.13.9
38 changes: 19 additions & 19 deletions project/build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import coffeescript.Plugin._
object NewsrdrBuild extends Build {
val Organization = "us.newsrdr"
val Name = "newsrdr"
val Version = "0.1.0-SNAPSHOT"
val ScalaVersion = "2.10.2"
val ScalatraVersion = "2.2.1"
val Version = "0.2.0-SNAPSHOT"
val ScalaVersion = "2.11.8"
val ScalatraVersion = "2.4.0"

lazy val project = Project (
"newsrdr",
file("."),
settings = Defaults.defaultSettings ++ ScalatraPlugin.scalatraWithJRebel ++ coffeeSettings ++ scalateSettings ++ Seq(
settings = Defaults.defaultSettings ++ ScalatraPlugin.scalatraWithJRebel ++ scalateSettings ++ coffeeSettings ++ Seq(
organization := Organization,
name := Name,
version := Version,
Expand All @@ -30,26 +30,26 @@ object NewsrdrBuild extends Build {
"org.scalatra" %% "scalatra-specs2" % ScalatraVersion % "test",
"org.scalatra" %% "scalatra-json" % ScalatraVersion,
"org.scalatra" %% "scalatra-swagger" % ScalatraVersion,
"org.json4s" %% "json4s-native" % "3.2.4",
"org.json4s" %% "json4s-native" % "3.3.0",
"javax.mail" % "mail" % "1.4.7",
"com.lambdaworks" % "scrypt" % "1.4.0",
"net.databinder.dispatch" %% "dispatch-core" % "0.11.0",
"org.twitter4j" % "twitter4j-stream" % "4.0.3",
"net.databinder.dispatch" %% "dispatch-core" % "0.11.3",
"org.twitter4j" % "twitter4j-stream" % "4.0.4",
"org.ccil.cowan.tagsoup" % "tagsoup" % "1.2.1",
"com.github.nscala-time" %% "nscala-time" % "0.4.2",
"ch.qos.logback" % "logback-classic" % "1.0.6" % "runtime",
"com.typesafe.slick" %% "slick" % "1.0.1",
"org.slf4j" % "slf4j-nop" % "1.6.4",
"com.h2database" % "h2" % "1.3.166",
"mysql" % "mysql-connector-java" % "5.1.26",
"c3p0" % "c3p0" % "0.9.1.2",
"org.quartz-scheduler" % "quartz" % "2.2.1",
"xalan" % "xalan" % "2.7.1",
"org.eclipse.jetty" % "jetty-webapp" % "8.1.8.v20121106" % "container",
"com.github.nscala-time" %% "nscala-time" % "2.12.0",
"ch.qos.logback" % "logback-classic" % "1.1.7" % "runtime",
"com.typesafe.slick" %% "slick" % "3.1.1",
"org.slf4j" % "slf4j-nop" % "1.7.21",
"com.h2database" % "h2" % "1.4.192",
"mysql" % "mysql-connector-java" % "6.0.2",
"com.mchange" % "c3p0" % "0.9.5.2",
"org.quartz-scheduler" % "quartz" % "2.2.3",
"xalan" % "xalan" % "2.7.2",
"org.eclipse.jetty" % "jetty-webapp" % "8.1.18.v20150929" % "container",
"org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container;provided;test" artifacts (Artifact("javax.servlet", "jar", "jar"))
),
(resourceManaged in (Compile, CoffeeKeys.coffee)) <<= (resourceManaged in Compile)(_ / "webapp" / "js"),
com.github.siasia.PluginKeys.webappResources in Compile <+= (resourceManaged in Compile)(_ / "webapp" ),
unmanagedResourceDirectories in Compile <+= (resourceManaged in Compile)(_ / "webapp" ),
scalateTemplateConfig in Compile <<= (sourceDirectory in Compile){ base =>
Seq(
TemplateConfig(
Expand All @@ -63,5 +63,5 @@ object NewsrdrBuild extends Build {
)
}
)
).settings(net.virtualvoid.sbt.graph.Plugin.graphSettings: _*)
)
}
26 changes: 8 additions & 18 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
addSbtPlugin("com.mojolly.scalate" % "xsbt-scalate-generator" % "0.4.2")

addSbtPlugin("org.scalatra.sbt" % "scalatra-sbt" % "0.3.0")

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.1")

libraryDependencies <+= sbtVersion(v => v match {
case "0.11.0" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.0-0.2.8"
case "0.11.1" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.1-0.2.10"
case "0.11.2" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.2-0.2.11"
case "0.11.3" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.3-0.2.11.1"
case x if (x.startsWith("0.12")) => "com.github.siasia" %% "xsbt-web-plugin" % "0.12.0-0.2.11.1"
})
addSbtPlugin("com.mojolly.scalate" % "xsbt-scalate-generator" % "0.5.0")
addSbtPlugin("org.scalatra.sbt" % "scalatra-sbt" % "0.5.1")
//addSbtPlugin("com.bowlingx" %% "xsbt-wro4j-plugin" % "0.3.5")
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.4.0")
addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "2.1.0")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.8.2")
addSbtPlugin("me.lessis" % "coffeescripted-sbt" % "0.2.3")

resolvers += Resolver.url("sbt-plugin-snapshots",
new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-snapshots/"))(
Resolver.ivyStylePatterns)

addSbtPlugin("me.lessis" % "coffeescripted-sbt" % "0.2.3")

addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4")
Resolver.ivyStylePatterns)
6 changes: 3 additions & 3 deletions sbt
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ make_url () {
category="$2"
version="$3"

echo "http://typesafe.artifactoryonline.com/typesafe/ivy-$category/$groupid/sbt-launch/$version/sbt-launch.jar"
echo "http://repo.typesafe.com/typesafe/ivy-$category/$groupid/sbt-launch/$version/sbt-launch.jar"
}

declare -r default_jvm_opts="-Dfile.encoding=UTF8 -Dorg.scalatra.environment=development"
declare -r default_jvm_opts="-Dfile.encoding=UTF8"
declare -r default_sbt_opts="-XX:+CMSClassUnloadingEnabled"
declare -r default_sbt_mem=1536
declare -r noshare_opts="-Dsbt.global.base=project/.sbtboot -Dsbt.boot.directory=project/.boot -Dsbt.ivy.home=project/.ivy"
Expand Down Expand Up @@ -216,7 +216,7 @@ download_url () {

mkdir -p $(dirname "$jar") && {
if which curl >/dev/null; then
curl --fail --silent "$url" --output "$jar"
curl -L --fail --silent "$url" --output "$jar"
elif which wget >/dev/null; then
wget --quiet -O "$jar" "$url"
fi
Expand Down
3 changes: 0 additions & 3 deletions sbt-debug

This file was deleted.

11 changes: 3 additions & 8 deletions src/main/scala/ScalatraBootstrap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ import javax.servlet.ServletContext
import com.mchange.v2.c3p0.ComboPooledDataSource
import org.slf4j.LoggerFactory
import java.util.Properties

import scala.slick.driver.{ExtendedProfile, H2Driver, MySQLDriver}
import scala.slick.session.{Database, Session}
import scala.slick.jdbc.{StaticQuery => Q}

import slick.driver.{JdbcProfile, H2Driver, MySQLDriver}
import slick.jdbc.JdbcBackend.{Database, Session}
import us.newsrdr.models._;
import us.newsrdr.tasks.BackgroundJobManager

Expand Down Expand Up @@ -66,9 +63,7 @@ class ScalatraBootstrap extends LifeCycle {
conn.close()
}

db withTransaction { implicit session: Session =>
dao.create
}
dao.create()(db)

// Start Quartz scheduler.
BackgroundJobManager.dao = dao
Expand Down
Loading

0 comments on commit 26fd988

Please sign in to comment.