Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Set the version back to something sensible.
import sbt.Keys.version import sbt._ object Common { val versionString = "9.16-SNAPSHOT" val scalaVersionString = "2.10.3" val organisationString = "dvla" val organisationNameString = "Driver & Vehicle Licensing Agency" val nexus = "http://rep002-01.skyscape.preview-dvla.co.uk:8081/nexus/content/repositories" val scalaOptionsSeq = Seq( "-deprecation", "-unchecked", "-feature", "-Xlint", "-language:reflectiveCalls", "-Xmax-classfile-name", "128" ) val projectResolvers = Seq( "typesafe repo" at "http://repo.typesafe.com/typesafe/releases", "spray repo" at "http://repo.spray.io/", "local nexus snapshots" at s"$nexus/snapshots", "local nexus releases" at s"$nexus/releases" ) val publishResolver: sbt.Def.Initialize[Option[sbt.Resolver]] = version { v: String => if (v.trim.endsWith("SNAPSHOT")) Some("snapshots" at s"$nexus/snapshots") else if (v.trim.endsWith("LOCAL")) None // Do not publish local test versions that are accidentally committed. else Some("releases" at s"$nexus/releases") } val sbtCredentials = Credentials(Path.userHome / ".sbt/.credentials") val testProjectName = "common-test" }
import sbt.Keys.version import sbt._ object Common { val versionString = "2.16-SNAPSHOT" val scalaVersionString = "2.10.3" val organisationString = "dvla" val organisationNameString = "Driver & Vehicle Licensing Agency" val nexus = "http://rep002-01.skyscape.preview-dvla.co.uk:8081/nexus/content/repositories" val scalaOptionsSeq = Seq( "-deprecation", "-unchecked", "-feature", "-Xlint", "-language:reflectiveCalls", "-Xmax-classfile-name", "128" ) val projectResolvers = Seq( "typesafe repo" at "http://repo.typesafe.com/typesafe/releases", "spray repo" at "http://repo.spray.io/", "local nexus snapshots" at s"$nexus/snapshots", "local nexus releases" at s"$nexus/releases" ) val publishResolver: sbt.Def.Initialize[Option[sbt.Resolver]] = version { v: String => if (v.trim.endsWith("SNAPSHOT")) Some("snapshots" at s"$nexus/snapshots") else if (v.trim.endsWith("LOCAL")) None // Do not publish local test versions that are accidentally committed. else Some("releases" at s"$nexus/releases") } val sbtCredentials = Credentials(Path.userHome / ".sbt/.credentials") val testProjectName = "common-test" }
Test for display prototype and progress bar
package controllers.disposal_of_vehicle import helpers.common.CookieHelper import play.api.test.FakeRequest import play.api.test.Helpers._ import helpers.disposal_of_vehicle.CookieFactoryForUnitSpecs import helpers.UnitSpec import helpers.WithApplication import pages.disposal_of_vehicle.DisposeFailurePage import CookieHelper._ import scala.Some import play.api.Play final class DisposeFailureUnitSpec extends UnitSpec { "present" should { "display the page" in new WithApplication { whenReady(present) { r => r.header.status should equal(OK) } } "not display progress bar" in new WithApplication { contentAsString(present) should not include "Step " } "display prototype message when config set to true" in new WithApplication { contentAsString(present) should include("""<div class="prototype">""") } } private lazy val present = { val disposeFailure = injector.getInstance(classOf[DisposeFailure]) val request = FakeRequest(). withCookies(CookieFactoryForUnitSpecs.traderDetailsModel()). withCookies(CookieFactoryForUnitSpecs.vehicleDetailsModel()). withCookies(CookieFactoryForUnitSpecs.disposeFormModel()). withCookies(CookieFactoryForUnitSpecs.disposeTransactionId()) disposeFailure.present(request) } }
package controllers.disposal_of_vehicle import common.ClientSideSessionFactory import helpers.common.CookieHelper import org.mockito.Mockito._ import play.api.test.FakeRequest import play.api.test.Helpers._ import helpers.disposal_of_vehicle.CookieFactoryForUnitSpecs import helpers.UnitSpec import helpers.WithApplication import pages.disposal_of_vehicle.DisposeFailurePage import CookieHelper._ import utils.helpers.Config import scala.Some import play.api.Play final class DisposeFailureUnitSpec extends UnitSpec { "present" should { "display the page" in new WithApplication { whenReady(present) { r => r.header.status should equal(OK) } } "not display progress bar" in new WithApplication { contentAsString(present) should not include "Step " } "display prototype message when config set to true" in new WithApplication { contentAsString(present) should include("""<div class="prototype">""") } "not display prototype message when config set to false" in new WithApplication { val request = FakeRequest() implicit val clientSideSessionFactory = injector.getInstance(classOf[ClientSideSessionFactory]) implicit val config: Config = mock[Config] when(config.isPrototypeBannerVisible).thenReturn(false) val disposeFailurePrototypeNotVisible = new DisposeFailure() val result = disposeFailurePrototypeNotVisible.present(request) contentAsString(result) should not include """<div class="prototype">""" } } private lazy val present = { val disposeFailure = injector.getInstance(classOf[DisposeFailure]) val request = FakeRequest(). withCookies(CookieFactoryForUnitSpecs.traderDetailsModel()). withCookies(CookieFactoryForUnitSpecs.vehicleDetailsModel()). withCookies(CookieFactoryForUnitSpecs.disposeFormModel()). withCookies(CookieFactoryForUnitSpecs.disposeTransactionId()) disposeFailure.present(request) } }
Set development version to 0.2-SNAPSHOT
name := "streamz" organization in ThisBuild := "com.github.krasserm" version in ThisBuild := "0.1-SNAPSHOT" scalaVersion in ThisBuild := "2.11.2" resolvers in ThisBuild += "Scalaz Bintray Repo" at "http://dl.bintray.com/scalaz/releases" scalacOptions in ThisBuild ++= Seq("-feature", "-language:higherKinds", "-language:implicitConversions") libraryDependencies in ThisBuild ++= Seq( "org.scalaz.stream" %% "scalaz-stream" % Version.ScalazStream, "com.typesafe.akka" %% "akka-testkit" % Version.Akka % "test", "org.scalatest" %% "scalatest" % Version.Scalatest % "test" ) lazy val root = project.in(file(".")).aggregate(akkaCamel, akkaPersistence, akkaStream) lazy val akkaCamel = project.in(file("streamz-akka-camel")) lazy val akkaPersistence = project.in(file("streamz-akka-persistence")) lazy val akkaStream = project.in(file("streamz-akka-stream"))
name := "streamz" organization in ThisBuild := "com.github.krasserm" version in ThisBuild := "0.2-SNAPSHOT" scalaVersion in ThisBuild := "2.11.2" resolvers in ThisBuild += "Scalaz Bintray Repo" at "http://dl.bintray.com/scalaz/releases" scalacOptions in ThisBuild ++= Seq("-feature", "-language:higherKinds", "-language:implicitConversions") libraryDependencies in ThisBuild ++= Seq( "org.scalaz.stream" %% "scalaz-stream" % Version.ScalazStream, "com.typesafe.akka" %% "akka-testkit" % Version.Akka % "test", "org.scalatest" %% "scalatest" % Version.Scalatest % "test" ) lazy val root = project.in(file(".")).aggregate(akkaCamel, akkaPersistence, akkaStream) lazy val akkaCamel = project.in(file("streamz-akka-camel")) lazy val akkaPersistence = project.in(file("streamz-akka-persistence")) lazy val akkaStream = project.in(file("streamz-akka-stream"))
Fix initialization of ShellDriver in test
package org.schedoscope.scheduler.driver import org.scalatest.FlatSpec import org.scalatest.Matchers import org.schedoscope.DriverTests import org.schedoscope.test.resources.LocalTestResources import org.schedoscope.dsl.transformations.ShellTransformation class ShellDriverTest extends FlatSpec with Matchers { lazy val driver: ShellDriver = new ShellDriver() "ShellDriver" should "have transformation name shell" taggedAs (DriverTests) in { driver.transformationName shouldBe "shell" } it should "execute shell tranformations synchronously" taggedAs (DriverTests) in { val driverRunState = driver.runAndWait(ShellTransformation("#")) driverRunState shouldBe a[DriverRunSucceeded[_]] } it should "execute another shell tranformations synchronously" taggedAs (DriverTests) in { val driverRunState = driver.runAndWait(ShellTransformation("echo test >> /tmp/testout")) driverRunState shouldBe a[DriverRunSucceeded[_]] } it should "execute pig tranformations and return errors when running synchronously" taggedAs (DriverTests) in { val driverRunState = driver.runAndWait(ShellTransformation("exit 1")) driverRunState shouldBe a[DriverRunFailed[_]] } }
package org.schedoscope.scheduler.driver import org.scalatest.FlatSpec import org.scalatest.Matchers import org.schedoscope.DriverTests import org.schedoscope.test.resources.LocalTestResources import org.schedoscope.dsl.transformations.ShellTransformation import org.schedoscope.DriverSettings import com.typesafe.config.ConfigFactory class ShellDriverTest extends FlatSpec with Matchers { lazy val driver: ShellDriver = new ShellDriver(new DriverSettings(ConfigFactory.empty(),"shell")) "ShellDriver" should "have transformation name shell" taggedAs (DriverTests) in { driver.transformationName shouldBe "shell" } it should "execute shell tranformations synchronously" taggedAs (DriverTests) in { val driverRunState = driver.runAndWait(ShellTransformation("#")) driverRunState shouldBe a[DriverRunSucceeded[_]] } it should "execute another shell tranformations synchronously" taggedAs (DriverTests) in { val driverRunState = driver.runAndWait(ShellTransformation("echo test >> /tmp/testout")) driverRunState shouldBe a[DriverRunSucceeded[_]] } it should "execute pig tranformations and return errors when running synchronously" taggedAs (DriverTests) in { val driverRunState = driver.runAndWait(ShellTransformation("exit 1")) driverRunState shouldBe a[DriverRunFailed[_]] } }
Write the host name to the test file...
package molmed.hercules.processes import molmed.hercules.Runfolder case class WriteTestFileToDirectoryProcess(runfolder: Runfolder) extends BiotankProcess { val command = "touch " + runfolder.runfolder + "/testfile" }
package molmed.hercules.processes import molmed.hercules.Runfolder case class WriteTestFileToDirectoryProcess(runfolder: Runfolder) extends BiotankProcess { val command = "hostname > " + runfolder.runfolder + "/testfile" }
Set singleLineMode logging as default
import skinny._ import skinny.controller._ import _root_.controller._ class ScalatraBootstrap extends SkinnyLifeCycle { override def initSkinnyApp(ctx: ServletContext) { Controllers.root.mount(ctx) AssetsController.mount(ctx) } }
import skinny._ import skinny.controller._ import _root_.controller._ class ScalatraBootstrap extends SkinnyLifeCycle { // If you prefer more logging, configure this settings scalikejdbc.GlobalSettings.loggingSQLAndTime = scalikejdbc.LoggingSQLAndTimeSettings( singleLineMode = true ) override def initSkinnyApp(ctx: ServletContext) { Controllers.root.mount(ctx) AssetsController.mount(ctx) } }
Improve handling of missing user on intialization of commit importer
package com.softwaremill.codebrag.service.github.jgit import com.softwaremill.codebrag.service.github.{GitHubCommitImportService, GitHubCommitImportServiceFactory} import com.softwaremill.codebrag.dao.{UserDAO, CommitInfoDAO} import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider import com.softwaremill.codebrag.common.EventBus import com.softwaremill.codebrag.service.config.CodebragConfig class JgitGitHubCommitImportServiceFactory(commitInfoDao: CommitInfoDAO, userDao: UserDAO, eventBus: EventBus, codebragConfiguration: CodebragConfig) extends GitHubCommitImportServiceFactory { def createInstance(login: String): GitHubCommitImportService = { val importingUserToken = userDao.findByLoginOrEmail(login).get.authentication.token val credentials = new UsernamePasswordCredentialsProvider(importingUserToken, "") val uriBuilder = new GitHubRemoteUriBuilder new GitHubCommitImportService( new JgitGitHubCommitsLoader( new JgitFacade(credentials), new InternalGitDirTree(codebragConfiguration), new JgitLogConverter, uriBuilder, commitInfoDao), commitInfoDao, eventBus) } }
package com.softwaremill.codebrag.service.github.jgit import com.softwaremill.codebrag.service.github.{GitHubCommitImportService, GitHubCommitImportServiceFactory} import com.softwaremill.codebrag.dao.{UserDAO, CommitInfoDAO} import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider import com.softwaremill.codebrag.common.EventBus import com.softwaremill.codebrag.service.config.CodebragConfig import com.typesafe.scalalogging.slf4j.Logging class JgitGitHubCommitImportServiceFactory(commitInfoDao: CommitInfoDAO, userDao: UserDAO, eventBus: EventBus, codebragConfiguration: CodebragConfig) extends GitHubCommitImportServiceFactory with Logging { def createInstance(login: String): GitHubCommitImportService = { val importingUserOpt = userDao.findByLoginOrEmail(login) val token = importingUserOpt match { case Some(user) => user.authentication.token case None => { logger.warn("User $login not found in DB. Cannot properly initialize commit importer") s"user-$login-not-found" } } val credentials = new UsernamePasswordCredentialsProvider(token, "") val uriBuilder = new GitHubRemoteUriBuilder new GitHubCommitImportService( new JgitGitHubCommitsLoader( new JgitFacade(credentials), new InternalGitDirTree(codebragConfiguration), new JgitLogConverter, uriBuilder, commitInfoDao), commitInfoDao, eventBus) } }
Return back Edulify releases resolver
name := "geolocation-java-sample" version := "1.0-SNAPSHOT" lazy val root = (project in file(".")).enablePlugins(PlayJava) scalaVersion := "2.11.7" routesGenerator := InjectedRoutesGenerator libraryDependencies ++= Seq( // Add your project dependencies here, javaCore, "com.edulify" %% "geolocation" % "2.1.0" ) resolvers ++= Seq( Resolver.typesafeRepo("releases") )
name := "geolocation-java-sample" version := "1.0-SNAPSHOT" lazy val root = (project in file(".")).enablePlugins(PlayJava) scalaVersion := "2.11.7" routesGenerator := InjectedRoutesGenerator libraryDependencies ++= Seq( // Add your project dependencies here, javaCore, "com.edulify" %% "geolocation" % "2.1.0" ) resolvers ++= Seq( Resolver.url("Edulify Repository", url("https://edulify.github.io/modules/releases/"))(Resolver.ivyStylePatterns) )
Update elasticsearch, postgresql to 1.17.3
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.10.0") libraryDependencies ++= Seq( "org.testcontainers" % "postgresql" % "1.17.1", "org.testcontainers" % "elasticsearch" % "1.17.1", "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.10.0") libraryDependencies ++= Seq( "org.testcontainers" % "postgresql" % "1.17.3", "org.testcontainers" % "elasticsearch" % "1.17.3", "org.tpolecat" %% "doobie-postgres" % "0.13.4" )
Update configuration to record version 0.1.0
name := "apibuilder-validation" organization := "io.flow" scalaVersion in ThisBuild := "2.11.11" version := "0.0.51" lazy val root = project .in(file(".")) .settings( libraryDependencies ++= Seq( "com.typesafe.play" %% "play-json" % "2.6.0", "org.scalatest" %% "scalatest" % "3.0.3" % 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.11.11" version := "0.1.0" lazy val root = project .in(file(".")) .settings( libraryDependencies ++= Seq( "com.typesafe.play" %% "play-json" % "2.6.0", "org.scalatest" %% "scalatest" % "3.0.3" % 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") } }
Fix issue in previous plugin
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.1") addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.6.2") libraryDependencies += "org.scala-sbt" % "scripted-plugin" % sbtVersion.value ibraryDependencies += "net.databinder" %% "dispatch" % "0.8.10"
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.1") addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.6.2") libraryDependencies += "org.scala-sbt" % "scripted-plugin" % sbtVersion.value libraryDependencies += "net.databinder" %% "dispatch" % "0.8.10"
Add extra tests around IDs and SierraTransformable
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 } }
Update configuration to record version 0.0.63
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") } }
Update configuration to record version 0.0.19
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") } }
Update configuration to record version 0.1.79
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") } }
Make the database have a pre-init lock to a non-thread-safe pool map (:-/)
package com.evecentral import net.noerd.prequel.DatabaseConfig import org.postgresql.Driver object Database { lazy val coreDb = DatabaseConfig( driver = "org.postgresql.Driver", jdbcURL = "jdbc:postgresql://localhost/evec", username = "evec", password = "evec" ) def concatQuery(fieldName: String, items: Seq[Any]): String = { if (items.length == 0) "1=1" else items.map({ fieldName + " = " + _.toString }).mkString(" OR ") } }
package com.evecentral import net.noerd.prequel.DatabaseConfig import org.postgresql.Driver object Database { private[this] var hasInited = false private[this] def dummyTx { dbconfig.transaction { tx => tx.execute("SELECT 1 = 1") } hasInited = true } def coreDb : DatabaseConfig = { dbconfig.synchronized { if (!hasInited) dummyTx dbconfig } } private[this] val dbconfig = DatabaseConfig( driver = "org.postgresql.Driver", jdbcURL = "jdbc:postgresql://localhost/evec", username = "evec", password = "evec" ) def concatQuery(fieldName: String, items: Seq[Any]): String = { if (items.length == 0) "1=1" else items.map({ fieldName + " = " + _.toString }).mkString(" OR ") } }
Change some mutable list to immutable list
package app.utils.config import scala.collection.JavaConverters._ import scala.concurrent.duration._ object LDAPConfig extends ConfigProvider { val host = configuration.getString("ldap.host") val port = configuration.getInt("ldap.port") val ldaps = configuration.getBoolean("ldap.ldaps") val bindDN = configuration.getString("ldap.bindDN") val password = configuration.getString("ldap.password") val initialConnextions = configuration.getInt("ldap.initialConnextions") val maxConnections = configuration.getInt("ldap.maxConnections") val connectTimeout = configuration.getInt("ldap.connectTimeout") val responseTimeout = configuration.getInt("ldap.responseTimeout") val abandonOnTimeOut = configuration.getBoolean("ldap.abandonOnTimeOut") val expiryDuration: Duration = Duration(configuration.getInt("ldap.expiryDuration"), "minutes") val maxResults = configuration.getInt("ldap.maxResult") val baseDN = configuration.getString("ldap.baseDN") val uidAttributeName = configuration.getString("ldap.uidAttributeName") val administratorDN = configuration.getString("ldap.administratorDN") val isActiveDirectory = configuration.getBoolean("ldap.isActiveDirectory") } object LDAPSearchableAttributes extends ConfigProvider { val organization = configuration.getStringList("ldap.searchable.organization").asScala val user = configuration.getStringList("ldap.searchable.user").asScala val computer = configuration.getStringList("ldap.searchable.computer").asScala }
package app.utils.config import scala.collection.JavaConverters._ import scala.concurrent.duration._ object LDAPConfig extends ConfigProvider { val host = configuration.getString("ldap.host") val port = configuration.getInt("ldap.port") val ldaps = configuration.getBoolean("ldap.ldaps") val bindDN = configuration.getString("ldap.bindDN") val password = configuration.getString("ldap.password") val initialConnextions = configuration.getInt("ldap.initialConnextions") val maxConnections = configuration.getInt("ldap.maxConnections") val connectTimeout = configuration.getInt("ldap.connectTimeout") val responseTimeout = configuration.getInt("ldap.responseTimeout") val abandonOnTimeOut = configuration.getBoolean("ldap.abandonOnTimeOut") val expiryDuration: Duration = Duration(configuration.getInt("ldap.expiryDuration"), "minutes") val maxResults = configuration.getInt("ldap.maxResult") val baseDN = configuration.getString("ldap.baseDN") val uidAttributeName = configuration.getString("ldap.uidAttributeName") val administratorDN = configuration.getString("ldap.administratorDN") val isActiveDirectory = configuration.getBoolean("ldap.isActiveDirectory") } object LDAPSearchableAttributes extends ConfigProvider { val organization = configuration.getStringList("ldap.searchable.organization").asScala.toList val user = configuration.getStringList("ldap.searchable.user").asScala.toList val computer = configuration.getStringList("ldap.searchable.computer").asScala.toList }
Set project version to 0.2.5-BETA
import sbt._ import sbt.Keys._ import android.Keys._ import android.Plugin._ object Build extends android.AutoBuild { lazy val main = Project( "toolbelt", file( "." ) ) .settings( androidBuildAar: _* ) .settings( libraryDependencies ++= Seq( "com.android.support" % "appcompat-v7" % "21.0.0", "com.github.japgolly.android" % "svg-android" % "2.0.6", "org.scala-lang" % "scala-reflect" % scalaVersion.value ), name := "Toolbelt", organization := "com.taig.android", scalaVersion := "2.11.4", scalacOptions ++= Seq( "-deprecation", "-feature", "-language:dynamics", "-language:implicitConversions", "-language:reflectiveCalls" ), // @see https://github.com/pfn/android-sdk-plugin/issues/88 sourceGenerators in Compile <<= ( sourceGenerators in Compile ) ( generators => Seq( generators.last ) ), version := "0.2.4-BETA", minSdkVersion in Android := "10", platformTarget in Android := "android-21", targetSdkVersion in Android := "21" ) }
import sbt._ import sbt.Keys._ import android.Keys._ import android.Plugin._ object Build extends android.AutoBuild { lazy val main = Project( "toolbelt", file( "." ) ) .settings( androidBuildAar: _* ) .settings( libraryDependencies ++= Seq( "com.android.support" % "appcompat-v7" % "21.0.0", "com.github.japgolly.android" % "svg-android" % "2.0.6", "org.scala-lang" % "scala-reflect" % scalaVersion.value ), name := "Toolbelt", organization := "com.taig.android", scalaVersion := "2.11.4", scalacOptions ++= Seq( "-deprecation", "-feature", "-language:dynamics", "-language:implicitConversions", "-language:reflectiveCalls" ), // @see https://github.com/pfn/android-sdk-plugin/issues/88 sourceGenerators in Compile <<= ( sourceGenerators in Compile ) ( generators => Seq( generators.last ) ), version := "0.2.5-BETA", minSdkVersion in Android := "10", platformTarget in Android := "android-21", targetSdkVersion in Android := "21" ) }
Update sbt-plugin dependency to new scct version.
import sbt._ class Build(info: ProjectInfo) extends PluginProject(info) with IdeaProject { override def managedStyle = ManagedStyle.Maven lazy val publishTo = Resolver.file("github-pages-repo", new java.io.File("../../gh-pages/maven-repo/")) val scct = "reaktor" % "scct_2.9.0" % "0.1-SNAPSHOT" }
import sbt._ class Build(info: ProjectInfo) extends PluginProject(info) with IdeaProject { override def managedStyle = ManagedStyle.Maven lazy val publishTo = Resolver.file("github-pages-repo", new java.io.File("../../gh-pages/maven-repo/")) val scct = "reaktor" % "scct_2.9.0-1" % "0.1-SNAPSHOT" }
Add 'update' as a prefix for mutator like method names
package org.jetbrains.plugins.scala.extensions import com.intellij.psi.{PsiType, PsiMethod} /** * Pavel Fatin */ class PsiMethodExt(repr: PsiMethod) { private val AccessorNamePattern = """(?-i)(?:get|is|can|could|has|have|to)\p{Lu}.*""".r private val MutatorNamePattern = """(?-i)(?:do|set|add|remove|insert|delete|aquire|release)(?:\p{Lu}.*)""".r def isAccessor: Boolean = { hasQueryLikeName && !hasVoidReturnType } def isMutator: Boolean = { hasVoidReturnType || hasMutatorLikeName } def hasQueryLikeName = repr.getNameIdentifier.getText match { case "getInstance" => false // TODO others? case AccessorNamePattern() => true case _ => false } def hasMutatorLikeName = repr.getNameIdentifier.getText match { case MutatorNamePattern() => true case _ => false } def hasVoidReturnType = repr.getReturnType() == PsiType.VOID }
package org.jetbrains.plugins.scala.extensions import com.intellij.psi.{PsiType, PsiMethod} /** * Pavel Fatin */ class PsiMethodExt(repr: PsiMethod) { private val AccessorNamePattern = """(?-i)(?:get|is|can|could|has|have|to)\p{Lu}.*""".r private val MutatorNamePattern = """(?-i)(?:do|set|add|remove|insert|delete|aquire|release|update)(?:\p{Lu}.*)""".r def isAccessor: Boolean = { hasQueryLikeName && !hasVoidReturnType } def isMutator: Boolean = { hasVoidReturnType || hasMutatorLikeName } def hasQueryLikeName = repr.getNameIdentifier.getText match { case "getInstance" => false // TODO others? case AccessorNamePattern() => true case _ => false } def hasMutatorLikeName = repr.getNameIdentifier.getText match { case MutatorNamePattern() => true case _ => false } def hasVoidReturnType = repr.getReturnType() == PsiType.VOID }
Make the end user dto an optional component of web header dto.
package dvla.common.domain.DmsWeb import org.joda.time.DateTime final case class DmsWebHeaderDto (conversationId: String, originDateTime: DateTime, applicationCode: String, channelCode: String, contactId: Long, eventFlag: Boolean, serviceTypeCode: String, languageCode: String, endUser: DmsWebEndUserDto)
package dvla.common.domain.DmsWeb import org.joda.time.DateTime final case class DmsWebHeaderDto (conversationId: String, originDateTime: DateTime, applicationCode: String, channelCode: String, contactId: Long, eventFlag: Boolean, serviceTypeCode: String, languageCode: String, endUser: Option[DmsWebEndUserDto])
Add some json support (baby steps)
package footbalisto import akka.actor.ActorSystem import akka.event.Logging import akka.http.scaladsl.Http import akka.http.scaladsl.model.{HttpEntity, _} import akka.http.scaladsl.server.Directives._ import akka.stream.ActorMaterializer import com.typesafe.config.ConfigFactory import footbalisto.Database.Person object FootbalistoService extends App { implicit val system = ActorSystem() implicit val executor = system.dispatcher implicit val materializer = ActorMaterializer() val config = ConfigFactory.load() val logger = Logging(system, getClass) Database.createPerson(Person("pieter", "van geel", 30)) val route = path("hello") { get { complete(HttpEntity(ContentTypes.`text/html(UTF-8)`, "<h1>Say hello to akka-http</h1>")) } } ~ path("world") { get { complete { Database.findPersonByAge(30).map(persons => persons.mkString(",")) } } } Http().bindAndHandle(route, config.getString("http.interface"), config.getInt("http.port")) }
package footbalisto import akka.actor.ActorSystem import akka.event.Logging import akka.http.scaladsl.Http import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport import akka.http.scaladsl.model.{HttpEntity, _} import akka.http.scaladsl.server.Directives._ import akka.stream.ActorMaterializer import com.typesafe.config.ConfigFactory import footbalisto.Database.Person import spray.json.{DefaultJsonProtocol, PrettyPrinter} trait JsonSupport extends SprayJsonSupport with DefaultJsonProtocol { implicit val printer = PrettyPrinter implicit val personFormat = jsonFormat3(Person) } object FootbalistoService extends App with JsonSupport { implicit val system = ActorSystem() implicit val executor = system.dispatcher implicit val materializer = ActorMaterializer() val config = ConfigFactory.load() val logger = Logging(system, getClass) Database.createPerson(Person("pieter", "van geel", 30)) val route = path("hello") { get { complete(HttpEntity(ContentTypes.`text/html(UTF-8)`, "<h1>Say hello to akka-http</h1>")) } } ~ path("world") { get { complete { Database.findPersonByAge(30) } } } Http().bindAndHandle(route, config.getString("http.interface"), config.getInt("http.port")) }
Set default locale for scalatra to US
import com.softwaremill.codebrag.dao.MongoInit import com.softwaremill.codebrag.rest._ import com.softwaremill.codebrag.Beans import org.scalatra._ import javax.servlet.ServletContext /** * This is the ScalatraBootstrap codebrag file. You can use it to mount servlets or * filters. It's also a good place to put initialization code which needs to * run at application start (e.g. database configurations), and init params. */ class ScalatraBootstrap extends LifeCycle with Beans { val Prefix = "/rest/" override def init(context: ServletContext) { MongoInit.initialize() context.mount(new UptimeServlet, Prefix + "uptime") context.mount(new UsersServlet(authenticator, swagger), Prefix + "users") context.mount(new CommitsServlet(authenticator, commitListFinder, commentListFinder, commentActivity, commitReviewTaskDao, userDao, swagger, diffWithCommentsService, importerFactory), Prefix + CommitsServlet.MAPPING_PATH) context.mount(new GithubAuthorizationServlet(authenticator, ghService, userDao), Prefix + "github") context.mount(new FollowupsServlet(authenticator, swagger, followupFinder, followupService), Prefix + FollowupsServlet.MappingPath) context.mount(new NotificationCountServlet(authenticator, swagger, notificationCountFinder), Prefix + NotificationCountServlet.MappingPath) context.mount(new SwaggerApiDoc(swagger), Prefix + "api-docs/*") context.put("codebrag", this) } }
import com.softwaremill.codebrag.dao.MongoInit import com.softwaremill.codebrag.rest._ import com.softwaremill.codebrag.Beans import java.util.Locale import org.scalatra._ import javax.servlet.ServletContext /** * This is the ScalatraBootstrap codebrag file. You can use it to mount servlets or * filters. It's also a good place to put initialization code which needs to * run at application start (e.g. database configurations), and init params. */ class ScalatraBootstrap extends LifeCycle with Beans { val Prefix = "/rest/" override def init(context: ServletContext) { Locale.setDefault(Locale.US) // set default locale to prevent Scalatra from sending cookie expiration date in polish format :) MongoInit.initialize() context.mount(new UptimeServlet, Prefix + "uptime") context.mount(new UsersServlet(authenticator, swagger), Prefix + "users") context.mount(new CommitsServlet(authenticator, commitListFinder, commentListFinder, commentActivity, commitReviewTaskDao, userDao, swagger, diffWithCommentsService, importerFactory), Prefix + CommitsServlet.MAPPING_PATH) context.mount(new GithubAuthorizationServlet(authenticator, ghService, userDao), Prefix + "github") context.mount(new FollowupsServlet(authenticator, swagger, followupFinder, followupService), Prefix + FollowupsServlet.MappingPath) context.mount(new NotificationCountServlet(authenticator, swagger, notificationCountFinder), Prefix + NotificationCountServlet.MappingPath) context.mount(new SwaggerApiDoc(swagger), Prefix + "api-docs/*") context.put("codebrag", this) } }
Update configuration to record version 0.1.11
import com.github.retronym.SbtOneJar._ oneJarSettings name := "api-build" organization := "io.flow" scalaVersion in ThisBuild := "2.11.8" version := "0.1.10" exportJars := true lazy val root = project .in(file(".")) .settings( libraryDependencies ++= Seq( "com.typesafe.play" %% "play-json" % "2.5.10", "com.ning" % "async-http-client" % "1.9.40", "org.scalatest" %% "scalatest" % "3.0.1" % 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.1.11" exportJars := true lazy val root = project .in(file(".")) .settings( libraryDependencies ++= Seq( "com.typesafe.play" %% "play-json" % "2.5.10", "com.ning" % "async-http-client" % "1.9.40", "org.scalatest" %% "scalatest" % "3.0.1" % 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") } }
Add scala-logging to SBT library dependencies.
name := "beyond" version := "1.0-SNAPSHOT" libraryDependencies ++= Seq( jdbc, anorm, cache, "org.apache.curator" % "curator-recipes" % "2.4.2", "org.apache.zookeeper" % "zookeeper" % "3.4.6", "org.mozilla" % "rhino" % "1.7R4", "org.reactivemongo" %% "reactivemongo" % "0.10.0" ).map(_.exclude("org.slf4j", "slf4j-log4j12")) play.Project.playScalaSettings org.scalastyle.sbt.ScalastylePlugin.Settings
name := "beyond" version := "1.0-SNAPSHOT" libraryDependencies ++= Seq( jdbc, anorm, cache, "com.typesafe.scala-logging" %% "scala-logging-slf4j" % "2.1.2", "org.apache.curator" % "curator-recipes" % "2.4.2", "org.apache.zookeeper" % "zookeeper" % "3.4.6", "org.mozilla" % "rhino" % "1.7R4", "org.reactivemongo" %% "reactivemongo" % "0.10.0" ).map(_.exclude("org.slf4j", "slf4j-log4j12")) play.Project.playScalaSettings org.scalastyle.sbt.ScalastylePlugin.Settings
Update configuration to record version 0.1.22
import com.github.retronym.SbtOneJar._ oneJarSettings name := "api-build" organization := "io.flow" scalaVersion in ThisBuild := "2.11.8" version := "0.1.21" exportJars := true lazy val root = project .in(file(".")) .settings( libraryDependencies ++= Seq( "com.typesafe.play" %% "play-json" % "2.5.12", "com.ning" % "async-http-client" % "1.9.40", "org.scalatest" %% "scalatest" % "3.0.1" % 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.1.22" exportJars := true lazy val root = project .in(file(".")) .settings( libraryDependencies ++= Seq( "com.typesafe.play" %% "play-json" % "2.5.12", "com.ning" % "async-http-client" % "1.9.40", "org.scalatest" %% "scalatest" % "3.0.1" % 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") } }
Update sbt-idea to non-snapshot version and uncomment sbt-assembly dependency.
resolvers += { val typesafeRepoUrl = new java.net.URL("http://repo.typesafe.com/typesafe/releases") val pattern = Patterns(false, "[organisation]/[module]/[sbtversion]/[revision]/[type]s/[module](-[classifier])-[revision].[ext]") Resolver.url("Typesafe Repository", typesafeRepoUrl)(pattern) } resolvers += "sbt-idea-repo" at "http://mpeltonen.github.com/maven/" libraryDependencies ++= Seq( "com.github.mpeltonen" %% "sbt-idea" % "0.10.0-SNAPSHOT" // FIXME Uncomment once version for SBT 0.10.1 is available "com.eed3si9n" %% "sbt-assembly" % "0.2" ) libraryDependencies <<= (libraryDependencies, sbtVersion) { (deps, version) => deps :+ ("com.typesafe.sbteclipse" %% "sbteclipse" % "1.2" extra("sbtversion" -> version)) }
resolvers += { val typesafeRepoUrl = new java.net.URL("http://repo.typesafe.com/typesafe/releases") val pattern = Patterns(false, "[organisation]/[module]/[sbtversion]/[revision]/[type]s/[module](-[classifier])-[revision].[ext]") Resolver.url("Typesafe Repository", typesafeRepoUrl)(pattern) } resolvers += "sbt-idea-repo" at "http://mpeltonen.github.com/maven/" libraryDependencies += "com.github.mpeltonen" %% "sbt-idea" % "0.10.0" libraryDependencies <<= (libraryDependencies, sbtVersion) { (deps, version) => deps :+ ("com.typesafe.sbteclipse" %% "sbteclipse" % "1.2" extra("sbtversion" -> version)) } libraryDependencies <+= (sbtVersion) { sv => "com.eed3si9n" %% "sbt-assembly" % ("sbt" + sv + "_0.3") }
Fix type signature of tap() argument
package com.github.eerohele.expek package object utils { private[expek] implicit class Tap[A](private val a: A) extends AnyVal { def tap[B](f: A => B): A = { f(a); a } } }
package com.github.eerohele.expek package object utils { private[expek] implicit class Tap[A](private val a: A) extends AnyVal { def tap[B](f: A => Unit): A = { f(a); a } } }
Add test for single package
package amora.converter import org.junit.Test abstract class ScalaCompilerTest { import amora.TestUtils._ def convert(src: String): Set[String] = convert("<memory>" → src) def convert(data: (String, String)*): Set[String] @Test def single_class() = { convert("package pkg; class X") === Set("pkg", "pkg.X") } }
package amora.converter import org.junit.Test abstract class ScalaCompilerTest { import amora.TestUtils._ def convert(src: String): Set[String] = convert("<memory>" → src) def convert(data: (String, String)*): Set[String] @Test def single_package() = { convert("package pkg") === Set("pkg") } @Test def single_class() = { convert("package pkg; class X") === Set("pkg", "pkg.X") } }
Fix sender so it loops correctly
package com.github.oetzi.echo.io import actors.Actor import com.github.oetzi.echo.core._ import java.io.{InputStreamReader, BufferedReader, PrintWriter} class Sender private(val ip: String, val port: Int, val messages: Event[String]) extends EventSource[String] with Breakable { val sender = SenderActor.start() messages.hook { occ => sender ! occ.value } private object SenderActor extends Actor { def act { receive { case message: String => sendToSocket(message) } } def sendToSocket(message: String) { dangerous { () => val socket = new java.net.Socket(ip, port) val out = new PrintWriter(socket.getOutputStream, true) val in = new BufferedReader(new InputStreamReader(socket.getInputStream)) out.println(message) val reply = in.readLine() Sender.this.occur(reply) out.close() in.close() socket.close() } } } } object Sender { def apply(ip: String, port: Int, messages: Event[String]): Sender = { new Sender(ip, port, messages) } }
package com.github.oetzi.echo.io import actors.Actor import com.github.oetzi.echo.core._ import java.io.{InputStreamReader, BufferedReader, PrintWriter} class Sender private(val ip: String, val port: Int, val messages: Event[String]) extends EventSource[String] with Breakable { val sender = SenderActor.start() messages.hook { occ => sender ! occ.value } private object SenderActor extends Actor { def act { loop { receive { case message: String => sendToSocket(message) } } } def sendToSocket(message: String) { dangerous { () => val socket = new java.net.Socket(ip, port) val out = new PrintWriter(socket.getOutputStream, true) val in = new BufferedReader(new InputStreamReader(socket.getInputStream)) out.println(message) val reply = in.readLine() Sender.this.occur(reply) out.close() in.close() socket.close() } } } } object Sender { def apply(ip: String, port: Int, messages: Event[String]): Sender = { new Sender(ip, port, messages) } }
Revert continue (causing build failures)
package byok3 import byok3.data_structures.Context._ import byok3.data_structures.Stack._ import byok3.data_structures._ import byok3.types.{AppState, Word} import cats.data.StateT._ import cats.implicits._ import scala.util.Try object Interpreter { private def pushNumber(token: Word) = Try(token.toInt) .toOption .map(n => for { _ <- setCurrentXT(None) _ <- dataStack(push(n)) } yield ()) private def processEffect(token: Word)(ctx: Context) = ctx.dictionary .get(token) .map(xt => for { _ <- setCurrentXT(Some(xt)) _ <- xt.effect } yield ()) private def assemble: AppState[Unit] = get[Try, Context].flatMap { ctx => ctx.input match { case EndOfData | Token("", _, _) => pure(ctx) case Token(token, _, _) => processEffect(token)(ctx) .orElse(pushNumber(token)) .getOrElse(machineState(Error(-13, token))) // word not found } } def step: AppState[Boolean] = for { _ <- assemble token <- nextToken() } yield token == EndOfData def continue(isFinished: Boolean): AppState[Unit] = if (isFinished) pure() else exec // FIXME: this probably needs to be trampolined def exec: AppState[Unit] = step.flatMap(continue) def apply(text: String): AppState[Unit] = input(text).flatMap(_ => exec) }
package byok3 import byok3.data_structures.Context._ import byok3.data_structures.Stack._ import byok3.data_structures._ import byok3.types.{AppState, Word} import cats.data.StateT._ import cats.implicits._ import scala.util.Try object Interpreter { private def pushNumber(token: Word) = Try(token.toInt) .toOption .map(n => for { _ <- setCurrentXT(None) _ <- dataStack(push(n)) } yield ()) private def processEffect(token: Word)(ctx: Context) = ctx.dictionary .get(token) .map(xt => for { _ <- setCurrentXT(Some(xt)) _ <- xt.effect } yield ()) private def assemble: AppState[Unit] = get[Try, Context].flatMap { ctx => ctx.input match { case EndOfData | Token("", _, _) => pure(ctx) case Token(token, _, _) => processEffect(token)(ctx) .orElse(pushNumber(token)) .getOrElse(machineState(Error(-13, token))) // word not found } } def step: AppState[Boolean] = for { _ <- assemble token <- nextToken() } yield token == EndOfData def exec: AppState[Unit] = step.flatMap { stop => if (stop) pure() else exec } def apply(text: String): AppState[Unit] = input(text).flatMap(_ => exec) }
Update configuration to record version 0.3.3
import play.PlayImport.PlayKeys._ name := "lib-play" organization := "io.flow" scalaVersion in ThisBuild := "2.11.8" crossScalaVersions := Seq("2.11.8") version := "0.3.2" 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.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") } }
Add an implementation to JwtDecoder
package modules.jwt.decoder import scala.util.Try class JwtDecoderImpl extends JwtDecoder { override def decode(token: String): Try[String] = ??? }
package modules.jwt.decoder import javax.inject.{Inject, Named} import pdi.jwt.Jwt import pdi.jwt.algorithms.JwtHmacAlgorithm import scala.util.Try class JwtDecoderImpl @Inject()(@Named("jwt.secretKey") secretKey: String, algorithm: JwtHmacAlgorithm) extends JwtDecoder { override def decode(token: String): Try[String] = { Jwt.decodeRaw(token, secretKey, Seq(algorithm)) } }
Fix bug in string builder output stream.
/* * Copyright (C) 2011 Romain Reuillon * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.openmole.misc.tools.io import java.io.OutputStream class StringBuilderOutputStream(val builder: StringBuilder = new StringBuilder) extends OutputStream { override def write(b: Int) = builder.append(b) }
/* * Copyright (C) 2011 Romain Reuillon * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.openmole.misc.tools.io import java.io.OutputStream class StringBuilderOutputStream(val builder: StringBuilder = new StringBuilder) extends OutputStream { override def write(b: Int) = builder.append(b.toChar) }
Enable -Xexperimental for Scala 2.11 only
import sbt.Keys._ import sbt._ object Common extends AutoPlugin { override def trigger: PluginTrigger = allRequirements override def requires: Plugins = plugins.JvmPlugin override lazy val projectSettings: Seq[Setting[_]] = Seq( scalaVersion := "2.12.0", crossScalaVersions := Seq("2.12.0", "2.11.8"), scalacOptions ++= Seq( "-deprecation", "-unchecked", "-feature", "-Xlint", "-Xexperimental", "-language:higherKinds", "-language:implicitConversions", "-language:experimental.macros" ), updateOptions := updateOptions.value.withCachedResolution(true), incOptions := incOptions.value.withLogRecompileOnMacro(false) ) }
import BuildUtil.scala211Only import sbt.Keys._ import sbt._ object Common extends AutoPlugin { override def trigger: PluginTrigger = allRequirements override def requires: Plugins = plugins.JvmPlugin override lazy val projectSettings: Seq[Setting[_]] = Seq( scalaVersion := "2.12.0", crossScalaVersions := Seq("2.12.0", "2.11.8"), scalacOptions ++= Seq( "-deprecation", "-unchecked", "-feature", "-Xlint", "-language:higherKinds", "-language:implicitConversions", "-language:experimental.macros" ) ++ scala211Only( // lambda syntax for SAM types "-Xexperimental" ).value, updateOptions := updateOptions.value.withCachedResolution(true), incOptions := incOptions.value.withLogRecompileOnMacro(false) ) }
Change basic sum scala example to match java one more closely
/** * Illustrates a simple fold in scala */ package com.oreilly.learningsparkexamples.scala import org.apache.spark._ object BasicSum { def main(args: Array[String]) { val master = args.length match { case x: Int if x > 0 => args(0) case _ => "local" } val sc = new SparkContext(master, "BasicMap", System.getenv("SPARK_HOME")) val input = sc.parallelize(List(1,2,3,4)) val squared = input.map(x => x*x) val result = squared.fold(0)((x, y) => (x + y)) println(result) } }
/** * Illustrates a simple fold in scala */ package com.oreilly.learningsparkexamples.scala import org.apache.spark._ object BasicSum { def main(args: Array[String]) { val master = args.length match { case x: Int if x > 0 => args(0) case _ => "local" } val sc = new SparkContext(master, "BasicMap", System.getenv("SPARK_HOME")) val input = sc.parallelize(List(1,2,3,4)) val result = input.fold(0)((x, y) => (x + y)) println(result) } }
Update sbt-scalajs, scalajs-compiler, ... to 1.5.0
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.4.0") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.5") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.1.1") addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1") addSbtPlugin("io.youi" % "youi-plugin" % "1.2.0") libraryDependencies += "org.scala-js" %% "scalajs-env-jsdom-nodejs" % "1.1.0"
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.0") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.5") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.1.1") addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1") addSbtPlugin("io.youi" % "youi-plugin" % "1.2.0") libraryDependencies += "org.scala-js" %% "scalajs-env-jsdom-nodejs" % "1.1.0"
Upgrade sbt-jshint to 1.0.2 (jshint 2.4.3)
// Comment to get more information during initialization logLevel := Level.Warn // The Typesafe repository resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" // Use the Play sbt plugin for Play projects addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.4") addSbtPlugin("org.databrary" % "sbt-angular-templates" % "0.1") addSbtPlugin("com.typesafe.sbt" % "sbt-stylus" % "1.0.1") addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0") addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.1") addSbtPlugin("com.typesafe.sbt" % "sbt-uglify" % "1.0.3") lazy val root = (project in file("."))
// Comment to get more information during initialization logLevel := Level.Warn // The Typesafe repository resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" // Use the Play sbt plugin for Play projects addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.4") addSbtPlugin("org.databrary" % "sbt-angular-templates" % "0.1") addSbtPlugin("com.typesafe.sbt" % "sbt-stylus" % "1.0.1") addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0") addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.2") addSbtPlugin("com.typesafe.sbt" % "sbt-uglify" % "1.0.3") lazy val root = (project in file("."))
Fix build: ImplicitConverter has been renamed Conversion
import scala.collection.mutable case class Foo[K, V]()(implicit conv: ImplicitConverter[V, Ordered[V]]) extends mutable.HashMap[K,V] { val a = this.toSeq.sortWith { case ((_, v1), (_, v2)) => v1 > v2 } val b = this.toSeq.sortWith(_._2 > _._2) }
import scala.collection.mutable case class Foo[K, V]()(implicit conv: Conversion[V, Ordered[V]]) extends mutable.HashMap[K,V] { val a = this.toSeq.sortWith { case ((_, v1), (_, v2)) => v1 > v2 } val b = this.toSeq.sortWith(_._2 > _._2) }
Update configuration to record version 0.3.2
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.11" % 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.3.1"
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.11" % 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.3.2"
Mark minified spec as pending until fixed
/* * Copyright 2010-2011 WorldWide Conferencing, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.liftweb package http import org.specs2.mutable.Specification /** * System under specification for ResourceServer. */ class ResourceServerSpec extends Specification { "ResourceServer Specification".title "ResourceServer.pathRewriter" should { "not default jquery.js to jquery-1.3.2" in { ResourceServer.pathRewriter("jquery.js"::Nil) must_== List("jquery.js") } "default json to json2 minified version" in { (ResourceServer.pathRewriter("json.js"::Nil) must_== List("json2-min.js")) and (ResourceServer.pathRewriter("json2.js"::Nil) must_== List("json2-min.js")) } } }
/* * Copyright 2010-2011 WorldWide Conferencing, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.liftweb package http import org.specs2.mutable.Specification /** * System under specification for ResourceServer. */ class ResourceServerSpec extends Specification { "ResourceServer Specification".title "ResourceServer.pathRewriter" should { "not default jquery.js to jquery-1.3.2" in { ResourceServer.pathRewriter("jquery.js"::Nil) must_== List("jquery.js") } "default json to json2 minified version" in { (ResourceServer.pathRewriter("json.js"::Nil) must_== List("json2-min.js")) and (ResourceServer.pathRewriter("json2.js"::Nil) must_== List("json2-min.js")) }.pendingUntilFixed } }
Update sbt-scala-module plugin to avoid inlining from stdlib
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.13")
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.14")
Update sbt-wartremover, wartremover to 2.4.19
resolvers ++= Seq( Classpaths.typesafeReleases, Classpaths.sbtPluginReleases, "jgit-repo" at "https://download.eclipse.org/jgit/maven", Resolver.url("scoverage-bintray", url("https://dl.bintray.com/sksamuel/sbt-plugins/"))(Resolver.ivyStylePatterns), Resolver.sonatypeRepo("snapshots") ) addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1") addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.3") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2-1") addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.4") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.0") addSbtPlugin("com.47deg" % "sbt-microsites" % "1.2.1") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2") addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.4.10") addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.21")
resolvers ++= Seq( Classpaths.typesafeReleases, Classpaths.sbtPluginReleases, "jgit-repo" at "https://download.eclipse.org/jgit/maven", Resolver.url("scoverage-bintray", url("https://dl.bintray.com/sksamuel/sbt-plugins/"))(Resolver.ivyStylePatterns), Resolver.sonatypeRepo("snapshots") ) addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1") addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.3") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2-1") addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.4") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.0") addSbtPlugin("com.47deg" % "sbt-microsites" % "1.2.1") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2") addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.4.19") addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.21")
Add support for ScalaTest to exemplar
name := "SimpleTesting" version := "1.0" scalaVersion := "2.11.4" libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test
name := "SimpleTesting" version := "1.0" scalaVersion := "2.11.4" libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test libraryDependencies += "org.scalatest" %% "scalatest" % "2.2.1" % "test"
Update configuration to record version 0.1.8
import play.PlayImport.PlayKeys._ name := "lib-play" organization := "io.flow" scalaVersion in ThisBuild := "2.11.8" crossScalaVersions := Seq("2.11.8") version := "0.1.7" lazy val root = project .in(file(".")) .enablePlugins(PlayScala) .settings( libraryDependencies ++= Seq( ws, "com.jason-goodwin" %% "authentikat-jwt" % "0.4.1", "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.8" crossScalaVersions := Seq("2.11.8") version := "0.1.8" lazy val root = project .in(file(".")) .enablePlugins(PlayScala) .settings( libraryDependencies ++= Seq( ws, "com.jason-goodwin" %% "authentikat-jwt" % "0.4.1", "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") } }
Update configuration to record version 0.2.63
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.62"
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.63"
Use a secure link to the license reference
// general organization := "com.earldouglas" name := "xsbt-web-plugin" scalacOptions ++= Seq("-feature", "-deprecation") crossSbtVersions := Seq("0.13.6", "1.0.0") sbtPlugin := true // bintray-sbt publishMavenStyle := false licenses += ("BSD New", url("http://opensource.org/licenses/BSD-3-Clause")) // scripted-plugin ScriptedPlugin.scriptedSettings scriptedBufferLog := false scriptedLaunchOpts += { "-Dplugin.version=" + version.value } watchSources ++= { (sourceDirectory.value ** "*").get } // AWS deployment support libraryDependencies += "com.amazonaws" % "aws-java-sdk-elasticbeanstalk" % "1.11.105" libraryDependencies += "com.amazonaws" % "aws-java-sdk-s3" % "1.11.105" // sbt-pgp useGpg := true
// general organization := "com.earldouglas" name := "xsbt-web-plugin" scalacOptions ++= Seq("-feature", "-deprecation") crossSbtVersions := Seq("0.13.6", "1.0.0") sbtPlugin := true // bintray-sbt publishMavenStyle := false licenses += ("BSD New", url("https://opensource.org/licenses/BSD-3-Clause")) // scripted-plugin ScriptedPlugin.scriptedSettings scriptedBufferLog := false scriptedLaunchOpts += { "-Dplugin.version=" + version.value } watchSources ++= { (sourceDirectory.value ** "*").get } // AWS deployment support libraryDependencies += "com.amazonaws" % "aws-java-sdk-elasticbeanstalk" % "1.11.105" libraryDependencies += "com.amazonaws" % "aws-java-sdk-s3" % "1.11.105" // sbt-pgp useGpg := true
Put mockito as a test dependency only
organization := "de.frosner" version := "2.0.0-SNAPSHOT" name := "drunken-data-quality" scalaVersion := "2.10.5" libraryDependencies += "org.scalatest" %% "scalatest" % "2.2.4" % "test" libraryDependencies += "org.apache.spark" %% "spark-core" % "1.3.0" % "provided" libraryDependencies += "org.apache.spark" %% "spark-sql" % "1.3.0" % "provided" libraryDependencies += "org.apache.spark" %% "spark-hive" % "1.3.0" % "provided" libraryDependencies += "org.mockito" % "mockito-all" % "1.8.4" libraryDependencies += "org.slf4j" % "slf4j-log4j12" % "1.7.10" % "provided" fork := true javaOptions += "-Xmx2G" javaOptions += "-XX:MaxPermSize=128m"
organization := "de.frosner" version := "2.0.0-SNAPSHOT" name := "drunken-data-quality" scalaVersion := "2.10.5" libraryDependencies += "org.scalatest" %% "scalatest" % "2.2.4" % "test" libraryDependencies += "org.apache.spark" %% "spark-core" % "1.3.0" % "provided" libraryDependencies += "org.apache.spark" %% "spark-sql" % "1.3.0" % "provided" libraryDependencies += "org.apache.spark" %% "spark-hive" % "1.3.0" % "provided" libraryDependencies += "org.mockito" % "mockito-all" % "1.8.4" % "test" libraryDependencies += "org.slf4j" % "slf4j-log4j12" % "1.7.10" % "provided" fork := true javaOptions += "-Xmx2G" javaOptions += "-XX:MaxPermSize=128m"
Update configuration to record version 0.2.8
import com.github.retronym.SbtOneJar._ import sbt.Credentials oneJarSettings name := "api-build" organization := "io.flow" scalaVersion in ThisBuild := "2.12.7" version := "0.2.7" exportJars := true lazy val root = project .in(file(".")) .settings( libraryDependencies ++= Seq( "io.flow" %% "lib-util" % "0.1.2", "io.flow" %% "apibuilder-validation" % "0.3.6", "com.typesafe.play" %% "play-json" % "2.6.10", "com.ning" % "async-http-client" % "1.9.40", "org.scalatest" %% "scalatest" % "3.0.5" % Test ) ) resolvers += "Artifactory" at "https://flow.jfrog.io/flow/libs-release/" 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") } }
import com.github.retronym.SbtOneJar._ import sbt.Credentials oneJarSettings name := "api-build" organization := "io.flow" scalaVersion in ThisBuild := "2.12.7" version := "0.2.8" exportJars := true lazy val root = project .in(file(".")) .settings( libraryDependencies ++= Seq( "io.flow" %% "lib-util" % "0.1.2", "io.flow" %% "apibuilder-validation" % "0.3.6", "com.typesafe.play" %% "play-json" % "2.6.10", "com.ning" % "async-http-client" % "1.9.40", "org.scalatest" %% "scalatest" % "3.0.5" % Test ) ) resolvers += "Artifactory" at "https://flow.jfrog.io/flow/libs-release/" 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") } }
Change pool key so because of the way AHC honors https pooling parameter
/** * Copyright 2011-2014 eBusiness Information, Groupe Excilys (www.ebusinessinformation.fr) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.gatling.http.ahc import com.ning.http.client.uri.UriComponents import io.gatling.core.session.Session import com.ning.http.client.{ ConnectionPoolKeyStrategy => AHCConnectionPoolKeyStrategy, DefaultConnectionPoolStrategy } class ConnectionPoolKeyStrategy(session: Session) extends AHCConnectionPoolKeyStrategy { def getKey(uri: UriComponents): String = session.userId + DefaultConnectionPoolStrategy.INSTANCE.getKey(uri) }
/** * Copyright 2011-2014 eBusiness Information, Groupe Excilys (www.ebusinessinformation.fr) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.gatling.http.ahc import com.ning.http.client.uri.UriComponents import io.gatling.core.session.Session import com.ning.http.client.{ ConnectionPoolKeyStrategy => AHCConnectionPoolKeyStrategy, DefaultConnectionPoolStrategy } class ConnectionPoolKeyStrategy(session: Session) extends AHCConnectionPoolKeyStrategy { def getKey(uri: UriComponents): String = DefaultConnectionPoolStrategy.INSTANCE.getKey(uri) + session.userId }
Update play-ahc-ws, play-akka-http-server, ... to 2.8.9
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.4")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.9") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.4")
Set project version to 0.1.11-BETA
import sbt._ import sbt.Keys._ import android.Keys._ import android.Plugin._ object Build extends android.AutoBuild { lazy val main = Project( "toolbelt", file( "." ) ) .settings( buildAar: _* ) .settings( libraryDependencies ++= Seq( "org.scala-lang" % "scala-reflect" % scalaVersion.value, "com.android.support" % "support-v4" % "20.0.0", "com.github.japgolly.android" % "svg-android" % "2.0.6" ), name := "Toolbelt", organization := "com.taig.android", scalaVersion := "2.11.2", scalacOptions ++= Seq( "-deprecation", "-feature", "-language:dynamics", "-language:implicitConversions", "-language:reflectiveCalls" ), version := "0.1.10-BETA", libraryProject in Android := true, minSdkVersion in Android := "10", targetSdkVersion in Android := "21" ) }
import sbt._ import sbt.Keys._ import android.Keys._ import android.Plugin._ object Build extends android.AutoBuild { lazy val main = Project( "toolbelt", file( "." ) ) .settings( buildAar: _* ) .settings( libraryDependencies ++= Seq( "org.scala-lang" % "scala-reflect" % scalaVersion.value, "com.android.support" % "support-v4" % "20.0.0", "com.github.japgolly.android" % "svg-android" % "2.0.6" ), name := "Toolbelt", organization := "com.taig.android", scalaVersion := "2.11.2", scalacOptions ++= Seq( "-deprecation", "-feature", "-language:dynamics", "-language:implicitConversions", "-language:reflectiveCalls" ), version := "0.1.11-BETA", libraryProject in Android := true, minSdkVersion in Android := "10", targetSdkVersion in Android := "21" ) }
Update configuration to record 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.96"
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"
Change to three-component version number
// // Project metadata // name := "tempgres-client" organization := "dk.cwconsult" version := "1.1-SNAPSHOT" // // sbt-pgp settings // useGpg := true // // This is a Java-only project, so we don't need the scala // library nor the artifact name mangling. // crossPaths := false autoScalaLibrary := false // // Compiler settings // javacOptions in (Compile, compile) ++= Seq("-source", "1.7", "-target", "1.7")
// // Project metadata // name := "tempgres-client" organization := "dk.cwconsult" version := "1.1.0-SNAPSHOT" // // sbt-pgp settings // useGpg := true // // This is a Java-only project, so we don't need the scala // library nor the artifact name mangling. // crossPaths := false autoScalaLibrary := false // // Compiler settings // javacOptions in (Compile, compile) ++= Seq("-source", "1.7", "-target", "1.7")
Fix compile error on travis-ci
import scala.io.Source /** * @author loustler * @since 01/14/2017 18:21 */ def widthofLength(s: String) = s.length.toString.length // 예제와는 다름, travis에서 compile error를 방지 하기 위함 def wordCountInFile(fileName: String): Unit = { if (args.length > 0) { val lines = Source.fromFile(fileName).getLines().toList /** * Return longest line in lines. * * reduceLeft to LinearSeqOptimzed#reduceLeft(function) * * Reduce from left to right do function. * */ val longestLine = lines.reduceLeft( (a, b) => if (a.length > b.length) a else b ) val maxWidth = widthofLength(longestLine) for ( line <- lines) { val numSpaces = maxWidth - widthofLength(line) val padding = " " * numSpaces println(padding + line.length + " | " + line) } } else Console.err.println("Please enter filename") }
import scala.io.Source /** * @author loustler * @since 01/14/2017 18:21 */ /* * If you want to use it, remove the comment that encloses this scala script. def widthofLength(s: String) = s.length.toString.length // 예제와는 다름, travis에서 compile error를 방지 하기 위함 def wordCountInFile(fileName: String): Unit = { if (args.length > 0) { val lines = Source.fromFile(fileName).getLines().toList /** * Return longest line in lines. * * reduceLeft to LinearSeqOptimzed#reduceLeft(function) * * Reduce from left to right do function. * */ val longestLine = lines.reduceLeft( (a, b) => if (a.length > b.length) a else b ) val maxWidth = widthofLength(longestLine) for ( line <- lines) { val numSpaces = maxWidth - widthofLength(line) val padding = " " * numSpaces println(padding + line.length + " | " + line) } } else Console.err.println("Please enter filename") } */
Allow categorical values in plotting API
package io.continuum.bokeh import scala.annotation.implicitNotFound @implicitNotFound(msg="Can't find Scalar type class for type ${T}.") class Scalar[T] object Scalar { implicit val IntScalar = new Scalar[Int] implicit val DoubleScalar = new Scalar[Double] }
package io.continuum.bokeh import scala.annotation.implicitNotFound @implicitNotFound(msg="Can't find Scalar type class for type ${T}.") class Scalar[T] object Scalar { implicit val IntScalar = new Scalar[Int] implicit val DoubleScalar = new Scalar[Double] implicit val StringScalar = new Scalar[String] // categorical axis }
Upgrade to now-release ostgresql-0.2.14, now published
libraryDependencies ++= Seq( component("play"), jdbc, "com.github.mauricio" %% "postgresql-async" % "0.2.14-SNAPSHOT", "org.postgresql" % "postgresql" % "9.3-1101-jdbc41" )
libraryDependencies ++= Seq( component("play"), jdbc, "com.github.mauricio" %% "postgresql-async" % "0.2.14", "org.postgresql" % "postgresql" % "9.3-1101-jdbc41" )
Make 2.12.9 the main version of the example project
name := "example" version := "1.0" scalaVersion := "2.13.0" libraryDependencies ++= Seq( "com.github.pureconfig" %% "pureconfig" % "0.11.2-SNAPSHOT") crossScalaVersions := Seq("2.13.0", "2.12.9", "2.11.12") scalacOptions ++= Seq( "-deprecation", "-encoding", "UTF-8", "-language:experimental.macros", "-feature", "-unchecked", "-Xfatal-warnings", "-Xlint", "-Ywarn-numeric-widen", "-Ywarn-value-discard")
name := "example" version := "1.0" scalaVersion := "2.12.9" libraryDependencies ++= Seq( "com.github.pureconfig" %% "pureconfig" % "0.11.2-SNAPSHOT") crossScalaVersions := Seq("2.12.9", "2.11.12", "2.13.0") scalacOptions ++= Seq( "-deprecation", "-encoding", "UTF-8", "-language:experimental.macros", "-feature", "-unchecked", "-Xfatal-warnings", "-Xlint", "-Ywarn-numeric-widen", "-Ywarn-value-discard")
Update configuration to record version 0.1.44
import com.github.retronym.SbtOneJar._ oneJarSettings name := "api-build" organization := "io.flow" scalaVersion in ThisBuild := "2.11.8" version := "0.1.42" exportJars := true lazy val root = project .in(file(".")) .settings( libraryDependencies ++= Seq( "com.typesafe.play" %% "play-json" % "2.6.1", "com.ning" % "async-http-client" % "1.9.40", "org.scalatest" %% "scalatest" % "3.0.3" % 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.1.44" exportJars := true lazy val root = project .in(file(".")) .settings( libraryDependencies ++= Seq( "com.typesafe.play" %% "play-json" % "2.6.1", "com.ning" % "async-http-client" % "1.9.40", "org.scalatest" %% "scalatest" % "3.0.3" % 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") } }
Fix count of getting tweet
package com.ru.waka import twitter4j.{Query, Twitter} import scala.collection.JavaConverters._ import scalaz.\/ class KusokoraRepository(twitter: Twitter, private var urls: Seq[String] = Nil) { private val query = new Query("#papixクソコラグランプリ") def update(): Throwable \/ Unit = \/.fromTryCatchNonFatal({ urls = twitter.search(query).getTweets.asScala.flatMap(tweet => { tweet.getMediaEntities.map(_.getMediaURL) }).toSet.toSeq }) def get: Seq[String] = Seq(urls:_*) }
package com.ru.waka import twitter4j.{Query, Twitter} import scala.collection.JavaConverters._ import scalaz.\/ class KusokoraRepository(twitter: Twitter, private var urls: Seq[String] = Nil) { private val query = new Query("#papixクソコラグランプリ").since("2016-04-01").count(100) def update(): Throwable \/ Unit = \/.fromTryCatchNonFatal({ urls = twitter.search(query).getTweets.asScala.flatMap(tweet => { tweet.getMediaEntities.map(_.getMediaURL) }).toSet.toSeq }) def get: Seq[String] = Seq(urls:_*) }
Change SelectOption to return this
package domala.jdbc /** * The options for an SQL SELECT statement. * * {{{ * SelectOptions options = SelectOptions.get.offset(10).limit(50).forUpdate * }}} */ class SelectOptions extends org.seasar.doma.jdbc.SelectOptions object SelectOptions { def get: SelectOptions = { new SelectOptions() } }
package domala.jdbc /** * The options for an SQL SELECT statement. * * {{{ * SelectOptions options = SelectOptions.get.offset(10).limit(50).forUpdate * }}} */ class SelectOptions extends org.seasar.doma.jdbc.SelectOptions { override def forUpdate(): SelectOptions = { super.forUpdate() this } override def forUpdate(aliases: String*): SelectOptions = { super.forUpdate(aliases: _*) this } override def offset(offset: Int): SelectOptions = { super.offset(offset) this } override def forUpdateWait(waitSeconds: Int): SelectOptions = { super.forUpdateWait(waitSeconds) this } override def forUpdateWait(waitSeconds: Int, aliases: String*): SelectOptions = { super.forUpdateWait(waitSeconds, aliases: _*) this } override def count(): SelectOptions = { super.count() this } override def forUpdateNowait(): SelectOptions = { super.forUpdateNowait() this } override def forUpdateNowait(aliases: String*): SelectOptions = { super.forUpdateNowait(aliases: _*) this } override def limit(limit: Int): SelectOptions = { super.limit(limit) this } } object SelectOptions { def get: SelectOptions = { new SelectOptions() } }
Make annoying log messages less annoying
/** * Copyright (C) 2010-2011 LShift Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.lshift.diffa.agent.amqp import net.lshift.accent.ConnectionFailureListener import java.lang.Exception import org.slf4j.LoggerFactory import net.lshift.diffa.kernel.util.AlertCodes /** * Default handler for listening to failures in Accent connections. */ class AccentConnectionFailureHandler extends ConnectionFailureListener { val log = LoggerFactory.getLogger(getClass) def connectionFailure(e: Exception) = log.error("%s: Accent connection failure".format(AlertCodes.GENERAL_MESSAGING_ERROR), e) }
/** * Copyright (C) 2010-2011 LShift Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.lshift.diffa.agent.amqp import net.lshift.accent.ConnectionFailureListener import java.lang.Exception import org.slf4j.LoggerFactory import net.lshift.diffa.kernel.util.AlertCodes import java.net.ConnectException /** * Default handler for listening to failures in Accent connections. */ class AccentConnectionFailureHandler extends ConnectionFailureListener { val log = LoggerFactory.getLogger(getClass) def connectionFailure(x: Exception) = x match { case c:ConnectException => { log.warn("%s: Accent connection failure: %s".format(AlertCodes.GENERAL_MESSAGING_ERROR, x.getMessage)) } case e => { log.error("%s: Accent error".format(AlertCodes.GENERAL_MESSAGING_ERROR), e) } } }
Prepare for next development iteration
organization := "fi.jumi.sbt" name := "sbt-jumi" version := "0.1.0" scalaVersion := "2.10.2" sbtPlugin := true resolvers += "Local Maven Repository" at Path.userHome.asFile.toURI.toURL+"/.m2/repository" libraryDependencies += "fi.jumi" % "jumi-launcher" % "0.5.376" libraryDependencies += "com.novocode" % "junit-interface" % "0.8" % "test->default" libraryDependencies += "junit" % "junit" % "4.11" % "test" libraryDependencies += "org.hamcrest" % "hamcrest-core" % "1.3" % "test" libraryDependencies += "org.hamcrest" % "hamcrest-library" % "1.3" % "test" ScriptedPlugin.scriptedSettings scriptedBufferLog := false scriptedLaunchOpts += "-Dsbt-jumi.version="+version.value publishTo := { if (version.value.trim.endsWith("-SNAPSHOT")) Some(Classpaths.sbtPluginSnapshots) else Some(Classpaths.sbtPluginReleases) } publishMavenStyle := false
organization := "fi.jumi.sbt" name := "sbt-jumi" version := "0.1.1-SNAPSHOT" scalaVersion := "2.10.2" sbtPlugin := true resolvers += "Local Maven Repository" at Path.userHome.asFile.toURI.toURL+"/.m2/repository" libraryDependencies += "fi.jumi" % "jumi-launcher" % "0.5.376" libraryDependencies += "com.novocode" % "junit-interface" % "0.8" % "test->default" libraryDependencies += "junit" % "junit" % "4.11" % "test" libraryDependencies += "org.hamcrest" % "hamcrest-core" % "1.3" % "test" libraryDependencies += "org.hamcrest" % "hamcrest-library" % "1.3" % "test" ScriptedPlugin.scriptedSettings scriptedBufferLog := false scriptedLaunchOpts += "-Dsbt-jumi.version="+version.value publishTo := { if (version.value.trim.endsWith("-SNAPSHOT")) Some(Classpaths.sbtPluginSnapshots) else Some(Classpaths.sbtPluginReleases) } publishMavenStyle := false
Update configuration to record version 0.3.12
import play.PlayImport.PlayKeys._ name := "lib-play" organization := "io.flow" scalaVersion in ThisBuild := "2.11.8" crossScalaVersions := Seq("2.11.8") version := "0.3.11" 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.12" 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") } }
Add rubygems dependency mirror repo.
// Comment to get more information during initialization logLevel := Level.Warn // The Typesafe repository resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" // Torqbox resolvers += "Torqbox rubygems releases" at "http://rubygems-proxy.torquebox.org/releases" // Local // resolvers += "Local Maven Repository" at "file:///"+Path.userHome.absolutePath+"/.m2/repository" // Use the Play sbt plugin for Play projects addSbtPlugin("com.typesafe.play" % "sbt-plugin" % System.getProperty("play.version"))
// Comment to get more information during initialization logLevel := Level.Warn // The Typesafe repository resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" // Torqbox resolvers += "Torqbox rubygems releases" at "http://rubygems-proxy.torquebox.org/releases" resolvers += "Torqbox rubygems releases mirror" at "http://maven.travis-ci.org/nexus/rubygems/maven/releases" // Local // resolvers += "Local Maven Repository" at "file:///"+Path.userHome.absolutePath+"/.m2/repository" // Use the Play sbt plugin for Play projects addSbtPlugin("com.typesafe.play" % "sbt-plugin" % System.getProperty("play.version"))
Add NoSuchMethodException as fatal exception
package com.twitter.util import scala.util.control.ControlThrowable /** * A classifier of fatal exceptions -- identitical in behavior to * the upcoming [[scala.util.control.NonFatal]] (which appears in * scala 2.10). */ object NonFatal { /** * Determines whether `t` is a fatal exception. * * @return true when `t` is '''not''' a fatal exception. */ def apply(t: Throwable): Boolean = t match { // StackOverflowError ok even though it is a VirtualMachineError case _: StackOverflowError => true // VirtualMachineError includes OutOfMemoryError and other fatal errors case _: VirtualMachineError | _: ThreadDeath | _: InterruptedException | _: LinkageError | _: ControlThrowable /*scala 2.10 | _: NotImplementedError*/ => false case _ => true } /** * A deconstructor to be used in pattern matches, allowing use in exception * handlers. * * {{{ * try dangerousOperation() catch { * case NonFatal(e) => log.error("Chillax") * case e => log.error("Freak out") * } * }}} */ def unapply(t: Throwable): Option[Throwable] = if (apply(t)) Some(t) else None }
package com.twitter.util import scala.util.control.ControlThrowable /** * A classifier of fatal exceptions */ object NonFatal { /** * This is identitical in behavior to the upcoming * [[scala.util.control.NonFatal]] (which appears in scala 2.10). */ def isNonFatal(t: Throwable): Boolean = t match { // StackOverflowError ok even though it is a VirtualMachineError case _: StackOverflowError => true // VirtualMachineError includes OutOfMemoryError and other fatal errors case _: VirtualMachineError | _: ThreadDeath | _: InterruptedException | _: LinkageError | _: ControlThrowable /*scala 2.10 | _: NotImplementedError*/ => false case _ => true } /** * Determines whether `t` is a fatal exception. * * @return true when `t` is '''not''' a fatal exception. */ def apply(t: Throwable): Boolean = t match { case _: NoSuchMethodException => false case t => isNonFatal(t) } /** * A deconstructor to be used in pattern matches, allowing use in exception * handlers. * * {{{ * try dangerousOperation() catch { * case NonFatal(e) => log.error("Chillax") * case e => log.error("Freak out") * } * }}} */ def unapply(t: Throwable): Option[Throwable] = if (apply(t)) Some(t) else None }
Update sbt-sonatype to 3.9.14 in master
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.1") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.13") addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.0") addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.11.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.1") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.14") addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.0") addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.11.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")
Update auxlib, javalib, nativelib, nscplugin, ... to 0.4.2
scalacOptions += "-deprecation" libraryDependencies += "org.slf4j" % "slf4j-nop" % "1.7.32" addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.0.1") addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.6") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10") addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings" % "3.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.1") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0") addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.13.0")
scalacOptions += "-deprecation" libraryDependencies += "org.slf4j" % "slf4j-nop" % "1.7.32" addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.0.1") addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.6") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10") addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings" % "3.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.1") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.2") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0") addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.13.0")
Add `ErgoBox` deserialization test with `pos` and `consumed` checks;
package sigmastate.utxo import org.ergoplatform.ErgoBox import org.scalatest.PropSpec import org.scalatest.prop.GeneratorDrivenPropertyChecks import org.scalatest.TryValues._ import sigmastate.serialization.generators.ValueGenerators class ErgoBoxSerializerSpec extends PropSpec with GeneratorDrivenPropertyChecks with SerializationRoundTripSpec with ValueGenerators { implicit val ergoBoxSerializer = ErgoBox.serializer property("ErgoBox: Serializer round trip") { forAll { b: ErgoBox => val bytes = ergoBoxSerializer.toBytes(b) val b1 = ergoBoxSerializer.parseBytes(bytes).success.value b1.value shouldBe b.value b1.proposition shouldBe b.proposition b1.transactionId.sameElements(b.transactionId) shouldBe true b1.boxId shouldBe b.boxId b1.additionalRegisters shouldBe b.additionalRegisters } } }
package sigmastate.utxo import org.scalacheck.Arbitrary._ import org.scalacheck.Gen import org.ergoplatform.ErgoBox import org.scalatest.PropSpec import org.scalatest.prop.GeneratorDrivenPropertyChecks import org.scalatest.TryValues._ import sigmastate.serialization.generators.ValueGenerators class ErgoBoxSerializerSpec extends PropSpec with GeneratorDrivenPropertyChecks with SerializationRoundTripSpec with ValueGenerators { implicit val ergoBoxSerializer = ErgoBox.serializer property("ErgoBox: Serializer round trip") { forAll { b: ErgoBox => val bytes = ergoBoxSerializer.toBytes(b) val b1 = ergoBoxSerializer.parseBytes(bytes).success.value b1.value shouldBe b.value b1.proposition shouldBe b.proposition b1.transactionId.sameElements(b.transactionId) shouldBe true b1.boxId shouldBe b.boxId b1.additionalRegisters shouldBe b.additionalRegisters } } property("ErgoBox: start pos and consumed bytes") { forAll { b: ErgoBox => val randomBytesCount = Gen.chooseNum(1, 20).sample.get val randomBytes = Gen.listOfN(randomBytesCount, arbByte.arbitrary).sample.get.toArray val bytes = ergoBoxSerializer.toBytes(b) ergoBoxSerializer.parseBody(randomBytes ++ bytes, randomBytesCount) shouldEqual (b, bytes.length) } } }
Add ZooKeeper to SBT library dependencies.
name := "beyond" version := "1.0-SNAPSHOT" libraryDependencies ++= Seq( jdbc, anorm, cache, "org.mozilla" % "rhino" % "1.7R4", "org.reactivemongo" %% "reactivemongo" % "0.10.0" ) play.Project.playScalaSettings org.scalastyle.sbt.ScalastylePlugin.Settings
name := "beyond" version := "1.0-SNAPSHOT" libraryDependencies ++= Seq( jdbc, anorm, cache, "org.apache.zookeeper" % "zookeeper" % "3.4.6", "org.mozilla" % "rhino" % "1.7R4", "org.reactivemongo" %% "reactivemongo" % "0.10.0" ) play.Project.playScalaSettings org.scalastyle.sbt.ScalastylePlugin.Settings
Remove out of date comments
/** * Copyright (C) 2007 Orbeon, Inc. * * This program is free software; you can redistribute it and/or modify it under the terms of the * GNU Lesser General Public License as published by the Free Software Foundation; either version * 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * The full text of the license is available at http://www.gnu.org/copyleft/lesser.html */ package org.orbeon.oxf.xforms.control import org.orbeon.oxf.util.ScalaUtils._ // Trait indicating that the control can directly receive keyboard focus // NOTE: This is different from supporting `setFocus()`. `setFocus()` can apply to groups, etc. which by themselves // do not directly receive focus. Concretely, only leaf controls are focusable, but not all of them. For example, // an output control is not focusable. trait FocusableTrait extends VisitableTrait { self ⇒ // Whether the control is actually focusable depending on relevance and readonliness override def isFocusable = self match { case single: XFormsSingleNodeControl ⇒ isRelevant && ! single.isReadonly case _ ⇒ isRelevant } // Return None if inputOnly is true. XFormsInputControl must override this behavior. override def focusableControls: Iterator[XFormsControl] = isFocusable iterator self }
/** * Copyright (C) 2007 Orbeon, Inc. * * This program is free software; you can redistribute it and/or modify it under the terms of the * GNU Lesser General Public License as published by the Free Software Foundation; either version * 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * The full text of the license is available at http://www.gnu.org/copyleft/lesser.html */ package org.orbeon.oxf.xforms.control import org.orbeon.oxf.util.ScalaUtils._ // Trait indicating that the control can directly receive keyboard focus trait FocusableTrait extends VisitableTrait { self ⇒ override def isFocusable = self match { case single: XFormsSingleNodeControl ⇒ isRelevant && ! single.isReadonly case _ ⇒ isRelevant } override def focusableControls: Iterator[XFormsControl] = isFocusable iterator self }
Fix compilation on Scala 2.11
package org.http4s.websocket import fs2._ import org.http4s.websocket.WebsocketBits.WebSocketFrame private[http4s] final case class Websocket[F[_]]( @deprecatedName('read, "0.18.0-M7") send: Stream[F, WebSocketFrame], @deprecatedName('write, "0.18.0-M7") receive: Sink[F, WebSocketFrame] ) { def read: Stream[F, WebSocketFrame] = send def write: Sink[F, WebSocketFrame] = receive }
package org.http4s.websocket import fs2._ import org.http4s.websocket.WebsocketBits.WebSocketFrame private[http4s] final case class Websocket[F[_]]( @deprecatedName('read) send: Stream[F, WebSocketFrame], @deprecatedName('write) receive: Sink[F, WebSocketFrame] ) { @deprecated("Parameter has been renamed to `send`", "0.18.0-M7") def read: Stream[F, WebSocketFrame] = send @deprecated("Parameter has been renamed to `receive`", "0.18.0-M7") def write: Sink[F, WebSocketFrame] = receive }
Update unit test. Remove debugging output
package core import org.scalatest.{BeforeAndAfter, BeforeAndAfterAll, FunSpec} import org.scalatest.Matchers class ServiceDescriptionMapSpec extends FunSpec with Matchers { private val baseJson = """ { "base_url": "http://localhost:9000", "name": "Api Doc", "models": { "user": { "fields": [ %s ] } } } """ it("accepts type: map") { val json = baseJson.format("""{ "name": "tags", "type": "map" }""") val validator = ServiceDescriptionValidator(json) validator.errors.mkString("") should be("") val tags = validator.serviceDescription.get.models.head.fields.head println("tags: " + tags) } it("accept defaults for maps") { val json = baseJson.format("""{ "name": "tags", "type": "map", "default": "{ }" }""") val validator = ServiceDescriptionValidator(json) validator.errors.mkString("") should be("") val tags = validator.serviceDescription.get.models.head.fields.head tags.default shouldBe Some("{ }") } it("validates invalid defaults") { val json = baseJson.format("""{ "name": "tags", "type": "map", "default": "bar" }""") val validator = ServiceDescriptionValidator(json) validator.errors.mkString("") should be("Model[user] field[tags] Default[bar] is not valid for datatype[map]") } }
package core import org.scalatest.{BeforeAndAfter, BeforeAndAfterAll, FunSpec} import org.scalatest.Matchers class ServiceDescriptionMapSpec extends FunSpec with Matchers { private val baseJson = """ { "base_url": "http://localhost:9000", "name": "Api Doc", "models": { "user": { "fields": [ %s ] } } } """ it("accepts type: map") { val json = baseJson.format("""{ "name": "tags", "type": "map" }""") val validator = ServiceDescriptionValidator(json) validator.errors.mkString("") should be("") val tags = validator.serviceDescription.get.models.head.fields.head tags.fieldtype should be(PrimitiveFieldType(Datatype.MapType)) } it("accept defaults for maps") { val json = baseJson.format("""{ "name": "tags", "type": "map", "default": "{ }" }""") val validator = ServiceDescriptionValidator(json) validator.errors.mkString("") should be("") val tags = validator.serviceDescription.get.models.head.fields.head tags.default shouldBe Some("{ }") } it("validates invalid defaults") { val json = baseJson.format("""{ "name": "tags", "type": "map", "default": "bar" }""") val validator = ServiceDescriptionValidator(json) validator.errors.mkString("") should be("Model[user] field[tags] Default[bar] is not valid for datatype[map]") } }
Add commons-csv to the various libraries benchmarked for writing.
package tabulate.benchmark import java.io.{StringWriter, Writer} import java.util.concurrent.TimeUnit import org.openjdk.jmh.annotations._ import tabulate.ops._ @State(Scope.Thread) @BenchmarkMode(Array(Mode.AverageTime)) @OutputTimeUnit(TimeUnit.MICROSECONDS) class EncodingBenchmark { def write[A](f: Array[String] => Unit): Unit = rawData.foreach { entry => f(Array(entry._1.toString, entry._2.toString, entry._3.toString, entry._4.toString)) } @Benchmark def tabulate() = new StringWriter().writeCsv(rawData, ',').close() @Benchmark def productCollections() = { val out = new StringWriter() com.github.marklister.collections.io.Utils.CsvOutput(rawData).writeCsv(out, ",") out.close() } @Benchmark def opencsv() = { val out = new StringWriter() val writer = new com.opencsv.CSVWriter(out, ',') write { a => writer.writeNext(a) } writer.close() out.close() } }
package tabulate.benchmark import java.io.{StringWriter, Writer} import java.util.concurrent.TimeUnit import org.apache.commons.csv.CSVFormat import org.openjdk.jmh.annotations._ import tabulate.ops._ @State(Scope.Thread) @BenchmarkMode(Array(Mode.AverageTime)) @OutputTimeUnit(TimeUnit.MICROSECONDS) class EncodingBenchmark { def write[A](f: Array[String] => Unit): Unit = rawData.foreach { entry => f(Array(entry._1.toString, entry._2.toString, entry._3.toString, entry._4.toString)) } @Benchmark def tabulate() = new StringWriter().writeCsv(rawData, ',').close() @Benchmark def productCollections() = { val out = new StringWriter() com.github.marklister.collections.io.Utils.CsvOutput(rawData).writeCsv(out, ",") out.close() } @Benchmark def opencsv() = { val out = new StringWriter() val writer = new com.opencsv.CSVWriter(out, ',') write { a => writer.writeNext(a) } writer.close() out.close() } @Benchmark def commonsCsv() = { val out = new StringWriter() val writer = new org.apache.commons.csv.CSVPrinter(out, CSVFormat.RFC4180) write { a => writer.printRecords(a) } writer.close() out.close() } }
Make sure topics are case-insensitive.
package Actors import helper.ActorHelper /** * Name used on the event bus to identify stream like objects. */ case class StreamTopic private(value: String) object StreamTopic { /** * Get the topic of a stream. */ def forStream(path: models.StreamUri): Option[StreamTopic] = Some(StreamTopic( "@stream/" + path.components() .map(ActorHelper.normalizeName(_)) .mkString("/"))) def forStream(stream: models.Stream): Option[StreamTopic] = forStream(stream.getUri()) /** * Get the topic of a tag. */ def forTag(tag: models.StreamTag): Option[StreamTopic] = ActorHelper.normalizeName(tag.value) .filterNot(_.isEmpty) .map("@tag/" + _) .map(StreamTopic(_)) }
package Actors import helper.ActorHelper /** * Name used on the event bus to identify stream like objects. */ case class StreamTopic private(value: String) object StreamTopic { /** * Get topic of already validated string path. */ private def forString(path: String): StreamTopic = StreamTopic(path.toLowerCase()) /** * Get the topic of a stream. */ def forStream(path: models.StreamUri): Option[StreamTopic] = Some(forString("@stream/" + path.components() .map(ActorHelper.normalizeName(_)) .mkString("/"))) def forStream(stream: models.Stream): Option[StreamTopic] = forStream(stream.getUri()) /** * Get the topic of a tag. */ def forTag(tag: models.StreamTag): Option[StreamTopic] = ActorHelper.normalizeName(tag.value) .filterNot(_.isEmpty) .map(x => forString("@tag/" + x)) }
Make compliant with ScalaJS configuration parser.
package io.reactors.protocol package instrumented import io.reactors.ReactorSystem import io.reactors.ReactorSystem.Bundle import io.reactors.ReactorTerminated import org.scalatest._ import org.scalatest.concurrent.AsyncTimeLimitedTests import scala.concurrent.ExecutionContext import scala.concurrent.Promise import scala.concurrent.duration._ class ScriptedTransportTests extends AsyncFunSuite with AsyncTimeLimitedTests { val system = ReactorSystem.default("conversions", Bundle.default( """ system.channels.create-as-local = "false" """.stripMargin)) def timeLimit = 10.seconds implicit override def executionContext = ExecutionContext.Implicits.global test("use a scripted transport") { val done = Promise[Boolean] system.spawnLocal[Unit] { self => // TODO: Use a scenario that relies on scripted testing. done.success(true) } done.future.map(t => assert(t)) } }
package io.reactors.protocol package instrumented import io.reactors.ReactorSystem import io.reactors.ReactorSystem.Bundle import io.reactors.ReactorTerminated import org.scalatest._ import org.scalatest.concurrent.AsyncTimeLimitedTests import scala.concurrent.ExecutionContext import scala.concurrent.Promise import scala.concurrent.duration._ class ScriptedTransportTests extends AsyncFunSuite with AsyncTimeLimitedTests { val system = ReactorSystem.default("conversions", Bundle.default( """ system = { channels = { create-as-local = "false" } } """.stripMargin)) def timeLimit = 10.seconds implicit override def executionContext = ExecutionContext.Implicits.global test("use a scripted transport") { val done = Promise[Boolean] system.spawnLocal[Unit] { self => // TODO: Use a scenario that relies on scripted testing. done.success(true) } done.future.map(t => assert(t)) } }
Fix one final use of TcpClient/ElasticClient
package uk.ac.wellcome.platform.api.controllers import javax.inject.{Inject, Singleton} import com.sksamuel.elastic4s.ElasticClient import com.sksamuel.elastic4s.ElasticDsl._ import com.twitter.finagle.http.Request import com.twitter.finatra.http.Controller import uk.ac.wellcome.utils.GlobalExecutionContext.context @Singleton class ManagementController @Inject()( elasticClient: ElasticClient ) extends Controller { get("/management/healthcheck") { request: Request => response.ok.json(Map("message" -> "ok")) } get("/management/clusterhealth") { request: Request => elasticClient .execute { clusterHealth() } .map(health => response.ok.json(health.status)) } }
package uk.ac.wellcome.platform.api.controllers import javax.inject.{Inject, Singleton} import com.sksamuel.elastic4s.TcpClient import com.sksamuel.elastic4s.ElasticDsl._ import com.twitter.finagle.http.Request import com.twitter.finatra.http.Controller import uk.ac.wellcome.utils.GlobalExecutionContext.context @Singleton class ManagementController @Inject()( elasticClient: TcpClient ) extends Controller { get("/management/healthcheck") { request: Request => response.ok.json(Map("message" -> "ok")) } get("/management/clusterhealth") { request: Request => elasticClient .execute { clusterHealth() } .map(health => response.ok.json(health.status)) } }
Update sbt-scalajs, scalajs-compiler to 0.6.32
resolvers += "jgit-repo" at "http://download.eclipse.org/jgit/maven" addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.0") addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3") addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.2") resolvers += Classpaths.sbtPluginReleases addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0") addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.8.1") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1") // cross-compiling addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.31")
resolvers += "jgit-repo" at "http://download.eclipse.org/jgit/maven" addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.0") addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3") addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.2") resolvers += Classpaths.sbtPluginReleases addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0") addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.8.1") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1") // cross-compiling addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.32")
Update sbt-wartremover, wartremover to 3.0.4
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.2.0") addSbtPlugin("org.scalameta" % "sbt-native-image" % "0.3.2") // addSbtPlugin("com.typesafe.sbt" % "sbt-proguard" % "0.2.2") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3") addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.2") addSbtPlugin("org.wartremover" % "sbt-wartremover" % "3.0.3") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.12") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.2.0") addSbtPlugin("org.scalameta" % "sbt-native-image" % "0.3.2") // addSbtPlugin("com.typesafe.sbt" % "sbt-proguard" % "0.2.2") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3") addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.2") addSbtPlugin("org.wartremover" % "sbt-wartremover" % "3.0.4") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.12") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
Use ZipUtils.copy instead of IOUtils.copy
package nbmtools import java.io.Closeable import java.io.FileInputStream import java.io.FileOutputStream import java.io.InputStream import java.io.PrintStream import java.net.URL import org.apache.commons.io.IOUtils import scala.util.Failure import scala.util.Success import scala.util.Try class Internalize extends Command { def openIn(s: String) = Try(new URL(s)) match { case Success(url) => url.openStream case Failure(_) => new FileInputStream(s) } private def using[T <: Closeable, U](resource: T) ( block: T => U ): U = try { block(resource) } finally { resource.close } override def run( in: InputStream, out: PrintStream, err: PrintStream, args: String*): Int = { val names: Try[(String, String)] = for { fromName <- Try(args(0)) toName <- Try(args(1)) } yield (fromName, toName) names match { case Failure(_) => err.println("too few arguments") Command.EXIT_FAILURE case Success((fromName, toName)) => { using(new NbmInputStream(openIn(fromName))) { fromStream => using(new FileOutputStream(toName)) { toStream => IOUtils.copy(fromStream, toStream) }} Command.EXIT_SUCCESS } } } }
package nbmtools import java.io.Closeable import java.io.FileInputStream import java.io.FileOutputStream import java.io.InputStream import java.io.PrintStream import java.net.URL import java.util.zip.ZipOutputStream import scala.util.Failure import scala.util.Success import scala.util.Try class Internalize extends Command { def openIn(s: String) = Try(new URL(s)) match { case Success(url) => url.openStream case Failure(_) => new FileInputStream(s) } private def using[T <: Closeable, U](resource: T) ( block: T => U ): U = try { block(resource) } finally { resource.close } override def run( in: InputStream, out: PrintStream, err: PrintStream, args: String*): Int = { val names: Try[(String, String)] = for { fromName <- Try(args(0)) toName <- Try(args(1)) } yield (fromName, toName) names match { case Failure(_) => err.println("too few arguments") Command.EXIT_FAILURE case Success((fromName, toName)) => { using(new NbmInputStream(openIn(fromName))) { fromStream => using(new ZipOutputStream(new FileOutputStream(toName))) { toStream => ZipUtils.copy(fromStream, toStream) }} Command.EXIT_SUCCESS } } } }
Allow session backend to be picked on the cli
package com.cloudera.hue.livy.server import javax.servlet.ServletContext import com.cloudera.hue.livy.WebServer import org.scalatra._ import org.scalatra.servlet.ScalatraListener object Main { def main(args: Array[String]): Unit = { val port = sys.env.getOrElse("PORT", "8998").toInt val server = new WebServer(port) server.context.setResourceBase("src/main/com/cloudera/hue/livy/server") server.context.setInitParameter(ScalatraListener.LifeCycleKey, classOf[ScalatraBootstrap].getCanonicalName) server.context.addEventListener(new ScalatraListener) server.start() server.join() server.stop() } } class ScalatraBootstrap extends LifeCycle { val sessionFactory = new YarnSessionFactory val sessionManager = new SessionManager(sessionFactory) override def init(context: ServletContext): Unit = { context.mount(new WebApp(sessionManager), "/*") } override def destroy(context: ServletContext): Unit = { sessionManager.close() } }
package com.cloudera.hue.livy.server import javax.servlet.ServletContext import com.cloudera.hue.livy.WebServer import org.scalatra._ import org.scalatra.servlet.ScalatraListener object Main { val SESSION_KIND = "livy.session.kind" val PROCESS_SESSION = "process" val YARN_SESSION = "yarn" def main(args: Array[String]): Unit = { if (args.length != 1) { println("Must specify either `process` or `yarn` for the session kind") sys.exit(1) } val session_kind = args(0) session_kind match { case PROCESS_SESSION | YARN_SESSION => case _ => println("Unknown session kind: " + session_kind) sys.exit(1) } val port = sys.env.getOrElse("PORT", "8998").toInt val server = new WebServer(port) server.context.setResourceBase("src/main/com/cloudera/hue/livy/server") server.context.setInitParameter(ScalatraListener.LifeCycleKey, classOf[ScalatraBootstrap].getCanonicalName) server.context.addEventListener(new ScalatraListener) server.context.setInitParameter(SESSION_KIND, session_kind) server.start() server.join() server.stop() } } class ScalatraBootstrap extends LifeCycle { var sessionManager: SessionManager = null override def init(context: ServletContext): Unit = { context.mount(new WebApp(sessionManager), "/*") val sessionFactory = context.getInitParameter(Main.SESSION_KIND) match { case Main.PROCESS_SESSION => new ProcessSessionFactory case Main.YARN_SESSION => new YarnSessionFactory } sessionManager = new SessionManager(sessionFactory) } override def destroy(context: ServletContext): Unit = { sessionManager.close() } }
Define Neighborhood Watch result types.
package com.anchortab.actor import net.liftweb._ import common._ import actor._ import mongodb._ import BsonDSL._ import util._ import Helpers._ import org.joda.time._ sealed trait NeighborhoodWatchMessage case object ScheduleNeighborhoodWatch extends NeighborhoodWatchMessage case object NeighborhoodWatch extends NeighborhoodWatchMessage object NeighborhoodWatchActor extends LiftActor with Loggable { private def timeSpanUntilNextNeighborhoodWatch = { val beginningOfNextMonth = Props.mode match { //case Props.RunModes.Development => (new DateTime()).plusMinutes(5).getMillis case _ => (new DateTime()).toDateMidnight.plusWeeks(1).withDayOfWeek(1).getMillis } val now = new DateTime().getMillis new TimeSpan(beginningOfNextMonth - now) } override def messageHandler = { case ScheduleNeighborhoodWatch => val delay = timeSpanUntilNextNeighborhoodWatch logger.info("Scheduling next neighborhood watch for " + delay) Schedule(() => this ! NeighborhoodWatch, delay) case NeighborhoodWatch => logger.info("Running neighborhood watch.") } }
package com.anchortab.actor import net.liftweb._ import common._ import actor._ import mongodb._ import BsonDSL._ import util._ import Helpers._ import org.joda.time._ sealed trait NeighborhoodWatchMessage case object ScheduleNeighborhoodWatch extends NeighborhoodWatchMessage case object NeighborhoodWatch extends NeighborhoodWatchMessage sealed trait NeighborhoodWatchResult case class SameSiteMultipleAccount(domain: String, accounts: List[String]) extends NeighborhoodWatchResult case class MultipleAccountsSameIpAndUserAgent(accounts: List[String], ip: String, userAgent: String) extends NeighborhoodWatchResult case class SimilarEmailAddresses(accounts: List[String]) extends NeighborhoodWatchResult object NeighborhoodWatchActor extends LiftActor with Loggable { private def timeSpanUntilNextNeighborhoodWatch = { val beginningOfNextMonth = Props.mode match { //case Props.RunModes.Development => (new DateTime()).plusMinutes(5).getMillis case _ => (new DateTime()).toDateMidnight.plusWeeks(1).withDayOfWeek(1).getMillis } val now = new DateTime().getMillis new TimeSpan(beginningOfNextMonth - now) } override def messageHandler = { case ScheduleNeighborhoodWatch => val delay = timeSpanUntilNextNeighborhoodWatch logger.info("Scheduling next neighborhood watch for " + delay) Schedule(() => this ! NeighborhoodWatch, delay) case NeighborhoodWatch => logger.info("Running neighborhood watch.") } }
Fix - get rid of case sensitive matching of commit author. Now it is case insensitive
package com.softwaremill.codebrag.domain object CommitAuthorClassification { def commitAuthoredByUser[T, S](commit: T, user: S)(implicit commitLike: CommitLike[T], userLike: UserLike[S]): Boolean = { commitLike.authorName(commit) == userLike.userFullName(user) || userLike.userEmails(user).contains(commitLike.authorEmail(commit)) } }
package com.softwaremill.codebrag.domain object CommitAuthorClassification { def commitAuthoredByUser[T, S](commit: T, user: S)(implicit commitLike: CommitLike[T], userLike: UserLike[S]): Boolean = { val nameMatches = commitLike.authorName(commit).toLowerCase == userLike.userFullName(user).toLowerCase val emailMatches = userLike.userEmails(user).map(_.toLowerCase).contains(commitLike.authorEmail(commit).toLowerCase) nameMatches || emailMatches } }
Add sbt-quickfix plugin for vim
resolvers ++= Seq( "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/", "Sonatype releases" at "http://oss.sonatype.org/content/repositories/releases/" ) // IntelliJ IDEA plugin addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0") // Eclipse plugin addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.5.0") // Scalastyle plugin addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.6.0") // Scalariform plugin (Daniel Trinh's fork) addSbtPlugin("com.danieltrinh" % "sbt-scalariform" % "1.3.0")
resolvers ++= Seq( "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/", "Sonatype releases" at "http://oss.sonatype.org/content/repositories/releases/" ) // IntelliJ IDEA plugin addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0") // Eclipse plugin addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.5.0") // Scalastyle plugin addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.6.0") // Scalariform plugin (Daniel Trinh's fork) addSbtPlugin("com.danieltrinh" % "sbt-scalariform" % "1.3.0") // Vim sbt-quickfix plugin addSbtPlugin("com.dscleaver.sbt" % "sbt-quickfix" % "0.4.1")
Remove empty entries - in case of extra semicolons in fields list
package hmda.model.edits import hmda.model.ResourceUtils import com.github.tototoshi.csv.CSVParser.parse object EditMetaDataLookup extends ResourceUtils { val values: Seq[EditMetaData] = { val lines = resourceLines("/edit-metadata.txt") lines.drop(1).map { line => val values = parse(line, '\\', ',', '"').getOrElse(List()) val category = values(0) val editType = values(1) val editNumber = values(2) val editDescription = values(3) val userFriendlyEditDescription = values(4) val fieldNames: Seq[String] = values(5).split(";").map(_.trim) EditMetaData( editNumber, editDescription, userFriendlyEditDescription, fieldNames ) }.toSeq } def forEdit(editName: String): EditMetaData = { values.find(e => e.editNumber == editName) .getOrElse(EditMetaData(editName, "description not found", "description not found", Seq())) } } case class EditMetaData( editNumber: String, editDescription: String, userFriendlyEditDescription: String, fieldNames: Seq[String] )
package hmda.model.edits import hmda.model.ResourceUtils import com.github.tototoshi.csv.CSVParser.parse object EditMetaDataLookup extends ResourceUtils { val values: Seq[EditMetaData] = { val lines = resourceLines("/edit-metadata.txt") lines.drop(1).map { line => val values = parse(line, '\\', ',', '"').getOrElse(List()) val category = values(0) val editType = values(1) val editNumber = values(2) val editDescription = values(3) val userFriendlyEditDescription = values(4) val fieldNames: Seq[String] = values(5).split(";").map(_.trim).filter(_.nonEmpty) EditMetaData( editNumber, editDescription, userFriendlyEditDescription, fieldNames ) }.toSeq } def forEdit(editName: String): EditMetaData = { values.find(e => e.editNumber == editName) .getOrElse(EditMetaData(editName, "description not found", "description not found", Seq())) } } case class EditMetaData( editNumber: String, editDescription: String, userFriendlyEditDescription: String, fieldNames: Seq[String] )
Update sbt-scalajs, scalajs-compiler to 1.3.0
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1") addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3") addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.0") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0") addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.2.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.4") addSbtPlugin("ohnosequences" % "sbt-github-release" % "0.7.0") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") // https://github.com/ohnosequences/sbt-github-release/issues/28#issuecomment-426086656 libraryDependencies += "com.sun.activation" % "javax.activation" % "1.2.0"
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1") addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3") addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.0") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0") addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.4") addSbtPlugin("ohnosequences" % "sbt-github-release" % "0.7.0") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") // https://github.com/ohnosequences/sbt-github-release/issues/28#issuecomment-426086656 libraryDependencies += "com.sun.activation" % "javax.activation" % "1.2.0"
Set project version to 0.3.19-BETA
import sbt._ import sbt.Keys._ import android.Keys._ import android.Plugin._ object Build extends android.AutoBuild { lazy val main = Project( "toolbelt", file( "." ) ) .settings( androidBuildAar: _* ) .settings( libraryDependencies ++= Seq( "com.android.support" % "appcompat-v7" % "21.0.0", "com.github.japgolly.android" % "svg-android" % "2.0.6", "com.jpardogo.materialtabstrip" % "library" % "1.0.5", "org.scala-lang" % "scala-reflect" % scalaVersion.value ), name := "Toolbelt", organization := "com.taig.android", publishArtifact in ( Compile, packageDoc ) := false, scalaVersion := "2.11.4", scalacOptions ++= Seq( "-deprecation", "-feature", "-language:dynamics", "-language:existentials", "-language:implicitConversions", "-language:reflectiveCalls" ), // @see https://github.com/pfn/android-sdk-plugin/issues/88 sourceGenerators in Compile <<= ( sourceGenerators in Compile ) ( generators => Seq( generators.last ) ), version := "0.3.18-BETA", minSdkVersion in Android := "10", platformTarget in Android := "android-21", targetSdkVersion in Android := "21" ) }
import sbt._ import sbt.Keys._ import android.Keys._ import android.Plugin._ object Build extends android.AutoBuild { lazy val main = Project( "toolbelt", file( "." ) ) .settings( androidBuildAar: _* ) .settings( libraryDependencies ++= Seq( "com.android.support" % "appcompat-v7" % "21.0.0", "com.github.japgolly.android" % "svg-android" % "2.0.6", "com.jpardogo.materialtabstrip" % "library" % "1.0.5", "org.scala-lang" % "scala-reflect" % scalaVersion.value ), name := "Toolbelt", organization := "com.taig.android", publishArtifact in ( Compile, packageDoc ) := false, scalaVersion := "2.11.4", scalacOptions ++= Seq( "-deprecation", "-feature", "-language:dynamics", "-language:existentials", "-language:implicitConversions", "-language:reflectiveCalls" ), // @see https://github.com/pfn/android-sdk-plugin/issues/88 sourceGenerators in Compile <<= ( sourceGenerators in Compile ) ( generators => Seq( generators.last ) ), version := "0.3.19-BETA", minSdkVersion in Android := "10", platformTarget in Android := "android-21", targetSdkVersion in Android := "21" ) }
Drop sbt-coursier while using sbt 1.3
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.0.0") addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.3") libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.6.0") addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.5")
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.0.0") libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.6.0") addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.5")
Fix optional values in examples
import io.hydrosphere.mist.lib.MistJob object SimpleContext extends MistJob { /** Contains implementation of spark job with ordinary [[org.apache.spark.SparkContext]] * Abstract method must be overridden * * @param numbers list of int to process * @return result of the job */ def doStuff(numbers: List[Int], multiplier: Option[Int]): Map[String, Any] = { val rdd = context.parallelize(numbers) Map("result" -> rdd.map(x => x * multiplier.getOrElse(2)).collect()) } }
import io.hydrosphere.mist.lib.MistJob object SimpleContext extends MistJob { /** Contains implementation of spark job with ordinary [[org.apache.spark.SparkContext]] * Abstract method must be overridden * * @param numbers list of int to process * @return result of the job */ def doStuff(numbers: List[Int], multiplier: Option[Int]): Map[String, Any] = { val multiplierValue = multiplier.getOrElse(2) val rdd = context.parallelize(numbers) Map("result" -> rdd.map(x => x * multiplierValue).collect()) } }
Change channel model from case class to class
package domain.model.chat.channel import domain.model.chat.member.{Member, MemberId} import domain.model.{Entity, ValueObject} case class ChannelId(value: Long) extends ValueObject { def isUndefined: Boolean = { value == ChannelId.undefinedValue } } object UndefinedId { def toChannelId: ChannelId = ChannelId(value = ChannelId.undefinedValue) } object ChannelId { val undefinedValue = 0L } case class ChannelName(name: String) extends ValueObject { require(name.length > 0 && name.length <= 128) } case class Channel(id: ChannelId, name: ChannelName, participants: Set[MemberId]) extends Entity { def join(member: Member): Channel = { this.copy(participants = participants + member.id) } def leave(member: Member): Channel = { this.copy(participants = participants - member.id) } def changeName(name: ChannelName): Channel = { this.copy(name = name) } }
package domain.model.chat.channel import domain.model.chat.member.{Member, MemberId} import domain.model.{Entity, ValueObject} case class ChannelId(value: Long) extends ValueObject { def isUndefined: Boolean = { value == ChannelId.undefinedValue } } object UndefinedId { def toChannelId: ChannelId = ChannelId(value = ChannelId.undefinedValue) } object ChannelId { val undefinedValue = 0L } case class ChannelName(name: String) extends ValueObject { require(name.length > 0 && name.length <= 128) } class Channel(val id: ChannelId, val name: ChannelName, val participants: Set[MemberId]) extends Entity { def join(member: Member): Channel = { this.copy(participants = participants + member.id) } def leave(member: Member): Channel = { this.copy(participants = participants - member.id) } def changeName(name: ChannelName): Channel = { this.copy(name = name) } def copy(id: ChannelId = this.id, name: ChannelName = this.name, participants: Set[MemberId] = this.participants): Channel = { new Channel(id, name, participants) } def canEqual(other: Any): Boolean = other.isInstanceOf[Channel] override def equals(other: Any): Boolean = other match { case that: Channel => (that canEqual this) && id == that.id case _ => false } override def hashCode(): Int = { val state = Seq(id) state.map(_.hashCode()).foldLeft(0)((a, b) => 31 * a + b) } } object Channel { def apply(id: ChannelId, name: ChannelName, participants: Set[MemberId]): Channel = { new Channel(id, name, participants) } }
Make task support implementations public.
/* __ *\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ package scala.collection.parallel import java.util.concurrent.ThreadPoolExecutor import scala.concurrent.forkjoin.ForkJoinPool import scala.concurrent.ExecutionContext trait TaskSupport extends Tasks private[collection] class ForkJoinTaskSupport(val environment: ForkJoinPool = ForkJoinTasks.defaultForkJoinPool) extends TaskSupport with AdaptiveWorkStealingForkJoinTasks private[collection] class ThreadPoolTaskSupport(val environment: ThreadPoolExecutor = ThreadPoolTasks.defaultThreadPool) extends TaskSupport with AdaptiveWorkStealingThreadPoolTasks private[collection] class ExecutionContextTaskSupport(val environment: ExecutionContext = scala.concurrent.executionContext) extends TaskSupport with ExecutionContextTasks
/* __ *\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ package scala.collection.parallel import java.util.concurrent.ThreadPoolExecutor import scala.concurrent.forkjoin.ForkJoinPool import scala.concurrent.ExecutionContext /** A trait implementing the scheduling of * a parallel collection operation. * * Task support objects handle how a task is split and * distributed across processors. A task support object can be * changed in a parallel collection after it has been created, * but only during a quiescent period, i.e. while there are no * concurrent invocations to parallel collection methods. */ trait TaskSupport extends Tasks /** A task support that uses a fork join pool to schedule tasks */ class ForkJoinTaskSupport(val environment: ForkJoinPool = ForkJoinTasks.defaultForkJoinPool) extends TaskSupport with AdaptiveWorkStealingForkJoinTasks /** A task support that uses a thread pool executor to schedule tasks */ class ThreadPoolTaskSupport(val environment: ThreadPoolExecutor = ThreadPoolTasks.defaultThreadPool) extends TaskSupport with AdaptiveWorkStealingThreadPoolTasks /** A task support that uses an execution context to schedule tasks. * * It can be used with the default execution context implementation in the `scala.concurrent` package. * It internally forwards the call to either a forkjoin based task support or a thread pool executor one, * depending on what the execution context uses. * * By default, parallel collections are parametrized with this task support object, so parallel collections * share the same execution context backend as the rest of the `scala.concurrent` package. */ class ExecutionContextTaskSupport(val environment: ExecutionContext = scala.concurrent.executionContext) extends TaskSupport with ExecutionContextTasks
Update configuration to record version 0.0.40
name := "lib-apidoc-json-validation" organization := "io.flow" scalaVersion in ThisBuild := "2.11.8" version := "0.0.39" lazy val root = project .in(file(".")) .settings( libraryDependencies ++= Seq( "com.typesafe.play" %% "play-json" % "2.5.14", "org.scalatest" %% "scalatest" % "3.0.2" % 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.40" lazy val root = project .in(file(".")) .settings( libraryDependencies ++= Seq( "com.typesafe.play" %% "play-json" % "2.5.14", "org.scalatest" %% "scalatest" % "3.0.2" % 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") } }
Remove unused implicit conversion function
package io.rouz import java.lang.Thread.currentThread import io.rouz.flo.dsl.FloTask.named import io.rouz.flo.dsl.TaskBuilder0 import scala.language.implicitConversions import scala.reflect.ClassTag import scala.util.DynamicVariable /** * Package object with task wiring dsl helpers */ package object flo { def defTask[T: ClassTag](args: Any*): TaskBuilder0[T] = named[T](currentMethodName(), args: _*) def defTaskNamed[T: ClassTag](name: String, args: Any*): TaskBuilder0[T] = named[T](name, args: _*) implicit def toTask[T](t: => T): Task[T] = currentBuilder.process(t) implicit class TB0Dsl[T](val tb0: TaskBuilder0[T]) extends AnyVal { def dsl(f: => Task[T]): Task[T] = dynamicBuilder.withValue(tb0)(f) } def $[T]: TaskBuilder0[T] = currentBuilder def ▫[T]: TaskBuilder0[T] = currentBuilder private def currentBuilder[T]: TaskBuilder0[T] = { val builder = dynamicBuilder.value if (builder == null) { throw new RuntimeException("Builder accessor used outside a defTask scope") } builder.asInstanceOf[TaskBuilder0[T]] } private val dynamicBuilder = new DynamicVariable[TaskBuilder0[_]](null) private def currentMethodName(): String = currentThread.getStackTrace()(3).getMethodName.replaceAll("\\$.*$", "") }
package io.rouz import java.lang.Thread.currentThread import io.rouz.flo.dsl.FloTask.named import io.rouz.flo.dsl.TaskBuilder0 import scala.language.implicitConversions import scala.reflect.ClassTag import scala.util.DynamicVariable /** * Package object with task wiring dsl helpers */ package object flo { def defTask[T: ClassTag](args: Any*): TaskBuilder0[T] = named[T](currentMethodName(), args: _*) def defTaskNamed[T: ClassTag](name: String, args: Any*): TaskBuilder0[T] = named[T](name, args: _*) implicit class TB0Dsl[T](val tb0: TaskBuilder0[T]) extends AnyVal { def dsl(f: => Task[T]): Task[T] = dynamicBuilder.withValue(tb0)(f) } def $[T]: TaskBuilder0[T] = currentBuilder def ▫[T]: TaskBuilder0[T] = currentBuilder private def currentBuilder[T]: TaskBuilder0[T] = { val builder = dynamicBuilder.value if (builder == null) { throw new RuntimeException("Builder accessor used outside a defTask scope") } builder.asInstanceOf[TaskBuilder0[T]] } private val dynamicBuilder = new DynamicVariable[TaskBuilder0[_]](null) private def currentMethodName(): String = currentThread.getStackTrace()(3).getMethodName.replaceAll("\\$.*$", "") }
Revert "US1496: Comment out code that equires rabbitmq to be installed and running"
package audit import audit.Message.JsonWrites import com.google.inject.Inject import com.rabbitmq.client.ConnectionFactory import play.api.Logger import play.api.libs.json.Json.{stringify, toJson} import utils.helpers.Config final class AuditServiceImpl @Inject()(config: Config) extends AuditService { override def send(auditMessage: Message): Unit = { // val factory = new ConnectionFactory() // factory.setHost(config.rabbitmqHost) // val connection = factory.newConnection() // TESTS NEED TO BE USING STUB SERVICE // try { // val channel = connection.createChannel() // try { // channel.queueDeclare(config.rabbitmqQueue, false, false, false, null) // val message = messageToSend(auditMessage).getBytes // channel.basicPublish("", config.rabbitmqQueue, null, message) // Logger.debug(s"Sent Audit message: $message") // } finally { // channel.close() // } // } finally { // connection.close() // } Logger.debug(s"Sent Audit message" + auditMessage) } private def messageToSend(auditMessage: Message) = { val asJson = toJson(auditMessage) stringify(asJson) } }
package audit import audit.Message.JsonWrites import com.google.inject.Inject import com.rabbitmq.client.ConnectionFactory import play.api.Logger import play.api.libs.json.Json.{stringify, toJson} import utils.helpers.Config final class AuditServiceImpl @Inject()(config: Config) extends AuditService { override def send(auditMessage: Message): Unit = { val factory = new ConnectionFactory() factory.setHost(config.rabbitmqHost) val connection = factory.newConnection() // TESTS NEED TO BE USING STUB SERVICE try { val channel = connection.createChannel() try { channel.queueDeclare(config.rabbitmqQueue, false, false, false, null) val message = messageToSend(auditMessage).getBytes channel.basicPublish("", config.rabbitmqQueue, null, message) Logger.debug(s"Sent Audit message: $message") } finally { channel.close() } } finally { connection.close() } } private def messageToSend(auditMessage: Message) = { val asJson = toJson(auditMessage) stringify(asJson) } }
Use released versions of abc libraries and string-store.
name := "play-scala" version := "1.0-SNAPSHOT" lazy val root = (project in file(".")).enablePlugins(PlayScala) scalaVersion := "2.11.7" libraryDependencies ++= Seq( jdbc, cache, ws, "com.foomoo.abc" %% "abc-domain" % "0.2-SNAPSHOT", "com.foomoo.abc" %% "abc-parser" % "0.2-SNAPSHOT", "com.foomoo.abc" %% "abc-app" % "0.2-SNAPSHOT", "com.foomoo.string-store" % "string-store-service-api" % "0.2-SNAPSHOT", "com.foomoo.string-store" % "string-store-service-provider-mongo" % "0.2-SNAPSHOT", "org.scalatestplus.play" %% "scalatestplus-play" % "1.5.1" % Test, "commons-cli" % "commons-cli" % "1.2" ) sources in (Compile, doc) := Seq.empty publishArtifact in (Compile, packageDoc) := false
name := "play-scala" version := "1.0-SNAPSHOT" lazy val root = (project in file(".")).enablePlugins(PlayScala) scalaVersion := "2.11.7" libraryDependencies ++= Seq( jdbc, cache, ws, "com.foomoo.abc" %% "abc-domain" % "0.2", "com.foomoo.abc" %% "abc-parser" % "0.2", "com.foomoo.abc" %% "abc-app" % "0.2", "com.foomoo.string-store" % "string-store-service-api" % "0.2", "com.foomoo.string-store" % "string-store-service-provider-mongo" % "0.2", "org.scalatestplus.play" %% "scalatestplus-play" % "1.5.1" % Test, "commons-cli" % "commons-cli" % "1.2" ) sources in (Compile, doc) := Seq.empty publishArtifact in (Compile, packageDoc) := false
Update configuration to record version 0.0.12
name := "proxy" organization := "io.flow" scalaVersion in ThisBuild := "2.11.8" lazy val root = project .in(file(".")) .enablePlugins(PlayScala) .settings(commonSettings: _*) .settings( libraryDependencies ++= Seq( filters, ws, "com.jason-goodwin" %% "authentikat-jwt" % "0.4.1", "org.yaml" % "snakeyaml" % "1.17", "org.scalatestplus.play" %% "scalatestplus-play" % "1.5.0" % "test" ) ) val credsToUse = Option(System.getenv("ARTIFACTORY_USERNAME")) match { case None => Credentials(Path.userHome / ".ivy2" / ".artifactory") case _ => Credentials("Artifactory Realm","flow.artifactoryonline.com",System.getenv("ARTIFACTORY_USERNAME"),System.getenv("ARTIFACTORY_PASSWORD")) } lazy val commonSettings: Seq[Setting[_]] = Seq( name <<= name("proxy-" + _), scalacOptions += "-feature", sources in (Compile,doc) := Seq.empty, publishArtifact in (Compile, packageDoc) := false, credentials += credsToUse, resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases", resolvers += "Artifactory" at "https://flow.artifactoryonline.com/flow/libs-release/" ) version := "0.0.11"
name := "proxy" organization := "io.flow" scalaVersion in ThisBuild := "2.11.8" lazy val root = project .in(file(".")) .enablePlugins(PlayScala) .settings(commonSettings: _*) .settings( libraryDependencies ++= Seq( filters, ws, "com.jason-goodwin" %% "authentikat-jwt" % "0.4.1", "org.yaml" % "snakeyaml" % "1.17", "org.scalatestplus.play" %% "scalatestplus-play" % "1.5.0" % "test" ) ) val credsToUse = Option(System.getenv("ARTIFACTORY_USERNAME")) match { case None => Credentials(Path.userHome / ".ivy2" / ".artifactory") case _ => Credentials("Artifactory Realm","flow.artifactoryonline.com",System.getenv("ARTIFACTORY_USERNAME"),System.getenv("ARTIFACTORY_PASSWORD")) } lazy val commonSettings: Seq[Setting[_]] = Seq( name <<= name("proxy-" + _), scalacOptions += "-feature", sources in (Compile,doc) := Seq.empty, publishArtifact in (Compile, packageDoc) := false, credentials += credsToUse, resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases", resolvers += "Artifactory" at "https://flow.artifactoryonline.com/flow/libs-release/" ) version := "0.0.12"
Update configuration to record version 0.4.5
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") } }
import play.PlayImport.PlayKeys._ name := "lib-play" organization := "io.flow" scalaVersion in ThisBuild := "2.11.11" crossScalaVersions := Seq("2.11.11") version := "0.4.5" 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") } }
Update configuration to record version 0.2.40
name := "lib-reference-scala" organization := "io.flow" scalaVersion := "2.13.1" lazy val root = project .in(file(".")) .settings( libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % "3.1.0" % Test, compilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.4.4" cross CrossVersion.full), "com.github.ghik" %% "silencer-lib" % "1.4.4" % 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.39"
name := "lib-reference-scala" organization := "io.flow" scalaVersion := "2.13.1" lazy val root = project .in(file(".")) .settings( libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % "3.1.0" % Test, compilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.4.4" cross CrossVersion.full), "com.github.ghik" %% "silencer-lib" % "1.4.4" % 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.40"
Update configuration to record version 0.0.4
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.3"
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.4"
Move live implementation of workflow to workflow.scala
package ducttape import collection._ import ducttape.hyperdag._ //import ducttape.hyperdag._ object Types { class HashMultiMap[A,B] extends mutable.HashMap[A,mutable.Set[B]] with mutable.MultiMap[A,B]; class Task(val name: String, val comments: Seq[String], val commands: Seq[String]) {} class IOEdge(val files: Map[String,String], // var -> absolute path val params: Map[String,String]) {} // var -> value class Branch(val name: String) {} class HyperWorkflow(val dag: PackedDag[Task,Branch,IOEdge]) {} }
package ducttape import collection._ import ducttape.hyperdag._ //import ducttape.hyperdag._ object Types { class HashMultiMap[A,B] extends mutable.HashMap[A,mutable.Set[B]] with mutable.MultiMap[A,B]; }