Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
87 additions
and
54 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import sbt._ | ||
import Keys._ | ||
import scalariform.formatter.preferences._ | ||
import com.typesafe.sbt.SbtScalariform.{ScalariformKeys, autoImport} | ||
import xerial.sbt.Sonatype._ | ||
|
||
val projectName = "lens" | ||
version := "2.0.0" | ||
name := projectName | ||
scalaVersion := "2.12.6" | ||
description := "Convenient ad-hoc lens Syntax on top of Monocle" | ||
|
||
val monocleVersion = "1.5.0" | ||
libraryDependencies ++= Seq( | ||
"com.github.julien-truffaut" %% "monocle-core" % monocleVersion, | ||
"com.github.julien-truffaut" %% "monocle-generic" % monocleVersion, | ||
"com.github.julien-truffaut" %% "monocle-macro" % monocleVersion, | ||
"org.scalactic" %% "scalactic" % "3.0.5", | ||
"org.scalatest" %% "scalatest" % "3.0.5" % "test" | ||
) | ||
resolvers ++= Seq(Resolver.sonatypeRepo("releases"),Resolver.sonatypeRepo("snapshots")) | ||
|
||
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-oSD") | ||
organizationName := "x.ai" | ||
organization := "ai.x" | ||
scalacOptions in (Compile, doc) ++= Seq( | ||
"-doc-footer", projectName+" is developed by Miguel Iglesias.", | ||
"-implicits", | ||
"-groups" | ||
) | ||
scalariformPreferences := scalariformPreferences.value | ||
.setPreference(AlignParameters, true) | ||
.setPreference(AlignArguments, true) | ||
.setPreference(AlignSingleLineCaseStatements, true) | ||
.setPreference(MultilineScaladocCommentsStartOnFirstLine, true) | ||
.setPreference(SpaceInsideParentheses, true) | ||
.setPreference(SpacesWithinPatternBinders, true) | ||
.setPreference(SpacesAroundMultiImports, true) | ||
.setPreference(DanglingCloseParenthesis, Preserve) | ||
.setPreference(DoubleIndentConstructorArguments, true) | ||
publishTo := sonatypePublishTo.value | ||
publishMavenStyle := true | ||
publishArtifact in Test := false | ||
pomIncludeRepository := { _ => false } | ||
licenses += ("Apache 2.0", url("http://github.com/xdotai/"+projectName+"/blob/master/LICENSE.txt")) | ||
homepage := Some(url("http://github.com/xdotai/"+projectName)) | ||
startYear := Some(2016) | ||
scmInfo := Some( | ||
ScmInfo( | ||
url(s"https://github.com/xdotai/$projectName"), | ||
s"scm:git@github.com:xdotai/$projectName.git" | ||
) | ||
) | ||
developers := List( | ||
Developer(id="caente", name="Miguel Iglesias", email="miguel.iglesias@human.x.ai", url=url("https://github.com/caente")) | ||
) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sbt.version=1.1.4 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.2") | ||
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.3") | ||
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3") | ||
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0") |
File renamed without changes.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package ai.x.lens | ||
|
||
import org.scalatest.FunSuite | ||
|
||
class Test extends FunSuite { | ||
|
||
test( "usage example" ) { | ||
case class Inner( i: Int ) | ||
case class Outer( inner: Inner, s: String ) | ||
val o = Outer( Inner( 5 ), "foo" ) | ||
|
||
val actual = | ||
o.lens( _.s ).set( "bar" ) | ||
.lens( _.inner.i ).modify( _ + 1 ) // .lens calls can be chained nicely | ||
|
||
val expected = Outer( Inner( 6 ), "bar" ) | ||
assert( expected == actual, s"$expected == $actual" ) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.