Skip to content
Permalink
Browse files

0.2.7

  • Loading branch information...
lihaoyi committed Jun 8, 2019
1 parent 87e68c6 commit f6f6a9178f1bf8e17d5cee9ba40577861820fd58
@@ -1,23 +1,24 @@
language: scala
git:
depth: false
cache:
directories:
- $HOME/.cache
- $HOME/.ivy2/cache
- $HOME/.sbt
script:
- sbt ++$TRAVIS_SCALA_VERSION fansiJVM/test fansiJS/test
sudo: false
stages:
- name: test
- name: release
if: ((branch = master AND type = push) OR (tag IS present)) AND NOT fork
jobs:
sudo: required
dist: trusty
addons:
apt:
update: true

before_script:
- git fetch --tags

jdk:
- oraclejdk8

matrix:
include:
- scala: 2.10.7
- scala: 2.11.12
- scala: 2.12.8
- scala: 2.13.0-RC1
- stage: release
script: sbt ci-release
- stage: build
env: CI_SCRIPT="mill -i __.__.test"
jdk: oraclejdk8

script:
- curl -L -o ~/bin/mill https://github.com/lihaoyi/mill/releases/download/0.4.0/0.4.0-12-102ddf && chmod +x ~/bin/mill
- export PATH=~/bin/mill:$PATH
- curl https://raw.githubusercontent.com/scala-native/scala-native/b7851c4dc2a22c9fd9202aea3d97e2a68910b918/scripts/travis_setup.sh | bash -x
- "$CI_SCRIPT"
@@ -15,7 +15,6 @@ inThisBuild(List(

val baseSettings = Seq(
name := "fansi",

scalaVersion := "2.12.8",
crossScalaVersions := Seq("2.11.12", "2.12.8", "2.13.0")
)
@@ -0,0 +1,93 @@
import mill._, scalalib._, scalajslib._, scalanativelib._, publish._


trait FansiModule extends PublishModule {
def artifactName = "Fansi"

def publishVersion = "0.2.7"

def pomSettings = PomSettings(
description = artifactName(),
organization = "com.lihaoyi",
url = "https://github.com/lihaoyi/Fansi",
licenses = Seq(License.MIT),
scm = SCM(
"git://github.com/lihaoyi/Fansi.git",
"scm:git://github.com/lihaoyi/Fansi.git"
),
developers = Seq(
Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi")
)
)
}
trait FansiMainModule extends CrossScalaModule {
def millSourcePath = super.millSourcePath / offset
def ivyDeps = Agg(ivy"com.lihaoyi::sourcecode::0.1.7")
def offset: os.RelPath = os.rel
def sources = T.sources(
super.sources()
.flatMap(source =>
Seq(
PathRef(source.path / os.up / source.path.last),
PathRef(source.path / os.up / os.up / source.path.last),
)
)
)

}


trait FansiTestModule extends ScalaModule with TestModule {
def crossScalaVersion: String
def testFrameworks = Seq("utest.runner.Framework")
def ivyDeps = Agg(ivy"com.lihaoyi::utest::0.6.9")
def offset: os.RelPath = os.rel
def millSourcePath = super.millSourcePath / os.up

def sources = T.sources(
super.sources()
.++(CrossModuleBase.scalaVersionPaths(crossScalaVersion, s => millSourcePath / s"src-$s" ))
.flatMap(source =>
Seq(
PathRef(source.path / os.up / "test" / source.path.last),
PathRef(source.path / os.up / os.up / "test" / source.path.last),
)
)
.distinct
)
}

object fansi extends Module {
object jvm extends Cross[JvmFansiModule]("2.12.8", "2.13.0")
class JvmFansiModule(val crossScalaVersion: String)
extends FansiMainModule with ScalaModule with FansiModule {
object test extends Tests with FansiTestModule{
val crossScalaVersion = JvmFansiModule.this.crossScalaVersion
}
}

object js extends Cross[JsFansiModule](
("2.12.8", "0.6.26"), ("2.13.0", "0.6.28")/*, ("2.12.8", "1.0.0-M8"), ("2.13.0", "1.0.0-M8")*/
)
class JsFansiModule(val crossScalaVersion: String, crossJSVersion: String)
extends FansiMainModule with ScalaJSModule with FansiModule {
def offset = os.up
def scalaJSVersion = crossJSVersion
object test extends Tests with FansiTestModule{
def offset = os.up
val crossScalaVersion = JsFansiModule.this.crossScalaVersion
}
}

object native extends Cross[NativeFansiModule](("2.11.12", "0.3.8")/*, ("2.11.12", "0.4.0-M2")*/)
class NativeFansiModule(val crossScalaVersion: String, crossScalaNativeVersion: String)
extends FansiMainModule with ScalaNativeModule with FansiModule {
def offset = os.up

def scalaNativeVersion = crossScalaNativeVersion
object test extends Tests with FansiTestModule{
def offset = os.up
val crossScalaVersion = NativeFansiModule.this.crossScalaVersion
}
}
}
File renamed without changes.
@@ -212,17 +212,21 @@ object FansiTests extends TestSuite{
}
}
def tabulate(all: Seq[fansi.Attr]) = {
all.map(attr => attr.toString + " " * (30 - attr.name.length))
println(
all.map(attr => attr.toString + " " * (30 - attr.name.length))
.grouped(3)
.map(_.mkString)
.mkString("\n")
)
}

def square(all : Seq[fansi.Attr]) = {
all.map( attr => attr.escapeOpt.getOrElse("") + "#")
println(
all.map( attr => attr.escapeOpt.getOrElse("") + "#")
.grouped(32)
.map(_.mkString)
.mkString("\n")
)
}


@@ -245,9 +249,9 @@ object FansiTests extends TestSuite{

"256 shades of gray" - square(for(i <- 0 to 255) yield fansi.Color.True(i,i,i))

'trueColors - tabulate(for(i <- 0 to 0xFFFFFF by 255) yield fansi.Color.True(i))
'trueColors - tabulate(for(i <- Range(0, 0xFFFFFF, 10000)) yield fansi.Color.True(i))

'trueBackgrounds - tabulate(for(i <- 0 to 0xFFFFFF by 255) yield fansi.Back.True(i))
'trueBackgrounds - tabulate(for(i <- Range(0, 0xFFFFFF, 10000)) yield fansi.Back.True(i))

'blackState - assert (fansi.Color.lookupAttr(273 << 3) == fansi.Color.True(0,0,0) )

@@ -261,20 +265,21 @@ object FansiTests extends TestSuite{
def check(frag: fansi.Str) = {
val parsed = fansi.Str(frag.render)
assert(parsed == frag)
parsed
print(parsed)
}
* - check(fansi.Color.True(255, 0, 0)("lol"))
* - check(fansi.Color.True(1, 234, 56)("lol"))
* - check(fansi.Color.True(255, 255, 255)("lol"))
* - check(fansi.Color.True(10000)("lol"))
* - {
(for(i <- 0 to 255) yield check(fansi.Color.True(i,i,i)("x"))).mkString
for(i <- 0 to 255) yield check(fansi.Color.True(i,i,i)("x"))
println()
}
* - check(
"#" + fansi.Color.True(127, 126, 0)("lol") + "omg" + fansi.Color.True(127, 126, 0)("wtf")
)

* - check(square(for(i <- 0 to 255) yield fansi.Color.True(i,i,i)))
* - square(for(i <- 0 to 255) yield fansi.Color.True(i,i,i))


}

This file was deleted.

This file was deleted.

@@ -250,7 +250,7 @@ Scaladoc
Changelog
---------

### 0.2.6
### 0.2.7

- Support for Scala 2.13.0 final

0 comments on commit f6f6a91

Please sign in to comment.
You can’t perform that action at this time.