This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.yourApplication.inject | |
import com.google.inject._ | |
import net.codingwell.scalaguice.InjectorExtensions.ScalaInjector | |
import net.codingwell.scalaguice.ScalaModule | |
import com.google.inject.util.Modules | |
import play.api.Mode._ | |
import play.api.Mode | |
import java.util.concurrent.atomic.AtomicBoolean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io._ | |
import java.util.zip.{GZIPInputStream, GZIPOutputStream} | |
import org.apache.commons.compress.archivers.tar.{TarArchiveInputStream, TarArchiveEntry, TarArchiveOutputStream} | |
import org.apache.commons.io.{IOUtils, FileUtils} | |
object IO { | |
def addToArchive(tarArchive: TarArchiveOutputStream, file: File, base: String = ""): Unit = { | |
val entryName = base + file.getName | |
val entry = new TarArchiveEntry(file, entryName) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.reflect.runtime.universe._ | |
import scala.util.{Failure, Success, Try} | |
object CompanionTypeSystem { | |
def apply[SealedClass: TypeTag, Companion: TypeTag](fBoundedType: String): Set[Companion] = { | |
val sealedClassType = typeOf[SealedClass] | |
val companionType = typeOf[Companion] | |
val upperBound = sealedClassType | |
val refineCompanionWithTypeParameter = getTypeWithTypeParameterOrElseCheckTypeMember(companionType, fBoundedType, upperBound, isSelfRecursive = false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying that +leogrim is my blockchain ID. https://onename.com/leogrim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ServiceAModule extends ScalaModule { | |
def configure() { | |
bind[ClassC].to[CommonImplementation] | |
bind[ClassA].to[ImplementationA] | |
} | |
def classDProviderForServiceA: ClassD = serviceAInstanceOfClassD | |
} | |
class ServiceBModule extends ScalaModule { | |
def configure() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val devModule = Modules.override( | |
Modules.override(ServiceAModule).`with`(ServiceBModule) | |
).`with`(CommonDevelopmentModule) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val serviceATestModule = Modules.override(ServiceAModule).`with`(FakeClassAModule) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ConfigurationModule(functionalModules: ScalaModule*) extends ScalaModule with Logging { | |
final def configure() { | |
log.info(s"Configuring ${this}") | |
functionalModules.foreach { module => | |
log.info(s"Install ${module}") | |
install(module) | |
} | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class FunctionalModuleAInProduction extends FunctionalModuleA { | |
def configure() { | |
bind[ClassA].to[ImplementationA] | |
} | |
} | |
case class FunctionalModuleAInDevelopment extends FunctionalModuleA { | |
def configure() { | |
bind[ClassA].to[FakeImplementationA] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MyTest extends Specification { | |
"My feature" should { | |
"do something" in { | |
test block | |
} | |
} | |
} |
OlderNewer