addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.5.1")
addSbtPlugin("io.github.irundaia" % "sbt-sassify" % "1.5.2")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.9")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.9.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.34")

// this is experimental
addSbtPlugin("ch.epfl.scala" % "sbt-github-dependency-graph" % "0.1.0-M4")

libraryDependencies ++= Seq(
  "org.testcontainers" % "postgresql" % "1.16.3",
  "org.testcontainers" % "elasticsearch" % "1.16.3",
  "org.tpolecat" %% "doobie-postgres" % "0.13.4"
)

addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.5.1")
addSbtPlugin("io.github.irundaia" % "sbt-sassify" % "1.5.2")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.9")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.9.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.34")

// this is experimental
addSbtPlugin("ch.epfl.scala" % "sbt-github-dependency-graph" % "0.1.0-M4")

libraryDependencies ++= Seq(
  "org.testcontainers" % "postgresql" % "1.17.1",
  "org.testcontainers" % "elasticsearch" % "1.17.1",
  "org.tpolecat" %% "doobie-postgres" % "0.13.4"
)

Update elasticsearch, postgresql to 1.17.1


resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.2")

// web plugins

addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.0.0")

resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.2")

// web plugins

//addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")

//addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.0.0")

Disable the plugin of coffee-script, and less.


addSbtPlugin("org.xerial.sbt" % "sbt-pack" % "0.7.9")

addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.2")

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-multi-jvm" % "0.3.11")

addSbtPlugin("com.eed3si9n" % "sbt-doge" % "0.1.5")

addSbtPlugin("org.xerial.sbt" % "sbt-pack" % "0.7.9")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-M15")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.2")
addSbtPlugin("com.typesafe.sbt" % "sbt-multi-jvm" % "0.3.11")
addSbtPlugin("com.eed3si9n" % "sbt-doge" % "0.1.5")

Use sbt-coursier for faster dependency donwload


package com.softwaremill.codebrag.service.updater

import akka.actor.{Props, ActorSystem}
import scala.concurrent.duration._
import com.softwaremill.codebrag.service.github.GitHubCommitImportServiceFactory
import com.softwaremill.codebrag.service.config.{RepositoryConfig, CodebragConfiguration}

object RepositoryUpdateScheduler {

  def initialize(actorSystem: ActorSystem,
                 importServiceFactory: GitHubCommitImportServiceFactory,
                 repositoryConfig: RepositoryConfig) {

    import actorSystem.dispatcher

    val authorizedLogin = CodebragConfiguration.syncUserLogin
    val importService = importServiceFactory.createInstance(authorizedLogin)
    val updaterActor = actorSystem.actorOf(Props(new LocalRepositoryUpdater(repositoryConfig.repositoryOwner,
      repositoryConfig.repositoryName, importService)))

    actorSystem.scheduler.schedule(60 seconds,
      45 seconds,
      updaterActor,
      LocalRepositoryUpdater.Tick)
  }
}

package com.softwaremill.codebrag.service.updater

import akka.actor.{Props, ActorSystem}
import scala.concurrent.duration._
import com.softwaremill.codebrag.service.github.GitHubCommitImportServiceFactory
import com.softwaremill.codebrag.service.config.{RepositoryConfig, CodebragConfiguration}
import org.eclipse.jgit.util.StringUtils
import com.typesafe.scalalogging.slf4j.Logging

object RepositoryUpdateScheduler extends Logging {

  def initialize(actorSystem: ActorSystem,
                 importServiceFactory: GitHubCommitImportServiceFactory,
                 repositoryConfig: RepositoryConfig) {

    val authorizedLogin = CodebragConfiguration.syncUserLogin
    if (StringUtils.isEmptyOrNull(authorizedLogin)) {
      logger.error("Cannot schedule automatic synchronization. Value syncUserLogin not configured in application.conf.")
    }
    else {
      scheduleUpdate(importServiceFactory, authorizedLogin, actorSystem, repositoryConfig)
    }
  }

  private def scheduleUpdate(importServiceFactory: GitHubCommitImportServiceFactory, authorizedLogin: String, actorSystem: ActorSystem, repositoryConfig: RepositoryConfig) {

    import actorSystem.dispatcher

    val importService = importServiceFactory.createInstance(authorizedLogin)
    val updaterActor = actorSystem.actorOf(Props(new LocalRepositoryUpdater(repositoryConfig.repositoryOwner,
      repositoryConfig.repositoryName, importService)))

    actorSystem.scheduler.schedule(60 seconds,
      45 seconds,
      updaterActor,
      LocalRepositoryUpdater.Tick)
  }
}

Handle missing 'syncUserLogin' in application.conf


package uk.ac.wellcome.models.transformable

import org.scalatest.{FunSpec, Matchers}
import uk.ac.wellcome.models.transformable.sierra.test.utils.SierraUtil

class SierraTransformableTest extends FunSpec with Matchers with SierraUtil {

  it("allows creation of SierraTransformable with no data") {
    SierraTransformable(sourceId = createSierraRecordNumberString)
  }

  it("allows creation from only a SierraBibRecord") {
    val bibRecord = createSierraBibRecord
    val mergedRecord = SierraTransformable(bibRecord = bibRecord)
    mergedRecord.sourceId shouldEqual bibRecord.id
    mergedRecord.maybeBibRecord.get shouldEqual bibRecord
  }
}

package uk.ac.wellcome.models.transformable

import org.scalatest.{FunSpec, Matchers}
import uk.ac.wellcome.models.transformable.sierra.SierraItemNumber
import uk.ac.wellcome.models.transformable.sierra.test.utils.SierraUtil

class SierraTransformableTest extends FunSpec with Matchers with SierraUtil {

  it("allows creation of SierraTransformable with no data") {
    SierraTransformable(sierraId = createSierraBibNumber)
  }

  it("allows creation from only a SierraBibRecord") {
    val bibRecord = createSierraBibRecord
    val mergedRecord = SierraTransformable(bibRecord = bibRecord)
    mergedRecord.sourceId shouldEqual bibRecord.id
    mergedRecord.maybeBibRecord.get shouldEqual bibRecord
  }

  it("has the correct ID") {
    val sierraId = createSierraBibNumber
    SierraTransformable(sierraId = sierraId).id shouldBe s"sierra/${sierraId.withoutCheckDigit}"
  }

  it("allows looking up items by ID") {
    val itemRecords = (0 to 3).map { _ =>
      createSierraItemRecord
    }.toList
    val transformable = createSierraTransformableWith(
      itemRecords = itemRecords
    )

    transformable.itemRecords(itemRecords.head.id) shouldBe itemRecords.head

    // The first one should work by identity (the ID is the same object
    // as the key).  Check it also works with a record number which is equal
    // but not identical.
    val recordNumber = SierraItemNumber(itemRecords.head.id.withoutCheckDigit)
    transformable.itemRecords(recordNumber) shouldBe itemRecords.head
  }
}

Add extra tests around IDs and SierraTransformable


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion := "2.13.3"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.2.3" % Test,
      compilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.7.1" cross CrossVersion.full),
      "com.github.ghik" %% "silencer-lib" % "1.7.1" % Provided cross CrossVersion.full,
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

// silence all warnings on autogenerated files
flowGeneratedFiles ++= Seq(
  "src/main/scala/io/flow/generated/.*".r,
)

// Make sure you only exclude warnings for the project directories, i.e. make builds reproducible
scalacOptions += s"-P:silencer:sourceRoots=${baseDirectory.value.getCanonicalPath}"

version := "0.2.66"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion := "2.13.3"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.2.3" % Test,
      compilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.7.1" cross CrossVersion.full),
      "com.github.ghik" %% "silencer-lib" % "1.7.1" % Provided cross CrossVersion.full,
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

// silence all warnings on autogenerated files
flowGeneratedFiles ++= Seq(
  "src/main/scala/io/flow/generated/.*".r,
)

// Make sure you only exclude warnings for the project directories, i.e. make builds reproducible
scalacOptions += s"-P:silencer:sourceRoots=${baseDirectory.value.getCanonicalPath}"

version := "0.2.67"

autocommit: Update configuration to record version 0.2.67


import play.PlayImport.PlayKeys._

name := "lib-play"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

crossScalaVersions := Seq("2.11.8")

version := "0.3.20"

lazy val root = project
  .in(file("."))
  .enablePlugins(PlayScala)
  .settings(
    libraryDependencies ++= Seq(
      ws,
      filters,
      "com.jason-goodwin" %% "authentikat-jwt" % "0.4.3",
      "org.scalatestplus" %% "play" % "1.4.0" % "test"
    ),
    resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/",
    resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases",
    resolvers += "Artifactory" at "https://flow.artifactoryonline.com/flow/libs-release/",
    credentials += Credentials(
      "Artifactory Realm",
      "flow.artifactoryonline.com",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
)

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

import play.PlayImport.PlayKeys._

name := "lib-play"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

crossScalaVersions := Seq("2.11.8")

version := "0.3.21"

lazy val root = project
  .in(file("."))
  .enablePlugins(PlayScala)
  .settings(
    libraryDependencies ++= Seq(
      ws,
      filters,
      "com.jason-goodwin" %% "authentikat-jwt" % "0.4.3",
      "org.scalatestplus" %% "play" % "1.4.0" % "test"
    ),
    resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/",
    resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases",
    resolvers += "Artifactory" at "https://flow.artifactoryonline.com/flow/libs-release/",
    credentials += Credentials(
      "Artifactory Realm",
      "flow.artifactoryonline.com",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
)

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

autocommit: Update configuration to record version 0.3.21


name := """scala-jooq-tables"""

organization := "com.harrys"

version := "1.6.4"

scalaVersion := "2.11.8"

exportJars := true

scalacOptions ++= Seq("-feature", "-unchecked", "-Xlint", "-deprecation", "-Xfatal-warnings", "-target:jvm-1.8")

javacOptions ++= Seq("-source", "1.8", "-target", "1.8", "-Xlint", "-Werror")

libraryDependencies ++= Seq(
  "org.jooq" % "jooq" % "3.6.2",
  "org.postgresql" % "postgresql" % "9.4-1205-jdbc41",
  "com.typesafe" % "config" % "1.3.0"
)

lazy val `scala-postgres-utils` = RootProject(uri("ssh://git@github.com/harrystech/scala-postgres-utils.git#v0.1.2"))

lazy val `scala-jooq-tables` = (project in file(".")).dependsOn(
  `scala-postgres-utils`
)

// This forces the scala version used between these to match
scalaVersion in `scala-postgres-utils` := (scalaVersion in `scala-jooq-tables`).value

// --
//  Test Setup
// --

libraryDependencies ++= Seq(
  "org.scalacheck" %% "scalacheck" % "1.12.5" % Test,
  "org.scalatest" %% "scalatest" % "2.2.4" % Test
)

name := """scala-jooq-tables"""

organization := "com.harrys"

version := "1.6.4"

scalaVersion := "2.11.8"

exportJars := true

scalacOptions ++= Seq("-feature", "-unchecked", "-Xlint", "-deprecation", "-Xfatal-warnings", "-target:jvm-1.8")

javacOptions ++= Seq("-source", "1.8", "-target", "1.8", "-Xlint", "-Werror")

libraryDependencies ++= Seq(
  "org.jooq" % "jooq" % "3.6.2",
  "org.postgresql" % "postgresql" % "9.4-1205-jdbc41",
  "com.typesafe" % "config" % "1.3.0"
)

// Removed git based libraries in favor of pre-compiled libs.
// Please refer to the README in https://github.com/harrystech/ingestion-utils
// Depends on:
//   * https://github.com/harrystech/scala-postgres-utils

// --
//  Test Setup
// --

libraryDependencies ++= Seq(
  "org.scalacheck" %% "scalacheck" % "1.12.5" % Test,
  "org.scalatest" %% "scalatest" % "2.2.4" % Test
)

Remove git based dependencies in favor of pre-compiled libs


name := "apibuilder-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.3"

crossScalaVersions := Seq("2.12.3", "2.11.11")

version := "0.1.6"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.6.6",
      "org.scalatest" %% "scalatest" % "3.0.4" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

name := "apibuilder-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.3"

crossScalaVersions := Seq("2.12.3", "2.11.11")

version := "0.1.7"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.6.6",
      "org.scalatest" %% "scalatest" % "3.0.4" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

autocommit: Update configuration to record version 0.1.7


import play.PlayImport.PlayKeys._

name := "lib-play"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.11"

crossScalaVersions := Seq("2.11.11")

version := "0.4.3"

lazy val root = project
  .in(file("."))
  .enablePlugins(PlayScala)
  .settings(
    libraryDependencies ++= Seq(
      ws,
      filters,
      "com.jason-goodwin" %% "authentikat-jwt" % "0.4.3",
      "org.scalatestplus" %% "play" % "1.4.0" % "test"
    ),
    resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/",
    resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases",
    resolvers += "Artifactory" at "https://flow.artifactoryonline.com/flow/libs-release/",
    credentials += Credentials(
      "Artifactory Realm",
      "flow.artifactoryonline.com",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

import play.PlayImport.PlayKeys._

name := "lib-play"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.11"

crossScalaVersions := Seq("2.11.11")

version := "0.4.4"

lazy val root = project
  .in(file("."))
  .enablePlugins(PlayScala)
  .settings(
    libraryDependencies ++= Seq(
      ws,
      filters,
      "com.jason-goodwin" %% "authentikat-jwt" % "0.4.3",
      "org.scalatestplus" %% "play" % "1.4.0" % "test"
    ),
    resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/",
    resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases",
    resolvers += "Artifactory" at "https://flow.artifactoryonline.com/flow/libs-release/",
    credentials += Credentials(
      "Artifactory Realm",
      "flow.artifactoryonline.com",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

autocommit: Update configuration to record version 0.4.4


import play.PlayImport.PlayKeys._

name := "lib-play"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.7"

crossScalaVersions := Seq("2.11.7")

version := "0.0.40-SNAPSHOT"

lazy val root = project
  .in(file("."))
  .enablePlugins(PlayScala)
  .settings(
    libraryDependencies ++= Seq(
      ws,
      "org.scalatest" %% "scalatest" % "2.2.6" % "test",
      "org.scalatestplus" %% "play" % "1.4.0" % "test"
    )
)

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

import play.PlayImport.PlayKeys._

name := "lib-play"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.7"

crossScalaVersions := Seq("2.11.7")

version := "0.0.41"

lazy val root = project
  .in(file("."))
  .enablePlugins(PlayScala)
  .settings(
    libraryDependencies ++= Seq(
      ws,
      "org.scalatest" %% "scalatest" % "2.2.6" % "test",
      "org.scalatestplus" %% "play" % "1.4.0" % "test"
    )
)

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

autocommit: Update configuration to record version 0.0.41


package org.openmole.gui.client.tool.plot

import com.definitelyscala.plotlyjs._
import com.definitelyscala.plotlyjs.all._
import com.definitelyscala.plotlyjs.PlotlyImplicits._
import scala.scalajs.js.JSConverters._
import scalatags.JsDom.all._

object HeatMapPlot {

  def apply(
    title:  String  = "",
    serie:  Serie,
    legend: Boolean = false) = {

    lazy val plotDiv = Plot.baseDiv

    val dims = serie.values
    val nbDims = dims.length

    val data = PlotData
      .z(dims.map { _.values.toJSArray }.toJSArray)
      .set(plotlytype.heatmap)

    val layout = Layout
      .title(title)
      .height(700)
      .width(700)

    Plotly.newPlot(
      plotDiv,
      scalajs.js.Array(data),
      layout,
      Plot.baseConfig
    )

    div(plotDiv.render).render
  }
}

package org.openmole.gui.client.tool.plot

import com.definitelyscala.plotlyjs._
import com.definitelyscala.plotlyjs.all._
import com.definitelyscala.plotlyjs.PlotlyImplicits._
import scala.scalajs.js.JSConverters._
import scalatags.JsDom.all._

object HeatMapPlot {

  def apply(
    title:  String  = "",
    serie:  Serie,
    legend: Boolean = false) = {

    lazy val plotDiv = Plot.baseDiv

    val dims = serie.values.map { _.values.reverse }.transpose

    val data = PlotData
      .z(dims.map { _.toJSArray }.toJSArray)
      .set(plotlytype.heatmap)

    val layout = Layout
      .title(title)
      .height(700)
      .width(700)

    Plotly.newPlot(
      plotDiv,
      scalajs.js.Array(data),
      layout,
      Plot.baseConfig
    )

    div(plotDiv.render).render
  }
}

Transpose data for heatmap plots

[GUI] Transpose data for heatmap plots


import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.83"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.7",
      "com.ning" % "async-http-client" % "1.9.39",
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.84"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.7",
      "com.ning" % "async-http-client" % "1.9.39",
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

autocommit: Update configuration to record version 0.0.84


import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.62"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.4",
      "com.ning" % "async-http-client" % "1.9.38",
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.63"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.4",
      "com.ning" % "async-http-client" % "1.9.38",
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

autocommit: Update configuration to record version 0.0.63


import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-lint"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.7"

version := "0.0.17"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.4.6",
      "com.ning" % "async-http-client" % "1.9.33",
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-lint"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.7"

version := "0.0.19"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.4.6",
      "com.ning" % "async-http-client" % "1.9.33",
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

autocommit: Update configuration to record version 0.0.19


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.6"

crossScalaVersions := Seq("2.12.6")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.5" % Test
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

version := "0.1.97"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.6"

crossScalaVersions := Seq("2.12.6")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.5" % Test
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

version := "0.1.98"

autocommit: Update configuration to record version 0.1.98


name := "lib-apidoc-json-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.1"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.6",
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

name := "lib-apidoc-json-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.2"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.6",
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

autocommit: Update configuration to record version 0.0.2


val zookeeperVersion = "3.4.9"
val kafkaVersion = "0.10.1.1"
val akkaHttpVersion = "10.0.1"
val twirlVersion = "1.3.0"

lazy val root = (project in file("."))
  .enablePlugins(SbtTwirl)
  .settings(
    scalaVersion := "2.11.8",
    version := "0.0.1",
    name := "kafcon",
    mainClass in assembly := Some("net.kemuridama.kafcon.Kafcon"),
    libraryDependencies := Seq(
      "org.apache.zookeeper" % "zookeeper" % zookeeperVersion,
      "org.apache.kafka" %% "kafka" % kafkaVersion,
      "com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
      "com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpVersion,
      "joda-time" % "joda-time" % "2.9.7",
      "org.joda" % "joda-convert" % "1.8.1",
      "org.quartz-scheduler" % "quartz" % "2.2.3",
      "com.typesafe.play" %% "twirl-api" % twirlVersion
    )
  )

val zookeeperVersion = "3.4.9"
val kafkaVersion = "0.10.1.1"
val akkaHttpVersion = "10.0.3"
val twirlVersion = "1.3.0"

lazy val root = (project in file("."))
  .enablePlugins(SbtTwirl)
  .settings(
    scalaVersion := "2.11.8",
    version := "0.0.1",
    name := "kafcon",
    mainClass in assembly := Some("net.kemuridama.kafcon.Kafcon"),
    libraryDependencies := Seq(
      "org.apache.zookeeper" % "zookeeper" % zookeeperVersion,
      "org.apache.kafka" %% "kafka" % kafkaVersion,
      "com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
      "com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpVersion,
      "joda-time" % "joda-time" % "2.9.7",
      "org.joda" % "joda-convert" % "1.8.1",
      "org.quartz-scheduler" % "quartz" % "2.2.3",
      "com.typesafe.play" %% "twirl-api" % twirlVersion
    )
  )

Update Akka HTTP from v10.0.1 to v10.0.3

Signed-off-by: Ryo Ochiai <6f891ae2da52dfccd7054b6de61b2b97304e9662@kemuridama.net>


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.8"

crossScalaVersions := Seq("2.12.8")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.5" % Test
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

version := "0.2.17"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.8"

crossScalaVersions := Seq("2.12.8")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.5" % Test
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

version := "0.2.18"

autocommit: Update configuration to record version 0.2.18


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion := "2.13.6"

lazy val allScalacOptions = Seq(
  "-feature",
  "-Xfatal-warnings",
  "-unchecked",
  "-Xcheckinit",
  "-Xlint:adapted-args",
  "-Ypatmat-exhaust-depth", "100", // Fixes: Exhaustivity analysis reached max recursion depth, not all missing cases are reported.
  "-Wconf:src=generated/.*:silent",
  "-Wconf:src=target/.*:silent", // silence the unused imports errors generated by the Play Routes
)

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.2.9" % Test,
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

scalacOptions ++= allScalacOptions

version := "0.2.86"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion := "2.13.6"

lazy val allScalacOptions = Seq(
  "-feature",
  "-Xfatal-warnings",
  "-unchecked",
  "-Xcheckinit",
  "-Xlint:adapted-args",
  "-Ypatmat-exhaust-depth", "100", // Fixes: Exhaustivity analysis reached max recursion depth, not all missing cases are reported.
  "-Wconf:src=generated/.*:silent",
  "-Wconf:src=target/.*:silent", // silence the unused imports errors generated by the Play Routes
)

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.2.9" % Test,
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

scalacOptions ++= allScalacOptions

version := "0.2.87"

autocommit: Update configuration to record version 0.2.87


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}
version := "0.0.9"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}
version := "0.1.0"

autocommit: Update configuration to record version 0.1.0


name := "TextGrounder"

version := "0.3.0"

organization := "OpenNLP"

scalaVersion := "2.9.1"

crossPaths := false

retrieveManaged := true

libraryDependencies ++= Seq(
  "com.google.inject" % "guice" % "2.0",
  "com.google.guava" % "guava" % "r06",
  "commons-cli" % "commons-cli" % "1.2",
  "org.jdom" % "jdom" % "1.1",
  "org.xerial" % "sqlite-jdbc" % "3.6.20",
  "org.apache.opennlp" % "opennlp-maxent" % "3.0.1-incubating",
  "org.apache.opennlp" % "opennlp-tools" % "1.5.1-incubating",
  "org.clapper" %% "argot" % "0.3.5"
  )

// append several options to the list of options passed to the Java compiler
javacOptions ++= Seq("-Xlint")

// append -deprecation to the options passed to the Scala compiler
scalacOptions ++= Seq("-deprecation", "-Xlint")

name := "TextGrounder"

version := "0.3.0"

organization := "OpenNLP"

scalaVersion := "2.9.1"

crossPaths := false

retrieveManaged := true

resolvers += "OpenNLP Maven Repository" at "http://opennlp.sourceforge.net/maven2"

libraryDependencies ++= Seq(
  "com.google.inject" % "guice" % "2.0",
  "com.google.guava" % "guava" % "r06",
  "commons-cli" % "commons-cli" % "1.2",
  "org.jdom" % "jdom" % "1.1",
  "org.xerial" % "sqlite-jdbc" % "3.6.20",
  "org.apache.opennlp" % "opennlp-maxent" % "3.0.1-incubating",
  "org.apache.opennlp" % "opennlp-tools" % "1.5.1-incubating",
  "org.clapper" %% "argot" % "0.3.5"
  )

// append several options to the list of options passed to the Java compiler
javacOptions ++= Seq("-Xlint")

// append -deprecation to the options passed to the Scala compiler
scalacOptions ++= Seq("-deprecation", "-Xlint")

Add resolver for OpenNLP Maven repository


androidBuildAar

autoScalaLibrary := false

githubProject := "floatinglabellayout"

javacOptions ++=
    "-source" :: "1.7" ::
    "-target" :: "1.7" ::
    Nil

libraryDependencies ++=
    "com.android.support" % "design" % "23.2.1" ::
    Nil

minSdkVersion := "7"

name := "FloatingLabelLayout"

normalizedName := "floating-label-layout"

organization := "io.taig.android"

platformTarget := "android-23"

publishArtifact in ( Compile, packageDoc ) := false

scalacOptions ++=
    "-deprecation" ::
    "-feature" ::
    Nil

targetSdkVersion := "23"

typedResources := false

version := "1.1.5"

androidBuildAar

autoScalaLibrary := false

githubProject := "floatinglabellayout"

javacOptions ++=
    "-source" :: "1.7" ::
    "-target" :: "1.7" ::
    Nil

libraryDependencies ++=
    "com.android.support" % "design" % "23.3.0" ::
    Nil

minSdkVersion := "7"

name := "FloatingLabelLayout"

normalizedName := "floating-label-layout"

organization := "io.taig.android"

platformTarget := "android-23"

publishArtifact in ( Compile, packageDoc ) := false

scalacOptions ++=
    "-deprecation" ::
    "-feature" ::
    Nil

targetSdkVersion := "23"

typedResources := false

version := "1.1.5"

Upgrade to android support library 23.3.0


name := "apibuilder-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.3"

crossScalaVersions := Seq("2.12.3", "2.11.11")

version := "0.1.3"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.6.3",
      "org.scalatest" %% "scalatest" % "3.0.4" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

name := "apibuilder-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.3"

crossScalaVersions := Seq("2.12.3", "2.11.11")

version := "0.1.4"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.6.3",
      "org.scalatest" %% "scalatest" % "3.0.4" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

autocommit: Update configuration to record version 0.1.4


package service

import model._
import scala.slick.driver.H2Driver.simple._
import Database.threadLocalSession

trait ProjectService { self: AccountService =>

  /**
   * Creates a new project.
   *
   * The project is created as public repository at first. Users can modify the project type at the repository settings
   * page after the project creation to configure the project as the private repository.
   *
   * @param projectName the project name
   * @param userName the user name of the project owner
   * @param description the project description
   * @return the created project id
   */
  def createProject(projectName: String, userName: String, description: Option[String]): Long = {
    // TODO create a git repository also here?

    val currentDate = new java.sql.Date(System.currentTimeMillis)
    Projects.ins returning Projects.projectId insert
      Project(
        projectId        = None,
        projectName      = projectName,
        userId           = getAccountByUserName(userName).get.userId.get,
        projectType      = 0  /* 0:public, 1:private */,
        description      = description,
        defaultBranch    = "master",
        registeredDate   = currentDate,
        updatedDate      = currentDate,
        lastActivityDate = currentDate)
  }

}

package service

import model._
import scala.slick.driver.H2Driver.simple._
import Database.threadLocalSession

trait ProjectService { self: AccountService =>

  /**
   * Creates a new project.
   *
   * The project is created as public repository at first. Users can modify the project type at the repository settings
   * page after the project creation to configure the project as the private repository.
   *
   * @param projectName the project name
   * @param userName the user name of the project owner
   * @param description the project description
   * @return the created project id
   */
  def createProject(projectName: String, userName: String, description: Option[String]): Long = {
    // TODO create a git repository also here?

    val currentDate = new java.sql.Date(System.currentTimeMillis)

    Projects.ins returning Projects.projectId insert
      Project(
        projectId        = None,
        projectName      = projectName,
        userId           = getUserId(userName),
        projectType      = 0  /* 0:public, 1:private */,
        description      = description,
        defaultBranch    = "master",
        registeredDate   = currentDate,
        updatedDate      = currentDate,
        lastActivityDate = currentDate)
  }

  /**
   * Returns the specified user's project list.
   *
   * @param userName the user name
   * @return the project list which is sorted in descending order of lastActivityDate.
   */
  def getProjects(userName: String): List[Project] = {
    Query(Projects) filter(_.userId is getUserId(userName).bind) sortBy(_.lastActivityDate desc) list
  }

  private def getUserId(userName: String): Long = getAccountByUserName(userName).get.userId.get

}

Insert project info into database before actual git repository creation.


package views.vrm_retention

import models.CacheKeyPrefix

object BusinessChooseYourAddress {

  final val BusinessChooseYourAddressCacheKey = s"${CacheKeyPrefix}business-choose-your-address"
  final val AddressSelectId = "address-select"
  final val EnterAddressManuallyButtonId = "enter-address-manually"
  final val SelectId = "select"
  final val ExitId = "exit"
}

package views.vrm_retention

import models.PrScopedCacheKeyPrefix

object BusinessChooseYourAddress {

  final val BusinessChooseYourAddressCacheKey = s"${PrScopedCacheKeyPrefix}business-choose-your-address"
  final val AddressSelectId = "address-select"
  final val EnterAddressManuallyButtonId = "enter-address-manually"
  final val SelectId = "select"
  final val ExitId = "exit"
}

Fix merge: hotfix from master

Fix merge: hotfix from master


lazy val root = Project(id = "ews", base = file(".")).
  settings(
    name := "EnhancedWatchService",
    version := "0.1",
    scalaVersion := "2.11.8",
    javacOptions ++= Seq("-source", "1.8")
  )

libraryDependencies += "org.slf4j" % "slf4j-api" % "1.7.21"

autoScalaLibrary := false

lazy val root = Project(id = "ews", base = file(".")).
  settings(
    name := "EnhancedWatchService",
    version := "0.1",
    scalaVersion := "2.11.8",
    javacOptions ++= Seq("-source", "1.8")
  )

libraryDependencies += "org.slf4j" % "slf4j-api" % "1.7.21"
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test
autoScalaLibrary := false

Add junit to test scope dependency

Add junit to test scope dependency


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.8"

crossScalaVersions := Seq("2.12.8")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.5" % Test,
      compilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.3.0"),
      "com.github.ghik" %% "silencer-lib" % "1.3.0" % Provided,
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

// silence all warnings on autogenerated files
flowGeneratedFiles ++= Seq(
  "src/main/scala/io/flow/generated/.*".r,
)

// Make sure you only exclude warnings for the project directories, i.e. make builds reproducible
scalacOptions += s"-P:silencer:sourceRoots=${baseDirectory.value.getCanonicalPath}"

version := "0.2.28"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.8"

crossScalaVersions := Seq("2.12.8")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.5" % Test,
      compilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.3.0"),
      "com.github.ghik" %% "silencer-lib" % "1.3.0" % Provided,
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

// silence all warnings on autogenerated files
flowGeneratedFiles ++= Seq(
  "src/main/scala/io/flow/generated/.*".r,
)

// Make sure you only exclude warnings for the project directories, i.e. make builds reproducible
scalacOptions += s"-P:silencer:sourceRoots=${baseDirectory.value.getCanonicalPath}"

version := "0.2.29"

autocommit: Update configuration to record version 0.2.29


import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.74"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.5",
      "com.ning" % "async-http-client" % "1.9.39",
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.75"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.5",
      "com.ning" % "async-http-client" % "1.9.39",
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

autocommit: Update configuration to record version 0.0.75


import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-lint"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.7"

version := "0.0.11"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.4.6",
      "com.ning" % "async-http-client" % "1.9.32",
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-lint"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.7"

version := "0.0.12"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.4.6",
      "com.ning" % "async-http-client" % "1.9.32",
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

Increment version from 0.0.11 => 0.0.12

Increment version from 0.0.11 => 0.0.12


package com.codacy.client.stash

import org.joda.time.DateTime
import play.api.libs.functional.syntax._
import play.api.libs.json._

case class Commit(hash: String, authorName: String, parents: Option[Seq[String]], authorTimestamp: DateTime, message: String)

object Commit {
  implicit val reader: Reads[Commit] = (
    (__ \ "id").read[String] and
      (__ \ "author" \ "name").read[String] and
      (__ \ "parents" \\ "id").read[Seq[String]].map(Option(_).filter(_.nonEmpty)) and
      (__ \ "authorTimestamp").read[Long].map(new DateTime(_)) and
      (__ \ "message").read[String]
    ) (Commit.apply _)
}

package com.codacy.client.stash

import org.joda.time.DateTime
import play.api.libs.functional.syntax._
import play.api.libs.json._

case class Commit(hash: String, authorName: String, parents: Option[List[Parent]], authorTimestamp: DateTime, message: String)

object Commit {
  implicit val reader: Reads[Commit] = (
    (__ \ "id").read[String] and
      (__ \ "author" \ "name").read[String] and
      (__ \ "parents").readNullable[List[Parent]] and
      (__ \ "authorTimestamp").read[Long].map(new DateTime(_)) and
      (__ \ "message").read[String]
    ) (Commit.apply _)
}

case class Parent(id: String, displayId: String)

object Parent {
  implicit val fmt: Format[Parent] = Json.format[Parent]
}

Fix pull request commit API parsing

Fix pull request commit API parsing


package net.liftweb
package common

// WHOA NELLY
// Slightly redefined HLists (we want this in Lift). This allows HLists to be
// covariant in their parameters, which makes things work properly.

object HListies {

  /**
   * The trait that defines HLists
   */
  sealed trait HList

  implicit final class HListMethods[ListSoFar <: HList](hlist: ListSoFar) extends AnyRef {
    def :+:[T](v: T): :+:[T, ListSoFar] = {
      HListies.:+:(v, hlist)
    }

    def length: Int = {
      hlist match {
        case HNil =>
          0
        case head :+: rest =>
          1 + rest.length
      }
    }
  }

  /**
   * The last element of an HList
   */
  final class HNil extends HList {
    override def toString = "HNil"
  }

  /**
   * The HNil singleton
   */
  val HNil = new HNil()

  /**
   * The HList cons cell
   */
  final case class :+:[+H, +T <: HList](head: H, tail: T) extends HList {
    override def toString = head + " :+: " + tail
  }

  //type :+:[+H, +T <: HList] = HCons[H, T]

  /*object :+: {
    def unapply[H, T <: HList](in: HCons[H, T]): Option[(H, T)] = Some(in.head, in.tail)
  }*/

}

package net.liftweb
package common

// WHOA NELLY
// Slightly redefined HLists (we want this in Lift). This allows HLists to be
// covariant in their parameters, which makes things work properly.

object HListies {

  /**
   * The trait that defines HLists
   */
  sealed trait HList

  implicit final class HListMethods[ListSoFar <: HList](hlist: ListSoFar) extends AnyRef {
    def :+:[T](v: T): :+:[T, ListSoFar] = {
      HListies.:+:(v, hlist)
    }

    def length: Int = {
      if (hlist == HNil) {
        0
      } else {
        hlist match {
          case head :+: rest =>
            1 + rest.length
        }
      }
    }
  }

  /**
   * The HNil singleton
   */
  final object HNil extends HList {
    override def toString = "HNil"
  }
  type HNil = HNil.type

  /**
   * The HList cons cell
   */
  final case class :+:[+H, +T <: HList](head: H, tail: T) extends HList {
    override def toString = head + " :+: " + tail
  }

  //type :+:[+H, +T <: HList] = HCons[H, T]

  /*object :+: {
    def unapply[H, T <: HList](in: HCons[H, T]): Option[(H, T)] = Some(in.head, in.tail)
  }*/

}

Rework how we represent HNil.

Rework how we represent HNil.

Scala 2.12 has some tweaked exhaustiveness checks on pattern matching that
catch a possibility we hadn't aniticipated. In particular, HNil was defined as
a final class, and we created a singleton instance of it to reference, but a
user could instantiate the final class themselves and send that in and wreak
havoc.

We redefine HNil as a final singleton object, and define a type HNil that is
equivalent to the singleton's type so we can reference it as both a value and
type called HNil. Other code remains unchanged, fortunately.

Unfortunately, this means we have to keep using our forkity fork of Lift's
HLists... Hopefully a later Lift minor version can include these tweaks, but
we'll need to maintain our fork until we no longer support versions of Lift
with the old implementation.


package common

import akka.actor.ActorRef
import akka.stream.scaladsl.{Sink, Source}
import akka.stream.{ActorMaterializer, OverflowStrategy}

import scala.concurrent.Future

trait ActorUtil {
  def sendMessageWithFunc[T](f: ActorRef => Unit)(implicit actorMaterializer: ActorMaterializer): Future[T] = {
    Source.actorRef[T](0, OverflowStrategy.dropHead)
      .mapMaterializedValue(f)
      .runWith(Sink.head[T])
  }

  def sendMessageToActor[T](recipient: ActorRef, message: Any)(implicit actorMaterializer: ActorMaterializer): Future[T] = {
    sendMessageWithFunc{
      sender =>
        recipient.tell(message, sender)
    }
  }
}

package common

import akka.actor.ActorRef
import akka.stream.scaladsl.{Sink, Source}
import akka.stream.{ActorMaterializer, OverflowStrategy}

import scala.concurrent.Future

trait ActorUtil {
  def sendMessageWithFunc[T](f: ActorRef => Unit)(implicit actorMaterializer: ActorMaterializer): Future[T] = {
    Source.actorRef[T](0, OverflowStrategy.dropHead)
      .mapMaterializedValue(f)
      .runWith(Sink.head[T])
  }

  def sendMessageToActor[T](recipient: ActorRef, message: Any)(implicit actorMaterializer: ActorMaterializer): Future[T] = {
    sendMessageWithFunc[T](sender => recipient.tell(message, sender))
  }
}

Add a generic parameter to the method

Add a generic parameter to the method


package glint

import glint.partitioning.UniformPartitioner
import org.scalatest.Matchers._
import org.scalatest.FlatSpec

/**
  * Client test specification
  */
class PartitioningSpec extends FlatSpec {

  "A UniformPartitioner" should " partition all its keys within its partition space" in {
    val partitions = Set(0, 1, 2)
    val up = new UniformPartitioner(partitions.toArray, 19)
    for (key <- 0 until 19) {
      assert(partitions.contains(up.partition(key)))
    }
  }

  it should " fail when partitioning outside its key size" in {
    val up = new UniformPartitioner(Array(0, 1, 2, 3, 4), 11)
    an [IndexOutOfBoundsException] should be thrownBy up.partition(11)
    an [IndexOutOfBoundsException] should be thrownBy up.partition(-2)
  }

  it should " succeed when creating a partitioner with exactly the same amount of keys and partitions" in {
    val up = new UniformPartitioner(Array(0, 1, 2, 3), 4)
  }

}

package glint

import glint.partitioning.UniformPartitioner
import org.scalatest.Matchers._
import org.scalatest.FlatSpec

/**
  * Partitioning test specification
  */
class PartitioningSpec extends FlatSpec {

  "A UniformPartitioner" should " partition all its keys within its partition space" in {
    val partitions = Set(0, 1, 2)
    val up = new UniformPartitioner(partitions.toArray, 19)
    for (key <- 0 until 19) {
      assert(partitions.contains(up.partition(key)))
    }
  }

  it should " fail when partitioning outside its key size" in {
    val up = new UniformPartitioner(Array(0, 1, 2, 3, 4), 11)
    an [IndexOutOfBoundsException] should be thrownBy up.partition(11)
    an [IndexOutOfBoundsException] should be thrownBy up.partition(-2)
  }

  it should " succeed when creating a partitioner with exactly the same amount of keys and partitions" in {
    val up = new UniformPartitioner(Array(0, 1, 2, 3), 4)
  }

}

Fix comment for partitioning test specification


name := "cliwe"

organization := "com.github.lsgro"

version := "1.1-SNAPSHOT"

libraryDependencies ++= Seq(
  cache
)

play.Project.playScalaSettings

name := "cliwe"

organization := "com.github.lsgro"

version := "1.1-SNAPSHOT"

libraryDependencies ++= Seq(
  cache
)

scalacOptions += "-target:jvm-1.7"

play.Project.playScalaSettings

Enforce JDK 1.7 for the time being

Enforce JDK 1.7 for the time being


package lila.chess

import Pos._
import format.Visual.addNewLines

class GameTest extends ChessTest {

  "capture a piece" should {
    "add it to the dead pieces" in {
      val game = Game().playMoves(
        E2 -> E4,
        D7 -> D5,
        E4 -> D5)
      game must beSuccess.like {
        case g ⇒ g.deads must haveTheSameElementsAs(List(D5 -> Black.pawn))
      }
    }
  }
  "recapture a piece" should {
    "add both to the dead pieces" in {
      val game = Game("""
bq
R""").playMoves(
  A1 -> A2,
  B2 -> A2)
      game must beSuccess.like {
        case g ⇒ g.deads must haveTheSameElementsAs(List(
          A2 -> Black.bishop,
          A2 -> White.rook))
      }
    }
  }
}

package lila.chess

import Pos._
import format.Visual.addNewLines

class GameTest extends ChessTest {

  "capture a piece" should {
    "add it to the dead pieces" in {
      val game = Game().playMoves(
        E2 -> E4,
        D7 -> D5,
        E4 -> D5)
      game must beSuccess.like {
        case g ⇒ g.deads must haveTheSameElementsAs(List(D5 -> Black.pawn))
      }
    }
  }
  "recapture a piece" should {
    "add both to the dead pieces" in {
      val game = Game("""
bq
R""").playMoves(
        A1 -> A2,
        B2 -> A2)
      game must beSuccess.like {
        case g ⇒ g.deads must haveTheSameElementsAs(List(
          A2 -> Black.bishop,
          A2 -> White.rook))
      }
    }
  }
  "prevent castle by capturing a rook" should {
    val game = Game("""
 b
R   K""", Black)
    "can castle queenside" in {
      game.board.history canCastle White on QueenSide must_== true
    }
    "can still castle queenside" in {
      game.playMoves(B2 -> A3) must beSuccess.like {
        case g ⇒ g.board.history canCastle White on QueenSide must_== true
      }
    }
    "can not castle queenside anymore" in {
      game.playMoves(B2 -> A1) must beSuccess.like {
        case g ⇒ g.board.history canCastle White on QueenSide must_== false
      }
    }
  }
}

Test castle breakage by capture

Test castle breakage by capture


package au.gov.dva.sopapi.tests.parsers;

import au.gov.dva.dvasopapi.tests.TestUtils
import au.gov.dva.sopapi.interfaces.model.SoP
import au.gov.dva.sopapi.sopref.data.sops.StoredSop
import au.gov.dva.sopapi.sopref.parsing.implementations.LsSoPFactory
import org.junit.runner.RunWith
import org.scalatest.FunSuite
import org.scalatest.junit.JUnitRunner

import scala.io.Source

@RunWith(classOf[JUnitRunner])
class LumbarSpondylosisTests extends FunSuite{

  test("Parse entire RH LS SoP") {
    val result = ParserTestUtils.executeWholeParsingPipeline("F2014L00933","sops/rh/F2014L00933.pdf")
    System.out.print(TestUtils.prettyPrint(StoredSop.toJson(result)))
    assert(result != null)
  }

  test("Parse entire BoP LS SoP")
  {
    val result = ParserTestUtils.executeWholeParsingPipeline("F2014L00930","sops/bop/F2014L00930.pdf")
    System.out.println(TestUtils.prettyPrint(StoredSop.toJson(result)))
    assert(result != null)
  }

}

package au.gov.dva.sopapi.tests.parsers;

import au.gov.dva.dvasopapi.tests.TestUtils
import au.gov.dva.sopapi.sopref.data.sops.StoredSop
import org.junit.runner.RunWith
import org.scalatest.FunSuite
import org.scalatest.junit.JUnitRunner

@RunWith(classOf[JUnitRunner])
class LumbarSpondylosisTests extends FunSuite{

  test("Sanity test test"){
    assert(true)
  }

  test("Parse entire RH LS SoP") {
    val result = ParserTestUtils.executeWholeParsingPipeline("F2014L00933","sops/rh/F2014L00933.pdf")
    System.out.print(TestUtils.prettyPrint(StoredSop.toJson(result)))
    assert(result != null)
  }

  test("Parse entire BoP LS SoP")
  {
    val result = ParserTestUtils.executeWholeParsingPipeline("F2014L00930","sops/bop/F2014L00930.pdf")
    System.out.println(TestUtils.prettyPrint(StoredSop.toJson(result)))
    assert(result != null)
  }

}

Add test that always passes to same file as tests that mysteriously fail on CI.


package de.bripkens.ha

import akka.actor.{Actor, ActorLogging, Props}
import com.fasterxml.jackson.databind.ObjectMapper
import de.bripkens.ha.reporting.{ConsoleReporter, SlackReporter}

object AppActor {

  final val Name = "app"

  def props(mapper: ObjectMapper, config: Configuration) = Props(new AppActor(mapper, config))
}

class AppActor(val mapper: ObjectMapper, val config: Configuration) extends Actor
                                                                    with ActorLogging {

  val reporters = config.reporters.map{ case (name, reporterConfig) =>
    val props = reporterConfig match {
      case config: ConsoleReporterConfig => ConsoleReporter.props(mapper, config)
      case config: SlackReporterConfig   => SlackReporter.props(mapper, config)
    }

    val actor = context.actorOf(props, s"reporter-$name")
    (name, actor)
  }

  config.endpoints.foreach { endpoint =>
    if (!reporters.contains(endpoint.reporter)) {
      log.error(s"Reporter ${endpoint.reporter} does not exist.")
      System.exit(1)
    }
    val reporter = reporters(endpoint.reporter)
    context.actorOf(
      HealthCheckActor.props(mapper, config, endpoint, reporter),
      s"healthCheck-${endpoint.id}"
    )
  }

  override def receive: Receive = {
    case unsupported => log.error(s"Unsupported message received: $unsupported")
  }
}

package de.bripkens.ha

import akka.actor.{Actor, ActorLogging, Props}
import com.fasterxml.jackson.databind.ObjectMapper
import de.bripkens.ha.reporting.{ConsoleReporter, SlackReporter}

object AppActor {

  final val Name = "app"

  def props(mapper: ObjectMapper, config: Configuration) = Props(new AppActor(mapper, config))
}

class AppActor(val mapper: ObjectMapper, val config: Configuration) extends Actor
                                                                    with ActorLogging {

  val reporters = config.reporters.map{ case (name, reporterConfig) =>
    val props = reporterConfig match {
      case config: ConsoleReporterConfig => ConsoleReporter.props(mapper, config)
      case config: SlackReporterConfig   => SlackReporter.props(mapper, config)
    }

    val actor = context.actorOf(props, s"reporter-$name")
    (name, actor)
  }

  config.endpoints.foreach { endpoint =>
    if (!reporters.contains(endpoint.reporter)) {
      log.error(s"Reporter ${endpoint.reporter} does not exist.")
      System.exit(1)
    }
    val reporter = reporters(endpoint.reporter)
    context.actorOf(
      HealthCheckActor.props(mapper, config, endpoint, reporter),
      s"healthCheck-${endpoint.id}"
    )
  }

  override def receive = Actor.emptyBehavior

}

Use empty behavior instead of swallowing unhandled messages


package nbmtools

import java.io.InputStream
import java.util.zip.ZipInputStream

object appendExternal {
    def apply(s: String): String = s + ".external"
    def unapply(s: String): Option[String] = {
        if (s.endsWith(".external"))
            Some(s.stripSuffix(".external"))
        else None
    }
}

class NbmInputStream(is: InputStream) extends ZipInputStream(is) {
    private var externalStream: Option[InputStream] = None

    override def getNextEntry() = {
        val originalEntry = super.getNextEntry
        if (originalEntry == null) null
        else
            originalEntry.getName match {
                case appendExternal(name) => {
                        val external = External.from(this)
                        externalStream = Some(external.openStream())
                        val entry = createZipEntry(name)
                        entry
                }
                case name => {
                        externalStream = None
                        originalEntry
                }
            }
    }

    override def read(b: Array[Byte], off: Int, len: Int): Int = {
        externalStream match {
            case None => super.read(b, off, len)
            case Some(es) => es.read(b, off, len)
        }
    }
}

package nbmtools

import java.io.File
import java.io.FileInputStream
import java.io.InputStream
import java.util.zip.ZipInputStream

object appendExternal {
    def apply(s: String): String = s + ".external"
    def unapply(s: String): Option[String] = {
        if (s.endsWith(".external"))
            Some(s.stripSuffix(".external"))
        else None
    }
}

class NbmInputStream(is: InputStream) extends ZipInputStream(is) {
    private var externalStream: Option[InputStream] = None

    def this(file: File) = { this(new FileInputStream(file)) }

    override def getNextEntry() = {
        val originalEntry = super.getNextEntry
        if (originalEntry == null) null
        else
            originalEntry.getName match {
                case appendExternal(name) => {
                        val external = External.from(this)
                        externalStream = Some(external.openStream())
                        val entry = createZipEntry(name)
                        entry
                }
                case name => {
                        externalStream = None
                        originalEntry
                }
            }
    }

    override def read(b: Array[Byte], off: Int, len: Int): Int = {
        externalStream match {
            case None => super.read(b, off, len)
            case Some(es) => es.read(b, off, len)
        }
    }
}

Add overloaded constructor which takes File


import sbt._, Keys._
import dotty.tools.sbtplugin.DottyPlugin.autoImport._

object Dependencies {
  val servletApiDep = "jakarta.servlet" % "jakarta.servlet-api" % "5.0.0"

  val specs2Dep = Def.setting {
    "org.specs2" %% "specs2-core" % "4.10.6" withDottyCompat scalaVersion.value
  }

  def okHttp = "com.squareup.okhttp3" % "okhttp" % "4.9.1" :: Nil

  def integrationTestDeps = Def.setting((specs2Dep.value :: okHttp) map { _ % "test" })

  val commonsCodecVersion = "1.15"
  val scalaXmlVersion = "1.3.0"
  val commonsIoVersion = "2.8.0"
  val commonsFileUploadVersion = "1.4"
  val jettyVersion = "11.0.0"
  val nettyVersion = "4.1.59.Final"
  val scalatestVersion = "3.2.4"
  val scalatestScalacheckVersion = "3.2.4.0"
  val json4sVersion = "3.6.10"
  val asyncHttpClientVersion = "1.8.17"
  val javaxActivationVersion = "1.1.1"
}

import sbt._, Keys._
import dotty.tools.sbtplugin.DottyPlugin.autoImport._

object Dependencies {
  val servletApiDep = "jakarta.servlet" % "jakarta.servlet-api" % "5.0.0"

  val specs2Dep = Def.setting {
    "org.specs2" %% "specs2-core" % "4.10.6" withDottyCompat scalaVersion.value
  }

  def okHttp = "com.squareup.okhttp3" % "okhttp" % "4.9.1" :: Nil

  def integrationTestDeps = Def.setting((specs2Dep.value :: okHttp) map { _ % "test" })

  val commonsCodecVersion = "1.15"
  val scalaXmlVersion = "1.3.0"
  val commonsIoVersion = "2.8.0"
  val commonsFileUploadVersion = "1.4"
  val jettyVersion = "11.0.0"
  val nettyVersion = "4.1.59.Final"
  val scalatestVersion = "3.2.5"
  val scalatestScalacheckVersion = "3.2.4.0"
  val json4sVersion = "3.6.10"
  val asyncHttpClientVersion = "1.8.17"
  val javaxActivationVersion = "1.1.1"
}

Update scalatest, scalatest-core to 3.2.5


import sbt._, Keys._
import dotty.tools.sbtplugin.DottyPlugin.autoImport._

object Dependencies {
  val servletApiDep = "jakarta.servlet" % "jakarta.servlet-api" % "5.0.0"

  val specs2Dep = Def.setting {
    "org.specs2" %% "specs2-core" % "4.10.5" withDottyCompat scalaVersion.value
  }

  def okHttp = "com.squareup.okhttp3" % "okhttp" % "4.9.0" :: Nil

  def integrationTestDeps = Def.setting((specs2Dep.value :: okHttp) map { _ % "test" })

  val commonsCodecVersion = "1.15"
  val scalaXmlVersion = "1.3.0"
  val commonsIoVersion = "2.8.0"
  val commonsFileUploadVersion = "1.4"
  val jettyVersion = "11.0.0"
  val nettyVersion = "4.1.57.Final"
  val scalatestVersion = "3.2.3"
  val scalatestScalacheckVersion = "3.2.3.0"
  val json4sVersion = "3.6.10"
  val asyncHttpClientVersion = "1.8.17"
  val javaxActivationVersion = "1.1.1"
}

import sbt._, Keys._
import dotty.tools.sbtplugin.DottyPlugin.autoImport._

object Dependencies {
  val servletApiDep = "jakarta.servlet" % "jakarta.servlet-api" % "5.0.0"

  val specs2Dep = Def.setting {
    "org.specs2" %% "specs2-core" % "4.10.5" withDottyCompat scalaVersion.value
  }

  def okHttp = "com.squareup.okhttp3" % "okhttp" % "4.9.0" :: Nil

  def integrationTestDeps = Def.setting((specs2Dep.value :: okHttp) map { _ % "test" })

  val commonsCodecVersion = "1.15"
  val scalaXmlVersion = "1.3.0"
  val commonsIoVersion = "2.8.0"
  val commonsFileUploadVersion = "1.4"
  val jettyVersion = "11.0.0"
  val nettyVersion = "4.1.58.Final"
  val scalatestVersion = "3.2.3"
  val scalatestScalacheckVersion = "3.2.3.0"
  val json4sVersion = "3.6.10"
  val asyncHttpClientVersion = "1.8.17"
  val javaxActivationVersion = "1.1.1"
}

Update netty-codec-http, netty-handler, ... to 4.1.58.Final


import com.typesafe.sbt.packager.docker.DockerPlugin.autoImport._
import com.typesafe.sbt.packager.docker.ExecCmd
import com.typesafe.sbt.packager.linux.LinuxPlugin.autoImport._

object DockerConfig {
  val baseSettings = Seq(daemonUser in Docker := "root",
    dockerExposedPorts := Seq(65327),
    dockerBaseImage := "openjdk:8",
    dockerRepository := Some("combustml"),
    dockerBuildOptions := Seq("-t", dockerAlias.value.versioned) ++ (
      if (dockerUpdateLatest.value)
        Seq("-t", dockerAlias.value.latest)
      else
        Seq()
      ),
    dockerCommands := dockerCommands.value.filterNot {
      case ExecCmd("RUN", args @ _*) => args.contains("chown")
      case cmd => false
    })
}

import com.typesafe.sbt.packager.docker.DockerPlugin.autoImport._
import com.typesafe.sbt.packager.docker.ExecCmd
import com.typesafe.sbt.packager.linux.LinuxPlugin.autoImport._

object DockerConfig {
  val baseSettings = Seq(daemonUser in Docker := "root",
    dockerExposedPorts := Seq(65327),
    dockerBaseImage := "openjdk:8-jre-slim",
    dockerRepository := Some("combustml"),
    dockerBuildOptions := Seq("-t", dockerAlias.value.versioned) ++ (
      if (dockerUpdateLatest.value)
        Seq("-t", dockerAlias.value.latest)
      else
        Seq()
      ),
    dockerCommands := dockerCommands.value.filterNot {
      case ExecCmd("RUN", args @ _*) => args.contains("chown")
      case cmd => false
    })
}

Use openjdk:8-jre-slim as docker base image


package lila.common

import play.api.data.Forms._

object Form {

  def options(it: Iterable[Int], pattern: String) = it map { d =>
    d -> (pluralize(pattern, d) format d)
  }

  def options(it: Iterable[Int], code: String, pattern: String) = it map { d =>
    (d + code) -> (pluralize(pattern, d) format d)
  }

  def numberIn(choices: Iterable[(Int, String)]) =
    number.verifying(hasKey(choices, _))

  def stringIn(choices: Iterable[(String, String)]) =
    nonEmptyText.verifying(hasKey(choices, _))

  def hasKey[A](choices: Iterable[(A, _)], key: A) =
    choices.map(_._1).toList contains key

  private def pluralize(pattern: String, nb: Int) =
    pattern.replace("{s}", (nb > 1).fold("s", ""))
}

package lila.common

import play.api.data.Forms._

object Form {

  def options(it: Iterable[Int], pattern: String) = it map { d =>
    d -> (pluralize(pattern, d) format d)
  }

  def options(it: Iterable[Int], code: String, pattern: String) = it map { d =>
    (d + code) -> (pluralize(pattern, d) format d)
  }

  def numberIn(choices: Iterable[(Int, String)]) =
    number.verifying(hasKey(choices, _))

  def stringIn(choices: Iterable[(String, String)]) =
    nonEmptyText.verifying(hasKey(choices, _))

  def hasKey[A](choices: Iterable[(A, _)], key: A) =
    choices.map(_._1).toList contains key

  private def pluralize(pattern: String, nb: Int) =
    pattern.replace("{s}", (nb != 1).fold("s", ""))
}

Improve `pluralize` method: correct output for "0"


package io.continuum.bokeh

@model abstract class Range extends Model {
    object callback extends Field[Callback]
}

@model class Range1d extends Range {
    object start extends Field[Double]
    object end extends Field[Double]

    // TODO: bounds = MinMaxBounds(accept_datetime=True, default=None)
}

@model abstract class DataRange extends Range {
    object names extends Field[List[String]]
    object renderers extends Field[List[Renderer]]
}

@model class DataRange1d extends DataRange {
    object range_padding extends Field[Double](0.1)

    object start extends Field[Double]
    object end extends Field[Double]

    // TODO: bounds = MinMaxBounds(accept_datetime=False, default=None)

    object flipped extends Field[Boolean](false)
    object follow extends Field[Option[StartEnd]]
    object follow_interval extends Field[Option[Double]]
    object default_span extends Field[Double](2.0)
}

@model class FactorRange extends Range {
    object offset extends Field[Double](0)
    object factors extends Field[List[String]] // TODO: also List[Int]

    // TODO: bounds = Either(Auto, List(String), List(Int), default=None)
}

package io.continuum.bokeh

@model abstract class Range extends Model {
    object callback extends Field[Callback]
}

object Range1d {
    def apply(): Range1d = new Range1d()
    def apply(start: Double, end: Double): Range1d = new Range1d().start(start).end(end)
}
@model class Range1d extends Range {
    object start extends Field[Double]
    object end extends Field[Double]

    // TODO: bounds = MinMaxBounds(accept_datetime=True, default=None)
}

@model abstract class DataRange extends Range {
    object names extends Field[List[String]]
    object renderers extends Field[List[Renderer]]
}

@model class DataRange1d extends DataRange {
    object range_padding extends Field[Double](0.1)

    object start extends Field[Double]
    object end extends Field[Double]

    // TODO: bounds = MinMaxBounds(accept_datetime=False, default=None)

    object flipped extends Field[Boolean](false)
    object follow extends Field[Option[StartEnd]]
    object follow_interval extends Field[Option[Double]]
    object default_span extends Field[Double](2.0)
}

@model class FactorRange extends Range {
    object offset extends Field[Double](0)
    object factors extends Field[List[String]] // TODO: also List[Int]

    // TODO: bounds = Either(Auto, List(String), List(Int), default=None)
}

Add companion object to Range1d with shorthand constructors


import bintray.Keys._

name := "play-scalajs-scripts"

version := "0.1.0"

organization := "com.vmunier"

homepage := Some(url("https://github.com/vmunier/play-scalajs-scripts"))

crossScalaVersions := Seq("2.10.4", "2.11.2")

// PlayScala needs to be enabled, SbtTwirl can't be used alone because play.api.Play is needed
enablePlugins(PlayScala)

licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0"))

pomExtra := (
  <scm>
    <url>git@github.com:vmunier/play-scalajs-scripts.git</url>
    <connection>scm:git:git@github.com:vmunier/play-scalajs-scripts.git</connection>
  </scm>
  <developers>
    <developer>
      <id>vmunier</id>
      <name>Vincent Munier</name>
      <url>https://github.com/vmunier</url>
    </developer>
  </developers>
)
publishMavenStyle := true
repository in bintray := "scalajs"
bintrayPublishSettings

import bintray.Keys._

name := "play-scalajs-scripts"

version := "0.1.0"

organization := "com.vmunier"

homepage := Some(url("https://github.com/vmunier/play-scalajs-scripts"))

crossScalaVersions := Seq("2.10.4", "2.11.2")

unmanagedSourceDirectories in Compile += target.value / ("scala-" + scalaBinaryVersion.value) / "twirl" / "main"

// PlayScala needs to be enabled, SbtTwirl can't be used alone because play.api.Play is needed
enablePlugins(PlayScala)

licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0"))

pomExtra := (
  <scm>
    <url>git@github.com:vmunier/play-scalajs-scripts.git</url>
    <connection>scm:git:git@github.com:vmunier/play-scalajs-scripts.git</connection>
  </scm>
  <developers>
    <developer>
      <id>vmunier</id>
      <name>Vincent Munier</name>
      <url>https://github.com/vmunier</url>
    </developer>
  </developers>
)
publishMavenStyle := true
repository in bintray := "scalajs"
bintrayPublishSettings

Add an unmanaged source directory so that the source JAR file contains the compiled twirl templates which are Scala files.


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.8"

crossScalaVersions := Seq("2.12.8")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.5" % Test,
      compilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.3.0"),
      "com.github.ghik" %% "silencer-lib" % "1.3.0" % Provided,
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

// silence all warnings on autogenerated files
scalacOptions += "-P:silencer:pathFilters=src/main/scala/io/flow/generated/.*"

// Make sure you only exclude warnings for the project directories, i.e. make builds reproducible
scalacOptions += s"-P:silencer:sourceRoots=${baseDirectory.value.getCanonicalPath}"

version := "0.2.18"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.8"

crossScalaVersions := Seq("2.12.8")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.5" % Test,
      compilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.3.0"),
      "com.github.ghik" %% "silencer-lib" % "1.3.0" % Provided,
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

// silence all warnings on autogenerated files
scalacOptions += "-P:silencer:pathFilters=src/main/scala/io/flow/generated/.*"

// Make sure you only exclude warnings for the project directories, i.e. make builds reproducible
scalacOptions += s"-P:silencer:sourceRoots=${baseDirectory.value.getCanonicalPath}"

version := "0.2.19"

autocommit: Update configuration to record version 0.2.19


import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.60"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.4",
      "com.ning" % "async-http-client" % "1.9.38",
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.61"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.4",
      "com.ning" % "async-http-client" % "1.9.38",
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

autocommit: Update configuration to record version 0.0.61


organization := "reaktor"

name := "scct"

version := "0.2-SNAPSHOT"

scalaVersion := "2.9.2"

crossScalaVersions := Seq("2.9.2", "2.9.1-1", "2.9.1", "2.9.0-1", "2.9.0")

libraryDependencies <+= (scalaVersion) { v =>
  "org.scala-lang" % "scala-compiler" % v % "provided"
}

libraryDependencies ++= Seq(
  "it.unimi.dsi" % "fastutil" % "6.4.3" withSources,
  "junit" % "junit" % "4.7" % "test" withSources,
  "org.mockito" % "mockito-all" % "1.8.5" % "test" withSources,
  "org.specs2" % "specs2" % "1.11" % "test" cross CrossVersion.binaryMapped {
    case "2.9.0-1" => "2.9.1"
    case "2.9.0" => "2.9.1"
    case x => x
  }
)

publishTo := Some(Resolver.file("file",  new File("../gh-pages/maven-repo")))

resolvers += "scala-tools-releases" at "https://oss.sonatype.org/content/groups/scala-tools/"

organization := "reaktor"

name := "scct"

version := "0.2-SNAPSHOT"

scalaVersion := "2.9.2"

crossScalaVersions := Seq("2.9.2", "2.9.1-1", "2.9.1", "2.9.0-1", "2.9.0")

libraryDependencies <+= (scalaVersion) { v =>
  "org.scala-lang" % "scala-compiler" % v % "provided"
}

libraryDependencies ++= Seq(
  "it.unimi.dsi" % "fastutil" % "6.4.3" withSources,
  "junit" % "junit" % "4.10" % "test",
  "org.mockito" % "mockito-all" % "1.9.5-rc1" % "test" withSources,
  "org.specs2" % "specs2" % "1.11" % "test" cross CrossVersion.binaryMapped {
    case "2.9.0-1" => "2.9.1"
    case "2.9.0" => "2.9.1"
    case x => x
  }
)

publishTo := Some(Resolver.file("file",  new File("../gh-pages/maven-repo")))

resolvers += "scala-tools-releases" at "https://oss.sonatype.org/content/groups/scala-tools/"

Update test deps so mabbe ivy can find something in the internets


scalaVersion := "2.10.3"

libraryDependencies += "com.novocode" % "junit-interface" % "0.9" % "test"

javacOptions in doc := Seq("-taglet", "ExampleCodeTaglet",
"-tagletpath", "./project/target/scala-2.9.2/sbt-0.12/classes",
"-bottom", """<link rel='stylesheet' href='http://yandex.st/highlightjs/7.4/styles/default.min.css'><script src='http://yandex.st/highlightjs/7.4/highlight.min.js'></script><script>hljs.initHighlightingOnLoad();</script>""")

scalaVersion := "2.10.3"

libraryDependencies += "com.novocode" % "junit-interface" % "0.9" % "test"

javacOptions in doc := Seq("-taglet", "ExampleCodeTaglet",
"-tagletpath", "./project/target/scala-2.9.2/sbt-0.12/classes",
"-bottom", """<link rel='stylesheet' href='http://yandex.st/highlightjs/7.4/styles/default.min.css'><script src='http://yandex.st/highlightjs/7.4/highlight.min.js'></script><script>hljs.initHighlightingOnLoad();</script><style>code {font-size: 1.0em;font-family: monospace;}</style>""")

Improve style of code highlighting through decreasing font size.


import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.6"

version := "0.1.78"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.6.9",
      "com.ning" % "async-http-client" % "1.9.40",
      "org.scalatest" %% "scalatest" % "3.0.5" % Test
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.6"

version := "0.1.79"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.6.9",
      "com.ning" % "async-http-client" % "1.9.40",
      "org.scalatest" %% "scalatest" % "3.0.5" % Test
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

autocommit: Update configuration to record version 0.1.79


package io.continuum.bokeh

@model class Plot extends Widget {
    object title extends Field[String]("")

    title = include[TextProps]
    outline = include[LineProps]

    object x_range extends Field[Range]
    object y_range extends Field[Range]

    object extra_x_ranges extends Field[Map[String, Range]]
    object extra_y_ranges extends Field[Map[String, Range]]

    object x_mapper_type extends Field[String]("auto")
    object y_mapper_type extends Field[String]("auto")

    object renderers extends Field[List[Renderer]]
    object tools extends Field[List[Tool]] with ToolsField

    object left extends Field[List[PlotObject]]
    object right extends Field[List[PlotObject]]
    object above extends Field[List[PlotObject]]
    object below extends Field[List[PlotObject]]

    object toolbar_location extends Field[Location](Location.Above)
    object logo extends Field[Logo](Logo.Normal)

    object plot_width extends Field[Int](600)
    object plot_height extends Field[Int](600)

    def width = plot_width
    def height = plot_height

    object background_fill extends Field[Color](Color.White)
    object border_fill extends Field[Color](Color.White)

    object min_border_top extends Field[Int]
    object min_border_bottom extends Field[Int]
    object min_border_left extends Field[Int]
    object min_border_right extends Field[Int]
    object min_border extends Field[Int]

    object h_symmetry extends Field[Boolean](true)
    object v_symmetry extends Field[Boolean](false)
}

package io.continuum.bokeh

@model class Plot extends Widget {
    object title extends Field[String]("")

    title = include[TextProps]
    outline = include[LineProps]

    object x_range extends Field[Range]
    object y_range extends Field[Range]

    object extra_x_ranges extends Field[Map[String, Range]]
    object extra_y_ranges extends Field[Map[String, Range]]

    object x_mapper_type extends Field[String]("auto")
    object y_mapper_type extends Field[String]("auto")

    object renderers extends Field[List[Renderer]]
    object tools extends Field[List[Tool]] with ToolsField

    object left extends Field[List[Renderer]]
    object right extends Field[List[Renderer]]
    object above extends Field[List[Renderer]]
    object below extends Field[List[Renderer]]

    object toolbar_location extends Field[Location](Location.Above)
    object logo extends Field[Logo](Logo.Normal)

    object plot_width extends Field[Int](600)
    object plot_height extends Field[Int](600)

    def width = plot_width
    def height = plot_height

    object background_fill extends Field[Color](Color.White)
    object border_fill extends Field[Color](Color.White)

    object min_border_top extends Field[Int]
    object min_border_bottom extends Field[Int]
    object min_border_left extends Field[Int]
    object min_border_right extends Field[Int]
    object min_border extends Field[Int]

    object h_symmetry extends Field[Boolean](true)
    object v_symmetry extends Field[Boolean](false)
}

Use more specific types for Plot.{left,right,above,below}


package lila.common

import java.util.regex.Matcher.quoteReplacement

import ornicar.scalalib.Random
import play.api.mvc.{ Cookie, Session, RequestHeader }

object LilaCookie {

  private val domainRegex = """^.+(\.[^\.]+\.[^\.]+)$""".r

  private def domain(req: RequestHeader): String =
    domainRegex.replaceAllIn(req.domain, m => quoteReplacement(m group 1))

  val sessionId = "sid"

  def makeSessionId(implicit req: RequestHeader) = session(sessionId, Random nextStringUppercase 8)

  def session(name: String, value: String)(implicit req: RequestHeader): Cookie = withSession { s =>
    s + (name -> value)
  }

  def newSession(implicit req: RequestHeader): Cookie = withSession(identity)

  def withSession(op: Session => Session)(implicit req: RequestHeader): Cookie = cookie(
    Session.COOKIE_NAME,
    Session.encode(Session.serialize(op(req.session)))
  )

  def cookie(name: String, value: String, maxAge: Option[Int] = None, httpOnly: Option[Boolean] = None)(implicit req: RequestHeader): Cookie = Cookie(
    name,
    value,
    maxAge orElse Session.maxAge orElse 86400.some,
    "/",
    domain(req).some,
    Session.secure,
    httpOnly | Session.httpOnly)
}

package lila.common

import java.util.regex.Matcher.quoteReplacement

import ornicar.scalalib.Random
import play.api.mvc.{ Cookie, Session, RequestHeader }

object LilaCookie {

  private val domainRegex = """^.+(\.[^\.]+\.[^\.]+)$""".r

  private def domain(req: RequestHeader): String =
    domainRegex.replaceAllIn(req.domain, m => quoteReplacement(m group 1))

  val sessionId = "sid"

  def makeSessionId(implicit req: RequestHeader) = session(sessionId, Random nextStringUppercase 8)

  def session(name: String, value: String)(implicit req: RequestHeader): Cookie = withSession { s =>
    s + (name -> value)
  }

  def newSession(implicit req: RequestHeader): Cookie = withSession(identity)

  def withSession(op: Session => Session)(implicit req: RequestHeader): Cookie = cookie(
    Session.COOKIE_NAME,
    Session.encode(Session.serialize(op(req.session)))
  )

  def cookie(name: String, value: String, maxAge: Option[Int] = None, httpOnly: Option[Boolean] = None)(implicit req: RequestHeader): Cookie = Cookie(
    name,
    value,
    maxAge orElse Session.maxAge orElse 86400.some,
    "/",
    domain(req).some,
    Session.secure || req.headers.get("X-Forwarded-Proto").exists(_ == "https"),
    httpOnly | Session.httpOnly)
}

Use secure cookies on HTTPS connections

Use secure cookies on HTTPS connections


package com.github.sstone.amqp.proxy.serializers

import akka.serialization.Serializer
import org.json4s._
import org.json4s.jackson.JsonMethods._
import org.json4s.jackson.Serialization

object JsonSerializer extends Serializer {
  implicit val formats = Serialization.formats(NoTypeHints) ++ org.json4s.ext.JodaTimeSerializers.all

  def identifier = 123456789

  def includeManifest = true

  def toBinary(o: AnyRef) = Serialization.write(o).getBytes("UTF-8")

  def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = {
    require(manifest.isDefined)
    val string = new String(bytes)
    implicit val mf = Manifest.classType(manifest.get)
    Serialization.read(string)
  }
}

package com.github.sstone.amqp.proxy.serializers

import akka.serialization.Serializer
import org.json4s._
import org.json4s.jackson.JsonMethods._
import org.json4s.jackson.Serialization

object JsonSerializer extends Serializer {
  implicit val formats = org.json4s.DefaultFormats ++ org.json4s.ext.JodaTimeSerializers.all

  def identifier = 123456789

  def includeManifest = true

  def toBinary(o: AnyRef) = Serialization.write(o).getBytes("UTF-8")

  def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = {
    require(manifest.isDefined)
    val string = new String(bytes)
    implicit val mf = Manifest.classType(manifest.get)
    Serialization.read(string)
  }
}

Fix for json date serialization

Fix for json date serialization


import sbt._

object Dependencies {

  val resolutionRepos = Seq(
    // "typesafe repo"   at "http://repo.typesafe.com/typesafe/releases/",
  )

  def compile   (deps: ModuleID*): Seq[ModuleID] = deps map (_ % "compile")
  def provided  (deps: ModuleID*): Seq[ModuleID] = deps map (_ % "provided")
  def test      (deps: ModuleID*): Seq[ModuleID] = deps map (_ % "test")
  def runtime   (deps: ModuleID*): Seq[ModuleID] = deps map (_ % "runtime")
  def container (deps: ModuleID*): Seq[ModuleID] = deps map (_ % "container")

  val asmVersion  = "9.1"
  val asm         = "org.ow2.asm"   %  "asm"           % asmVersion
  val asmTree     = "org.ow2.asm"   %  "asm-tree"      % asmVersion
  val asmAnalysis = "org.ow2.asm"   %  "asm-analysis"  % asmVersion
  val asmUtil     = "org.ow2.asm"   %  "asm-util"      % asmVersion
  val testNG      = "org.scalatestplus" %% "testng-6-7" % "3.2.9.0"

  def scalatest(scalaVersion: String) = {
    Seq("org.scalatest" %% "scalatest" % "3.2.9")
  }
}

import sbt._

object Dependencies {

  val resolutionRepos = Seq(
    // "typesafe repo"   at "http://repo.typesafe.com/typesafe/releases/",
  )

  def compile   (deps: ModuleID*): Seq[ModuleID] = deps map (_ % "compile")
  def provided  (deps: ModuleID*): Seq[ModuleID] = deps map (_ % "provided")
  def test      (deps: ModuleID*): Seq[ModuleID] = deps map (_ % "test")
  def runtime   (deps: ModuleID*): Seq[ModuleID] = deps map (_ % "runtime")
  def container (deps: ModuleID*): Seq[ModuleID] = deps map (_ % "container")

  val asmVersion  = "9.2"
  val asm         = "org.ow2.asm"   %  "asm"           % asmVersion
  val asmTree     = "org.ow2.asm"   %  "asm-tree"      % asmVersion
  val asmAnalysis = "org.ow2.asm"   %  "asm-analysis"  % asmVersion
  val asmUtil     = "org.ow2.asm"   %  "asm-util"      % asmVersion
  val testNG      = "org.scalatestplus" %% "testng-6-7" % "3.2.9.0"

  def scalatest(scalaVersion: String) = {
    Seq("org.scalatest" %% "scalatest" % "3.2.9")
  }
}

Update asm, asm-analysis, asm-tree, asm-util to 9.2


package pdi.jwt

import org.apache.commons.codec.binary.Base64

trait JwtBase64Impl {
  def encode(value: Array[Byte]): Array[Byte] = Base64.encodeBase64URLSafe(value)
  def decode(value: Array[Byte]): Array[Byte] = Base64.decodeBase64(value)

  def decode(value: String): Array[Byte] = Base64.decodeBase64(value)

  def encodeString(value: Array[Byte]): String = Base64.encodeBase64URLSafeString(value)

  def decodeNonSafe(value: Array[Byte]): Array[Byte] = Base64.decodeBase64(value)
  def decodeNonSafe(value: String): Array[Byte] = Base64.decodeBase64(value)
}

package pdi.jwt

import org.apache.commons.codec.binary.Base64
import org.apache.commons.codec.binary.StringUtils

trait JwtBase64Impl {
  // Apache Commons Codec fails grafully by returning empty string for anything it cannot decode
  // To simulate the new Java 1.8 behaviour, we need to throw IllegalArgumentException if the
  // value to decode is actually wrong
  private def validateBase64(value: Array[Byte]): Unit = if (value.length % 4 == 1) {
    if (value.length == 1) { throw new IllegalArgumentException("Input byte[] should at least have 2 bytes for base64 bytes") }
    else { throw new IllegalArgumentException("Last unit does not have enough valid bits") }
  } else if (!Base64.isBase64(value)) {
    throw new IllegalArgumentException("Illegal base64 character")
  }

  private def validateBase64(value: String): Unit = validateBase64(StringUtils.getBytesUtf8(value))

  def encode(value: Array[Byte]): Array[Byte] = Base64.encodeBase64URLSafe(value)

  def decode(value: Array[Byte]): Array[Byte] = {
    validateBase64(value)
    Base64.decodeBase64(value)
  }

  def decode(value: String): Array[Byte] = {
    validateBase64(value)
    Base64.decodeBase64(value)
  }

  def encodeString(value: Array[Byte]): String = Base64.encodeBase64URLSafeString(value)

  def decodeNonSafe(value: Array[Byte]): Array[Byte] = {
    validateBase64(value)
    Base64.decodeBase64(value)
  }

  def decodeNonSafe(value: String): Array[Byte] = {
    validateBase64(value)
    Base64.decodeBase64(value)
  }
}

Fix legacy Base64 to thrown when fail to decode to align with Java 8


/*
 * Copyright 2014-2020 http4s.org
 *
 * SPDX-License-Identifier: Apache-2.0
 */

package org.http4s.blaze.internal

private[blaze] object compat {
  val CollectionConverters = scala.jdk.CollectionConverters
}

Add copyright header for 2.13 sources

Add copyright header for 2.13 sources