Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for 2.10 to 2.12 #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
language: scala
jdk: oraclejdk8
script:
- sbt +test
79 changes: 45 additions & 34 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,25 @@ name := "ascii-graphs"

organization := "com.github.mdr"

version := "0.0.6"
version := "0.0.7-SNAPSHOT"

scalaVersion := "2.12.1"
scalaVersion := "2.12.3"

crossScalaVersions := Seq("2.9.1", "2.9.2", "2.10.1")
crossScalaVersions := Seq("2.10.6", "2.11.11", "2.12.3")

scalacOptions ++= Seq("-deprecation")
scalacOptions ++= Seq(
"-deprecation",
"-encoding",
"UTF-8",
"-feature",
"-unchecked"
)

javacOptions ++= Seq("-source", "1.6", "-target", "1.6")

libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"

libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.13.4" % "test"
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.1" % Test,
"org.scalacheck" %% "scalacheck" % "1.13.4" % Test
)

// Screen-sized dependency graph:
// libraryDependencies += "org.vert-x" % "vertx-core" % "1.3.1.final"
Expand All @@ -27,39 +33,44 @@ EclipseKeys.eclipseOutput := Some("bin")

import com.typesafe.sbt.SbtScalariform.ScalariformKeys

ScalariformKeys.preferences <<= baseDirectory.apply { dir =>
ScalariformKeys.preferences := {
val dir = baseDirectory.value
scalariform.formatter.preferences.PreferencesImporterExporter.loadPreferences((dir / "formatterPreferences.properties").getPath)
}

publishMavenStyle := true

publishArtifact in Test := false

publishTo <<= isSnapshot(
if (_) Some("snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/")
else Some("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2/"))

pomExtra := {
<inceptionYear>2012</inceptionYear>
<url>http://github.com/mdr/ascii-graphs</url>
<licenses>
<license>
<name>MIT License</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>[email protected]:mdr/ascii-graphs.git</url>
<connection>scm:git:[email protected]:mdr/ascii-graphs</connection>
</scm>
<developers>
<developer>
<id>mdr</id>
<name>Matt Russell</name>
<url>https://github.com/mdr/</url>
</developer>
</developers>
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (version.value.trim.endsWith("SNAPSHOT")) {
Some("snapshots" at nexus + "content/repositories/snapshots")
}
else {
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
}

startYear := Some(2012)

homepage := Some(url("http://github.com/mdr/ascii-graphs"))

scmInfo := Some(
ScmInfo(
url("https://github.com/mdr/ascii-graphs"),
"scm:git:[email protected]:mdr/ascii-graphs.git"
)
)

developers +=
Developer(
"mdr",
"Matt Russell",
"[email protected]",
url("https://github.com/mdr/")
)

licenses := Seq("MIT License" -> url("http://www.opensource.org/licenses/mit-license.php"))

// scalacOptions in (Compile, doc) += "-diagrams"
3 changes: 1 addition & 2 deletions project/build.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
sbt.version=0.13.13

sbt.version=0.13.16
2 changes: 1 addition & 1 deletion src/main/scala/com/github/mdr/ascii/common/Region.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ case class Region(topLeft: Point, bottomRight: Point) extends Translatable[Regio

def points: List[Point] =
for {
row ← (topRow to bottomRow toList)
row ← (topRow to bottomRow).toList
column ← leftColumn to rightColumn
} yield Point(row, column)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ trait DiagramImplementation { self: DiagramParser ⇒
val row = start.row

def points: List[Point] =
for (column ← start.column to end.column toList)
for (column ← (start.column to end.column).toList)
yield Point(row, column)

val text: String = {
Expand Down Expand Up @@ -62,10 +62,10 @@ trait DiagramImplementation { self: DiagramParser ⇒

def contentsRegion: Region = Region(topLeft.right.down, bottomRight.up.left)

val leftBoundary: List[Point] = for (row ← topLeft.row to bottomRight.row toList) yield Point(row, topLeft.column)
val rightBoundary: List[Point] = for (row ← topLeft.row to bottomRight.row toList) yield Point(row, bottomRight.column)
val topBoundary: List[Point] = for (column ← topLeft.column to bottomRight.column toList) yield Point(topLeft.row, column)
val bottomBoundary: List[Point] = for (column ← topLeft.column to bottomRight.column toList) yield Point(bottomRight.row, column)
val leftBoundary: List[Point] = for (row ← (topLeft.row to bottomRight.row).toList) yield Point(row, topLeft.column)
val rightBoundary: List[Point] = for (row ← (topLeft.row to bottomRight.row).toList) yield Point(row, bottomRight.column)
val topBoundary: List[Point] = for (column ← (topLeft.column to bottomRight.column).toList) yield Point(topLeft.row, column)
val bottomBoundary: List[Point] = for (column ← (topLeft.column to bottomRight.column).toList) yield Point(bottomRight.row, column)

val boundaryPoints: Set[Point] = leftBoundary.toSet ++ rightBoundary.toSet ++ topBoundary.toSet ++ bottomBoundary.toSet

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import org.scalatest.{FlatSpec, Matchers}
import com.github.mdr.ascii.graph.Graph
import com.github.mdr.ascii.util.Utils

import scala.language.reflectiveCalls

class GraphReflowTest extends FlatSpec with Matchers {

reflowingGraph("""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package com.github.mdr.ascii.layout.layering
import org.scalatest.{FlatSpec, Matchers}
import com.github.mdr.ascii.graph.Graph

import scala.language.reflectiveCalls

class LongestDistanceToSinkTest extends FlatSpec with Matchers {

distancesToSinks("""
Expand Down