From c359862021c187e680c9b3f687ab149f7ef6b7b0 Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Tue, 15 Mar 2016 03:05:09 -0400 Subject: get rid of ammonite dependency --- stage2/BasicBuild.scala | 2 -- stage2/Lib.scala | 11 +++++------ stage2/Scaffold.scala | 5 ++--- 3 files changed, 7 insertions(+), 11 deletions(-) (limited to 'stage2') diff --git a/stage2/BasicBuild.scala b/stage2/BasicBuild.scala index a906b06..acd49af 100644 --- a/stage2/BasicBuild.scala +++ b/stage2/BasicBuild.scala @@ -13,8 +13,6 @@ import scala.collection.immutable.Seq import scala.reflect.runtime.{universe => ru} import scala.util._ -import ammonite.ops.{cwd => _,_} - class BasicBuild( context: Context ) extends Build( context ) class Build(val context: Context) extends Dependency with TriggerLoop{ // library available to builds diff --git a/stage2/Lib.scala b/stage2/Lib.scala index 218208d..99f578a 100644 --- a/stage2/Lib.scala +++ b/stage2/Lib.scala @@ -13,8 +13,6 @@ import scala.collection.immutable.Seq import scala.reflect.runtime.{universe => ru} import scala.util._ -import ammonite.ops.{cwd => _,_} - // pom model case class Developer(id: String, name: String, timezone: String, url: URL) case class License(name: String, url: URL) @@ -90,7 +88,7 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{ compileArgs: Seq[String], classLoaderCache: ClassLoaderCache ): File = { - mkdir(Path(apiTarget)) + apiTarget.mkdirs if(sourceFiles.nonEmpty){ val args = Seq( // FIXME: can we use compiler dependency here? @@ -320,8 +318,9 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{ val path = jarTarget.toString ++ ( "/" ++ artifactId ++ "-" ++ version ++ ".pom" ) - write.over(Path(path), "\n" ++ xml.toString) - new File(path) + val file = new File(path) + Files.write(file.toPath, ("\n" ++ xml.toString).getBytes) + file } def concurrently[T,R]( concurrencyEnabled: Boolean )( items: Seq[T] )( projection: T => R ): Seq[R] = { @@ -363,7 +362,7 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{ val httpCon = url.openConnection.asInstanceOf[HttpURLConnection] httpCon.setDoOutput(true) httpCon.setRequestMethod("PUT") - val userPassword = read(Path(sonatypeLogin)).trim + val userPassword = new String(readAllBytes(sonatypeLogin.toPath)).trim val encoding = new sun.misc.BASE64Encoder().encode(userPassword.getBytes) httpCon.setRequestProperty("Authorization", "Basic " ++ encoding) httpCon.setRequestProperty("Content-Type", "application/binary") diff --git a/stage2/Scaffold.scala b/stage2/Scaffold.scala index e181ebf..620d4fb 100644 --- a/stage2/Scaffold.scala +++ b/stage2/Scaffold.scala @@ -1,13 +1,12 @@ package cbt import java.io._ +import java.nio.file._ import java.net._ -import ammonite.ops.{cwd => _,_} - trait Scaffold{ def logger: Logger private def createFile( projectDirectory: File, fileName: String, code: String ){ - write( Path( projectDirectory.string ++ "/" ++ fileName ), code ) + Files.write( ( projectDirectory ++ ("/" ++ fileName) ).toPath, code.getBytes, StandardOpenOption.CREATE_NEW ) import scala.Console._ println( GREEN ++ "Created " ++ fileName ++ RESET ) } -- cgit v1.2.3