From 310847a7064b8cb7cca313ef859f3279f075ed0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jerzy=20M=C3=BCller?= Date: Fri, 20 Feb 2015 13:23:56 +0100 Subject: [PATCH] Improvements to build and docs Coveralls added for uploading coverage statistics. Release plugin added for reasy release process, see CONTRIBUTING.md for more details. Build file simplified, big chunks of config moved to `project`. Cache resolution for sbt enabled. Ignored test is now pending until fixed. Minor fixes in readme. Scaladoc uploaded to virtuslab.com/beholder-api. --- .gitattributes | 1 + .travis.yml | 4 +- CONTRIBUTING.md | 7 +- README.md | 16 ++-- build.sbt | 64 ++------------- project/Settings.scala | 81 +++++++++++++++++++ project/plugins.sbt | 17 +++- .../beholder/suites/FiltersTestSuite.scala | 12 +-- version.sbt | 1 + 9 files changed, 131 insertions(+), 72 deletions(-) create mode 100644 project/Settings.scala create mode 100644 version.sbt diff --git a/.gitattributes b/.gitattributes index ddf51d7..0c24955 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,5 @@ *.MF eol=lf +*.md eol=lf *.sbt eol=lf *.scala eol=lf *.yml eol=lf diff --git a/.travis.yml b/.travis.yml index 1cfce33..9f4a125 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,4 +5,6 @@ jdk: - openjdk7 - oraclejdk8 -script: sbt -no-colors ++$TRAVIS_SCALA_VERSION clean coverage test \ No newline at end of file +sbt_args: -no-colors +script: sbt ++$TRAVIS_SCALA_VERSION clean coverage test doc +after_success: sbt coveralls \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fd03f77..1110142 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,5 +28,8 @@ Minimum coverage is set to *48%* (which is current coverage) so all code you add Releasing --------- -Before release you must have access to Sonatype and have PGP keys for signing artifacts. -For make release just use `+publishSigned +releaseSonatype`. +Before release you must have access to Sonatype and have PGP keys for signing artifacts. + +To automate release process, `beholder` uses [sbt-release](https://github.com/sbt/sbt-release) plugin. To release a new version, just use `sbt release` and follow instructions. For more information, see plugin docs. + +**Warn** - You should *not* update version file (`version.sbt`) yourself, `sbt-release` does it for you. diff --git a/README.md b/README.md index 0425a1c..091fa5a 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,19 @@ Beholder: Play-Slick library for data presentation ================================================== + [![Build Status](https://travis-ci.org/VirtusLab/beholder.svg?branch=master)](https://travis-ci.org/VirtusLab/beholder) +[![Coverage Status](https://img.shields.io/coveralls/VirtusLab/beholder.svg)](https://coveralls.io/r/VirtusLab/beholder?branch=master) -Standard part of many application are list of data that is not a effect of simple query from one table but junction and aggregation of data from many tables. Beholder provides support for such elemets. +Standard part of many application are list of data that is not a effect of simple query from one table but junction and aggregation of data from many tables. Beholder provides support for such elements. Features: * views as table * declaring filters for data -* support for sorting, filtering on multiple (custom) datatypes +* support for sorting, filtering on multiple (custom) data types + +Beholder is Open Source under [Apache 2.0 license](LICENSE). + +ScalaDoc API for [0.2.6](http://virtuslab.com/beholder-api/0.2.6). Contributors ------------ @@ -17,7 +23,7 @@ Authors: * [Mikołaj Jakubowski](https://github.com/mkljakubowski) * [Krzysztof Borowski](https://github.com/liosedhel) -Feel free to use it, test it and to contribute! +Feel free to use it, test it and to contribute! For some helpful tips'n'tricks, see [contribution guide](CONTRIBUTING.md). Getting beholder ---------------- @@ -25,10 +31,10 @@ Getting beholder For latest version (Scala 2.11.5 compatible) use: ```scala -libraryDependencies += "org.virtuslab" %% "beholder" % "0.2.2" +libraryDependencies += "org.virtuslab" %% "beholder" % "0.2.6" ``` -Or see Maven repository for [2.10](http://maven-repository.com/artifact/org.virtuslab/beholder_2.10) and [2.11](http://maven-repository.com/artifact/org.virtuslab/beholder_2.11). +Or see [Maven repository](http://maven-repository.com/artifact/org.virtuslab/beholder_2.11). Examples ======== diff --git a/build.sbt b/build.sbt index 931489a..3e7d7ac 100644 --- a/build.sbt +++ b/build.sbt @@ -1,25 +1,16 @@ +import sbtrelease.ReleasePlugin + organization := "org.virtuslab" name := "beholder" -version := "0.2.5" - scalaVersion := "2.11.5" -resolvers += Resolver.typesafeRepo("releases") +updateOptions := updateOptions.value.withCachedResolution(true) -resolvers += Resolver.sonatypeRepo("releases") +libraryDependencies ++= Dependencies.libraries -resolvers += Resolver.sonatypeRepo("snapshots") - -libraryDependencies ++= Seq( - "com.typesafe.slick" %% "slick" % "2.1.0", - "com.typesafe.play" %% "play-slick" % "0.8.1", - "org.virtuslab" %% "unicorn" % "0.6.2", - "org.scalatest" %% "scalatest" % "2.2.3" % "test", - "com.typesafe.play" %% "play-test" % "2.3.7" % "test", - "com.h2database" % "h2" % "1.4.184" % "test" -) +resolvers ++= Resolvers.all parallelExecution in Test := false @@ -35,47 +26,8 @@ scalacOptions ++= Seq( com.typesafe.sbt.SbtScalariform.scalariformSettings -pomExtra := https://github.com/VirtusLab/beholder - - - Apache-style - http://www.apache.org/licenses/LICENSE-2.0 - repo - - - - https://github.com/VirtusLab/beholder.git - scm:git:git@github.com:VirtusLab/beholder.git - - - - VirtusLab - VirtusLab - http://www.virtuslab.com/ - - - JerzyMuller - Jerzy Müller - https://github.com/Kwestor - - - KrzysztofRomanowski - Krzysztof Romanowski - https://github.com/romanowski - - - -xerial.sbt.Sonatype.sonatypeSettings - -// Scoverage setup - -ScoverageSbtPlugin.ScoverageKeys.coverageMinimum := 48 +Settings.sonatype -ScoverageSbtPlugin.ScoverageKeys.coverageFailOnMinimum := true +Settings.scoverage -ScoverageSbtPlugin.ScoverageKeys.coverageExcludedPackages := Seq( - "org.virtuslab.beholder.utils.generators.*", - // only BaseView5 is tested, all are generated, so there is no need to check them all - "org.virtuslab.beholder.views.FilterableViews.*", - "org.virtuslab.beholder.views.FilterableViewsGenerateCode.BaseView[^5].*" -).mkString(";") +Settings.release diff --git a/project/Settings.scala b/project/Settings.scala new file mode 100644 index 0000000..7040043 --- /dev/null +++ b/project/Settings.scala @@ -0,0 +1,81 @@ +import com.typesafe.sbt.pgp.PgpKeys +import sbt._ +import sbt.Keys._ +import sbt.Resolver +import sbtrelease.ReleasePlugin +import sbtrelease.ReleasePlugin.ReleaseKeys +import scoverage.ScoverageSbtPlugin +import xerial.sbt.Sonatype + +object Settings { + + val scoverage = Seq( + ScoverageSbtPlugin.ScoverageKeys.coverageMinimum := 48, + + ScoverageSbtPlugin.ScoverageKeys.coverageFailOnMinimum := true, + + ScoverageSbtPlugin.ScoverageKeys.coverageExcludedPackages := Seq( + "org.virtuslab.beholder.utils.generators.*", + // only BaseView5 is tested, all are generated, so there is no need to check them all + "org.virtuslab.beholder.views.FilterableViews.*", + "org.virtuslab.beholder.views.FilterableViewsGenerateCode.BaseView[^5].*" + ).mkString(";") + ) + + val sonatype = Seq( + pomExtra := https://github.com/VirtusLab/beholder + + + Apache-style + http://www.apache.org/licenses/LICENSE-2.0 + repo + + + + https://github.com/VirtusLab/beholder.git + scm:git:git@github.com:VirtusLab/beholder.git + + + + VirtusLab + VirtusLab + http://www.virtuslab.com/ + + + JerzyMuller + Jerzy Müller + https://github.com/Kwestor + + + KrzysztofRomanowski + Krzysztof Romanowski + https://github.com/romanowski + + + ) ++ Sonatype.sonatypeSettings + + val release = Seq( + ReleaseKeys.publishArtifactsAction := PgpKeys.publishSigned.value + ) ++ ReleasePlugin.releaseSettings + +} + +object Resolvers { + val all: Seq[MavenRepository] = Seq( + Resolver.typesafeRepo("releases"), + Resolver.sonatypeRepo("releases"), + Resolver.sonatypeRepo("snapshots") + ) +} + +object Dependencies { + + val libraries: Seq[ModuleID] = Seq( + "com.typesafe.slick" %% "slick" % "2.1.0", + "com.typesafe.play" %% "play-slick" % "0.8.1", + "org.virtuslab" %% "unicorn" % "0.6.2", + "com.typesafe.play" %% "play-test" % "2.3.8" % "test", + "org.scalatest" %% "scalatest" % "2.2.3" % "test", + "com.h2database" % "h2" % "1.4.184" % "test" + ) +} \ No newline at end of file diff --git a/project/plugins.sbt b/project/plugins.sbt index 68ded97..dd05120 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,11 +1,22 @@ -resolvers += "Sonatype OSS Releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2" addSbtPlugin("com.danieltrinh" % "sbt-scalariform" % "1.3.0") -addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3") +/* ------------------ */ +/* Deploy and release */ + +addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.1") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "0.2.1") +addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.8.5") + +/* ------------- */ +/* Code coverage */ + resolvers += Classpaths.sbtPluginReleases -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.0.1") \ No newline at end of file +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.0.1") + +addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.0.0.BETA1") + +/*---------------*/ \ No newline at end of file diff --git a/src/test/scala/org/virtuslab/beholder/suites/FiltersTestSuite.scala b/src/test/scala/org/virtuslab/beholder/suites/FiltersTestSuite.scala index 7719c78..ccb5365 100644 --- a/src/test/scala/org/virtuslab/beholder/suites/FiltersTestSuite.scala +++ b/src/test/scala/org/virtuslab/beholder/suites/FiltersTestSuite.scala @@ -70,13 +70,15 @@ trait FiltersTestSuite[Formatter] extends BaseSuite[Formatter] { } //h2db does not have ilike operator - ignore should "filter by string field" in baseFilterTest { + it should "filter by string field" in baseFilterTest { data => - import data._ - val orderByCoreDesc = doFilters(data, baseFilter.copy(data = baseFilter.data.updated(1, Some("buntu")))) - val fromDbOrderedByCoresDesc = allFromDb.filter(_.system.contains("buntu")) + pendingUntilFixed { + import data._ + val orderByCoreDesc = doFilters(data, baseFilter.copy(data = baseFilter.data.updated(1, Some("buntu")))) + val fromDbOrderedByCoresDesc = allFromDb.filter(_.system.contains("buntu")) - orderByCoreDesc should contain theSameElementsInOrderAs fromDbOrderedByCoresDesc.drop(1) + orderByCoreDesc should contain theSameElementsInOrderAs fromDbOrderedByCoresDesc.drop(1) + } } it should "not crash for date option" in baseFilterTest { diff --git a/version.sbt b/version.sbt new file mode 100644 index 0000000..58f6aea --- /dev/null +++ b/version.sbt @@ -0,0 +1 @@ +version in ThisBuild := "0.2.6" \ No newline at end of file