This file contains hidden or 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 sbt.State | |
| object CommandRunner { | |
| /** | |
| * Convert the given command string to a release step action, | |
| * preserving and invoking remaining commands | |
| * Note: This was copied from https://github.com/sbt/sbt-release/blob/663cfd426361484228a21a1244b2e6b0f7656bdf/src/main/scala/ReleasePlugin.scala#L99-L115 | |
| */ | |
| def runCommand(command: String): State => State = { st: State => |
This file contains hidden or 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 x7c1.wheat.splicer.core | |
| import org.scalatest.matchers.{MatchResult, Matcher} | |
| trait CustomMatchers { | |
| def containAllOf[A: Manifest : StringLike](expected: Seq[A]): Matcher[Seq[A]] = { | |
| val asString = implicitly[StringLike[A]] | |
| Matcher { actual => | |
| val unknown = expected.find(!actual.contains(_)) | |
| val toMessage = (name: A) => { |
This file contains hidden or 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 x7c1.wheat.splicer.core.logger | |
| object Tap { | |
| object implicits { | |
| implicit class Provider[A](val target: A) extends AnyVal { | |
| def tap(f: (A => Unit)*): A = { | |
| f foreach (_ (target)) | |
| target | |
| } | |
| } |
This file contains hidden or 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 x7c1.wheat.splicer.lib | |
| import sbt.Def.Initialize | |
| import sbt.{Def, Logger, Task} | |
| case class Reader[X, A](run: X => A) { | |
| def map[B](f: A => B): Reader[X, B] = { | |
| new Reader[X, B](x => f(run(x))) | |
| } |
This file contains hidden or 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 sbt.complete.DefaultParsers.{NotSpace, Space, failure, token} | |
| import sbt.complete.Parser | |
| import scala.util.{Failure, Success, Try} | |
| object ReductiveParser { | |
| def from(items: Seq[String]): Parser[Seq[String]] = { | |
| new ReductiveParser(items).parser | |
| } | |
| } |
This file contains hidden or 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
| trait Fate[X, +L, +R]{ | |
| def map[R2](f: R => R2): Fate[X, L, R2] | |
| def flatMap[L2 >: L, R2](f: R => Fate[X, L2, R2]): Fate[X, L2, R2] | |
| def run[L2 >: L, R2 >: R]: X => (Either[L2, R2] => Unit) => Unit | |
| } | |
| object Fate { | |
| def apply[X, L, R](underlying: X => (Either[L, R] => Unit) => Unit): Fate[X, L, R] = { | |
| new FateImpl(underlying) | |
| } | |
| } |
This file contains hidden or 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
| ShadowLog.stream = System.out; |
This file contains hidden or 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 x7c1.wheat.modern.callback.either | |
| import x7c1.wheat.modern.callback.either.EitherTask.| | |
| import x7c1.wheat.modern.patch.TaskAsync | |
| import scala.concurrent.{Future, Promise} | |
| class EitherTask [L, R] private (f: (Either[L, R] => Unit) => Unit){ | |
| def flatMap[A](g: R => L | A): L | A = |
This file contains hidden or 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
| def aar(moduleId: ModuleID, name: String): ModuleID = { | |
| artifacts(moduleId, name, "aar") | |
| } | |
| def aar(moduleId: ModuleID): ModuleID = { | |
| artifacts(moduleId, moduleId.name, "aar") | |
| } | |
| val jcenter = MavenRepository("jcenter", "https://jcenter.bintray.com/") | |
| def artifacts(moduleId: ModuleID, name: String, extension: String): ModuleID = | |
| moduleId artifacts Artifact(name, extension, extension) exclude |
This file contains hidden or 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
| trait CallbackTask[EVENT] extends ((EVENT => Unit) => Unit) { | |
| import scala.language.higherKinds | |
| type This[A] <: CallbackTask[A] | |
| type Builder[A] = ((A => Unit) => Unit) => This[A] | |
| def map[A: Builder](f: EVENT => A): This[A] = implicitly[Builder[A]] apply { | |
| g => apply(f andThen g) | |
| } |