Skip to content

Commit

Permalink
Add publish to maven central
Browse files Browse the repository at this point in the history
  • Loading branch information
loicknuchel committed Oct 30, 2020
1 parent 5b4c06c commit 059fe3f
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 14 deletions.
38 changes: 34 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,42 @@
language: scala
scala:
- 2.12.12
- 2.13.3

jdk:
- openjdk8

before_install:
- git fetch --tags

stages:
- name: test
- name: release
if: ((branch = master AND type = push) OR (tag IS present)) AND NOT fork

jobs:
include:
# stage="test" if no stage is specified
- name: test jdk11 2.13
scala: [2.13.3]
jdk: openjdk11
script: sbt ++$TRAVIS_SCALA_VERSION test
- name: test jdk8 2.13
scala: [2.13.3]
jdk: openjdk8
script: sbt ++$TRAVIS_SCALA_VERSION test
- name: test jdk11 2.12
scala: [2.12.12]
jdk: openjdk11
script: sbt ++$TRAVIS_SCALA_VERSION test
- name: test jdk8 2.12
scala: [2.12.12]
jdk: openjdk8
script: sbt ++$TRAVIS_SCALA_VERSION test
# run ci-release only if previous stages passed
- stage: release
name: release
jdk: openjdk8
script: sbt ci-release

cache:
directories:
- $HOME/.ivy2/cache
- $HOME/.sbt/boot/
- $HOME/.sbt
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# SafeQL [![Build Status](https://travis-ci.com/loicknuchel/SafeQL.svg?branch=master)](https://travis-ci.com/loicknuchel/SafeQL)
# SafeQL [![travis-badge][]][travis] [![release-badge][]][release] [![maven-badge][]][maven]

[travis]: https://travis-ci.com/loicknuchel/SafeQL
[travis-badge]: https://travis-ci.com/loicknuchel/SafeQL.svg?branch=master
[release]: https://github.com/loicknuchel/SafeQL/releases/latest
[release-badge]: https://img.shields.io/github/release/loicknuchel/SafeQL.svg
[maven]: https://maven-badges.herokuapp.com/maven-central/loicknuchel/SafeQL_2.13
[maven-badge]: https://maven-badges.herokuapp.com/maven-central/loicknuchel/SafeQL_2.13/badge.svg

A Scala DSL to build typesafe SQL queries on top of Doobie.

## Quick Start

Add the dependency to your `build.sbt` (Scala 2.11 or later):
Add the dependency to your `build.sbt` (Scala 2.12 or later):

```scala
libraryDependencies += "fr.loicknuchel" %% "safeql" % "<version>"
Expand Down
14 changes: 10 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
name := "SafeQL"
version := "0.1.0"
// version := "0.1.0-SNAPSHOT" set by 'sbt-dynver' plugin, brought in by 'sbt-ci-release' plugin

// see https://www.scala-sbt.org/1.x/docs/Cross-Build.html
// can't build for 2.11 as doobie is no longer available for scala 2.11
val supportedScalaVersions = List("2.13.3", "2.12.12")
scalaVersion := supportedScalaVersions.head
crossScalaVersions := supportedScalaVersions
scalaVersion := "2.12.12"
crossScalaVersions := List("2.12.12", "2.13.3")

// publishing informations
organization := "fr.loicknuchel"
homepage := Some(url("https://github.com/loicknuchel/SafeQL"))
licenses += ("MIT", url("https://opensource.org/licenses/mit-license.php"))
developers := List(Developer("loicknuchel", "Loïc Knuchel", "loicknuchel@gmail.com", url("https://loicknuchel.fr")))
scmInfo := Some(ScmInfo(url("https://github.com/loicknuchel/SafeQL"), "git@github.com:loicknuchel/SafeQL.git"))

libraryDependencies ++= Seq(
"org.tpolecat" %% "doobie-core" % "0.9.2",
Expand Down
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.14")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.3") // publish to maven central using sonatype nexus
6 changes: 2 additions & 4 deletions src/main/scala/fr/loicknuchel/safeql/utils/Extensions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ object Extensions {
}

implicit class RichTraversableOnce[A, M[X] <: TraversableOnce[X]](val in: M[A]) extends AnyVal {
def toNel: Either[IllegalArgumentException, NonEmptyList[A]] = {
val list = in.toList
NonEmptyList.fromList(list).toEither(new IllegalArgumentException("List should not be empty"))
}
def toNel: Either[IllegalArgumentException, NonEmptyList[A]] =
NonEmptyList.fromList(in.toList).toEither(new IllegalArgumentException("List should not be empty"))

def mk(concat: (A, A) => A): Option[A] = in.toList match {
case Nil => None
Expand Down

0 comments on commit 059fe3f

Please sign in to comment.