From 166a760716a2471f858cf9115e1f2e71b469e944 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 17 May 2017 18:38:16 -0700 Subject: [PATCH 001/224] Updated kotlin logging example link. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5c12077..d8887c1 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ poster.addPin("http://www.example.com/foo", "This is a test") poster.deletePin("http:///www.example.com/bar") ``` -[View Example](https://github.com/ethauvin/pinboard-poster/blob/master/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt#L199) +[View Example](https://github.com/ethauvin/pinboard-poster/blob/master/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt#L203) ### Java ```java From 36bf4794db8aeb8b1ab07de2db0f117fe254ebf8 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Thu, 18 May 2017 16:32:52 -0700 Subject: [PATCH 002/224] Cleanup. --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d8887c1..6fbcd50 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # [Pinboard](https://pinboard.in) Poster for Kotlin/Java -[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](http://opensource.org/licenses/BSD-3-Clause) [![Build Status](https://travis-ci.org/ethauvin/pinboard-poster.svg?branch=master)](https://travis-ci.org/ethauvin/pinboard-poster) [![Dependency Status](https://www.versioneye.com/user/projects/591c0293b81f680038a784b3/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/591c0293b81f680038a784b3) [![Download](https://api.bintray.com/packages/ethauvin/maven/pinboard-poster/images/download.svg) ](https://bintray.com/ethauvin/maven/pinboard-poster/_latestVersion) +[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](http://opensource.org/licenses/BSD-3-Clause) [![Build Status](https://travis-ci.org/ethauvin/pinboard-poster.svg?branch=master)](https://travis-ci.org/ethauvin/pinboard-poster) [![Dependency Status](https://www.versioneye.com/user/projects/591c0293b81f680038a784b3/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/591c0293b81f680038a784b3) [![Download](https://api.bintray.com/packages/ethauvin/maven/pinboard-poster/images/download.svg)](https://bintray.com/ethauvin/maven/pinboard-poster/_latestVersion) A small Kotlin/Java library for posting to [Pinboard](https://pinboard.in). @@ -113,8 +113,7 @@ logger.addHandler(consoleHandler); logger.setLevel(Level.FINE); ``` - -or using a property file. +or using a logging properties file. ## API End Point From 15b9772f5fdc42a0be833058346dc4b409fb810b Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Mon, 29 May 2017 19:24:54 -0700 Subject: [PATCH 003/224] Added circleci configuration. --- README.md | 2 +- circle.yml | 11 +++++++++++ kobalt/Build.kt.iml | 9 +++++++++ kobalt/src/Build.kt | 4 ++-- pinboard-poster.iml | 8 ++++---- pom.xml | 4 ++-- 6 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 circle.yml diff --git a/README.md b/README.md index 6fbcd50..f91f2b8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # [Pinboard](https://pinboard.in) Poster for Kotlin/Java -[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](http://opensource.org/licenses/BSD-3-Clause) [![Build Status](https://travis-ci.org/ethauvin/pinboard-poster.svg?branch=master)](https://travis-ci.org/ethauvin/pinboard-poster) [![Dependency Status](https://www.versioneye.com/user/projects/591c0293b81f680038a784b3/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/591c0293b81f680038a784b3) [![Download](https://api.bintray.com/packages/ethauvin/maven/pinboard-poster/images/download.svg)](https://bintray.com/ethauvin/maven/pinboard-poster/_latestVersion) +[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](http://opensource.org/licenses/BSD-3-Clause) [![Build Status](https://travis-ci.org/ethauvin/pinboard-poster.svg?branch=master)](https://travis-ci.org/ethauvin/pinboard-poster) [![Dependency Status](https://www.versioneye.com/user/projects/591c0293b81f680038a784b3/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/591c0293b81f680038a784b3) [![CircleCI](https://circleci.com/gh/ethauvin/pinboard-poster/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/pinboard-poster/tree/master) [![Download](https://api.bintray.com/packages/ethauvin/maven/pinboard-poster/images/download.svg)](https://bintray.com/ethauvin/maven/pinboard-poster/_latestVersion) A small Kotlin/Java library for posting to [Pinboard](https://pinboard.in). diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000..0351b69 --- /dev/null +++ b/circle.yml @@ -0,0 +1,11 @@ +machine: + java: + version: oraclejdk8 + +dependencies: + override: + - chmod +x kobaltw + +test: + override: + - ./kobaltw assemble \ No newline at end of file diff --git a/kobalt/Build.kt.iml b/kobalt/Build.kt.iml index 307aac2..88a1538 100644 --- a/kobalt/Build.kt.iml +++ b/kobalt/Build.kt.iml @@ -20,6 +20,15 @@ + + + + + + + + + diff --git a/kobalt/src/Build.kt b/kobalt/src/Build.kt index d036bc0..63db74d 100644 --- a/kobalt/src/Build.kt +++ b/kobalt/src/Build.kt @@ -24,7 +24,7 @@ val p = project { group = "net.thauvin.erik" description = "Pinboard Poster for Kotlin/Java" artifactId = name - version = "0.9.1" + version = "0.9.2" val localProperties = Properties().apply { val f = "local.properties" @@ -52,7 +52,7 @@ val p = project { } dependencies { - compile("org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3") + compile("org.jetbrains.kotlin:kotlin-stdlib:1.1.2-4") compile("com.squareup.okhttp3:okhttp:3.8.0") } diff --git a/pinboard-poster.iml b/pinboard-poster.iml index fbc7e4c..a2f0d39 100644 --- a/pinboard-poster.iml +++ b/pinboard-poster.iml @@ -22,9 +22,9 @@ - + - + @@ -40,9 +40,9 @@ - + - + diff --git a/pom.xml b/pom.xml index a2889ba..6c14fe2 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 net.thauvin.erik pinboard-poster - 0.9.1 + 0.9.2 pinboard-poster Pinboard Poster for Kotlin/Java https://github.com/ethauvin/pinboard-poster @@ -30,7 +30,7 @@ org.jetbrains.kotlin kotlin-stdlib - 1.1.2-3 + 1.1.2-4 com.squareup.okhttp3 From c78f43280f7f346ec96655861f15daf774d55373 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 30 May 2017 15:26:57 -0700 Subject: [PATCH 004/224] Added release badge. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f91f2b8..fc3b42f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # [Pinboard](https://pinboard.in) Poster for Kotlin/Java -[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](http://opensource.org/licenses/BSD-3-Clause) [![Build Status](https://travis-ci.org/ethauvin/pinboard-poster.svg?branch=master)](https://travis-ci.org/ethauvin/pinboard-poster) [![Dependency Status](https://www.versioneye.com/user/projects/591c0293b81f680038a784b3/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/591c0293b81f680038a784b3) [![CircleCI](https://circleci.com/gh/ethauvin/pinboard-poster/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/pinboard-poster/tree/master) [![Download](https://api.bintray.com/packages/ethauvin/maven/pinboard-poster/images/download.svg)](https://bintray.com/ethauvin/maven/pinboard-poster/_latestVersion) +[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](http://opensource.org/licenses/BSD-3-Clause) [![release](http://github-release-version.herokuapp.com/github/ethauvin/pinboard-poster/release.svg?style=flat)](https://github.com/ethauvin/pinboard-poster/releases/latest) [![Build Status](https://travis-ci.org/ethauvin/pinboard-poster.svg?branch=master)](https://travis-ci.org/ethauvin/pinboard-poster) [![Dependency Status](https://www.versioneye.com/user/projects/591c0293b81f680038a784b3/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/591c0293b81f680038a784b3) [![CircleCI](https://circleci.com/gh/ethauvin/pinboard-poster/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/pinboard-poster/tree/master) [![Download](https://api.bintray.com/packages/ethauvin/maven/pinboard-poster/images/download.svg)](https://bintray.com/ethauvin/maven/pinboard-poster/_latestVersion) A small Kotlin/Java library for posting to [Pinboard](https://pinboard.in). From 459b1e5a9b7fe5d01d9c9e17da97bc24c4665fb4 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Fri, 2 Jun 2017 15:12:55 -0700 Subject: [PATCH 005/224] Fixed Gradle instructions. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fc3b42f..e237cce 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ To install and run from Gradle, add the following to the build.gradle file: ```gradle dependencies { - compileOnly 'net.thauvin.erik:pinboard-poster:0.9.1' + compile 'net.thauvin.erik:pinboard-poster:0.9.1' } ``` From 008ab49b613eca36af34620636184c91fd796d3c Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 7 Jun 2017 21:10:18 -0700 Subject: [PATCH 006/224] Fixed badges. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e237cce..262bc60 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # [Pinboard](https://pinboard.in) Poster for Kotlin/Java -[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](http://opensource.org/licenses/BSD-3-Clause) [![release](http://github-release-version.herokuapp.com/github/ethauvin/pinboard-poster/release.svg?style=flat)](https://github.com/ethauvin/pinboard-poster/releases/latest) [![Build Status](https://travis-ci.org/ethauvin/pinboard-poster.svg?branch=master)](https://travis-ci.org/ethauvin/pinboard-poster) [![Dependency Status](https://www.versioneye.com/user/projects/591c0293b81f680038a784b3/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/591c0293b81f680038a784b3) [![CircleCI](https://circleci.com/gh/ethauvin/pinboard-poster/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/pinboard-poster/tree/master) [![Download](https://api.bintray.com/packages/ethauvin/maven/pinboard-poster/images/download.svg)](https://bintray.com/ethauvin/maven/pinboard-poster/_latestVersion) +[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](http://opensource.org/licenses/BSD-3-Clause) [![release](http://github-release-version.herokuapp.com/github/ethauvin/pinboard-poster/release.svg?style=flat)](https://github.com/ethauvin/pinboard-poster/releases/latest) [![Download](https://api.bintray.com/packages/ethauvin/maven/pinboard-poster/images/download.svg)](https://bintray.com/ethauvin/maven/pinboard-poster/_latestVersion) +[![Dependency Status](https://www.versioneye.com/user/projects/591c0293b81f680038a784b3/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/591c0293b81f680038a784b3) [![Build Status](https://travis-ci.org/ethauvin/pinboard-poster.svg?branch=master)](https://travis-ci.org/ethauvin/pinboard-poster) [![CircleCI](https://circleci.com/gh/ethauvin/pinboard-poster/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/pinboard-poster/tree/master) A small Kotlin/Java library for posting to [Pinboard](https://pinboard.in). From 7e5ac30e169714892b6085ac0aac0b394b676354 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 10 Oct 2017 20:57:58 -0700 Subject: [PATCH 007/224] Kobalt and libraries updates. --- .idea/kobalt.xml | 2 +- kobalt/src/Build.kt | 6 +++--- kobalt/wrapper/kobalt-wrapper.properties | 2 +- pom.xml | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.idea/kobalt.xml b/.idea/kobalt.xml index 7e18043..74645f4 100644 --- a/.idea/kobalt.xml +++ b/.idea/kobalt.xml @@ -6,7 +6,7 @@ - - - - - - - - - \ No newline at end of file diff --git a/kobalt/src/Build.kt b/kobalt/src/Build.kt index a44e06d..d030b58 100644 --- a/kobalt/src/Build.kt +++ b/kobalt/src/Build.kt @@ -57,8 +57,7 @@ val p = project { } dependenciesTest { - //compile("org.testng:testng:6.11") - //compile("org.jetbrains.kotlin:kotlin-test:1.1.2-3") + compile("org.testng:testng:6.12") } assemble { diff --git a/pinboard-poster.iml b/pinboard-poster.iml index a2f0d39..20330cb 100644 --- a/pinboard-poster.iml +++ b/pinboard-poster.iml @@ -13,27 +13,81 @@ - + - + - - + + - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -48,5 +102,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt b/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt new file mode 100644 index 0000000..1514617 --- /dev/null +++ b/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt @@ -0,0 +1,72 @@ +/* + * PinboardPosterTest.kt + * + * Copyright (c) 2017, Erik C. Thauvin (erik@thauvin.net) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of this project nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.thauvin.erik.pinboard + +import org.testng.Assert +import org.testng.annotations.Test +import java.io.FileInputStream +import java.util.* + +class PinboardPosterTest { + private val url = "http://www.foo.com/" + private val desc = "This is a test." + private val p = Properties().apply { FileInputStream("local.properties").use { fis -> load(fis) } } + private val apiToken = p.getProperty("pinboard-api-token") + + @Test + fun testAddPin() { + val poster = PinboardPoster("") + + Assert.assertFalse(poster.addPin(url, desc), "apiToken: ") + + Assert.assertFalse(poster.addPin(url, desc), "apiToken: ") + + //poster.apiToken = "foo:TESTING" + //Assert.assertFalse(poster.addPin(url, desc), "apiToken: ${poster.apiToken}") + + poster.apiToken = apiToken + Assert.assertTrue(poster.addPin(url, desc), "apiToken: $apiToken") + } + + @Test + fun testDeletePin() { + val poster = PinboardPoster(apiToken) + + poster.apiEndPoint = "" + Assert.assertFalse(poster.deletePin(url), "apiEndPoint: ") + + poster.apiEndPoint = Constants.API_ENDPOINT + Assert.assertTrue(poster.deletePin(url), "apiEndPoint: ${Constants.API_ENDPOINT}") + + Assert.assertFalse(poster.deletePin("foo.com"), "url: foo.com") + } +} \ No newline at end of file From 8b2d267b547c6525d4ba04cbe0ed49c94c14cbf4 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Mon, 30 Oct 2017 15:27:50 -0700 Subject: [PATCH 016/224] Update dependencies. --- pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pom.xml b/pom.xml index 6b670b9..58cd66a 100644 --- a/pom.xml +++ b/pom.xml @@ -37,5 +37,11 @@ okhttp 3.9.0 + + org.testng + testng + 6.12 + test + From f41f6c8847d3ec6c0083040c54512eda029d5c37 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Mon, 30 Oct 2017 15:44:44 -0700 Subject: [PATCH 017/224] Fixed typos. --- src/main/java/net/thauvin/erik/pinboard/JavaExample.java | 2 +- src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/thauvin/erik/pinboard/JavaExample.java b/src/main/java/net/thauvin/erik/pinboard/JavaExample.java index d4572dd..214e3ef 100644 --- a/src/main/java/net/thauvin/erik/pinboard/JavaExample.java +++ b/src/main/java/net/thauvin/erik/pinboard/JavaExample.java @@ -36,7 +36,7 @@ public class JavaExample { final String url = "http://www.example.com/pinboard"; final PinboardPoster poster = new PinboardPoster(args[0]); - if (poster.addPin(url, "Testing", "Extended test", "test koltin")) { + if (poster.addPin(url, "Testing", "Extended test", "test kotlin")) { System.out.println("Added: " + url); } diff --git a/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt b/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt index 15c7897..a0d2963 100644 --- a/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt +++ b/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt @@ -210,7 +210,7 @@ fun main(args: Array) { level = Level.FINE } - if (poster.addPin(url, "Testing", "Extended test", "test koltin")) { + if (poster.addPin(url, "Testing", "Extended test", "test kotlin")) { println("Added: $url") } From f2c3cdca73af5b972b77275d08d7ef7775a88eff Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Mon, 30 Oct 2017 15:45:27 -0700 Subject: [PATCH 018/224] Fixed syntax. --- src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt b/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt index a0d2963..b1355ed 100644 --- a/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt +++ b/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt @@ -192,10 +192,10 @@ open class PinboardPoster(var apiToken: String) { } private fun yesNo(bool: Boolean): String { - if (bool) { - return "yes" + return if (bool) { + "yes" } else { - return "no" + "no" } } } From 87c70329d11a835a54d7b5d48b1e5a5b24f4c8a8 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Mon, 30 Oct 2017 15:46:10 -0700 Subject: [PATCH 019/224] Fixed apiToken validation, blank OR not contains ':' --- src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt b/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt index b1355ed..9fef784 100644 --- a/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt +++ b/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt @@ -166,7 +166,7 @@ open class PinboardPoster(var apiToken: String) { } private fun validate(): Boolean { - if (apiToken.isBlank() && !apiToken.contains(':')) { + if (apiToken.isBlank() || !apiToken.contains(':')) { logger.severe("Please specify a valid API token. (eg. user:TOKEN)") return false } else if (!validateUrl(apiEndPoint)) { From 1cfda5f72b59fd64e86d64947b850ed5bcf8177f Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Mon, 30 Oct 2017 15:46:36 -0700 Subject: [PATCH 020/224] Added test for token missing ':' --- .../kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt b/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt index 1514617..8349463 100644 --- a/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt +++ b/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt @@ -48,7 +48,8 @@ class PinboardPosterTest { Assert.assertFalse(poster.addPin(url, desc), "apiToken: ") - Assert.assertFalse(poster.addPin(url, desc), "apiToken: ") + poster.apiToken = "foo" + Assert.assertFalse(poster.addPin(url, desc), "apiToken: ${poster.apiToken}") //poster.apiToken = "foo:TESTING" //Assert.assertFalse(poster.addPin(url, desc), "apiToken: ${poster.apiToken}") From 1d36d78bf404683cc9a82b254968b950b5330f56 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Sat, 4 Nov 2017 00:21:24 -0700 Subject: [PATCH 021/224] Added getting Pinboard API token from (CircleCI) environment variable. --- .circleci/config.yml | 10 ++++++++-- .../erik/pinboard/PinboardPosterTest.kt | 19 +++++++++++++------ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dffffe6..8689e94 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -27,5 +27,11 @@ jobs: key: kobalt-dependencies-{{ checksum "kobalt/src/Build.kt" }} - run: - name: Assemble - command: ./kobaltw assemble \ No newline at end of file + name: Assemble & Test + command: ./kobaltw assemble test + + - store_artifacts: + path: kobaltBuild/test-output/ + destination: test-output + - store_test_results: + path: kobaltBuild/test-output/ diff --git a/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt b/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt index 8349463..37b1581 100644 --- a/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt +++ b/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt @@ -34,15 +34,22 @@ package net.thauvin.erik.pinboard import org.testng.Assert import org.testng.annotations.Test import java.io.FileInputStream -import java.util.* +import java.nio.file.Files +import java.nio.file.Paths +import java.util.Properties class PinboardPosterTest { private val url = "http://www.foo.com/" private val desc = "This is a test." - private val p = Properties().apply { FileInputStream("local.properties").use { fis -> load(fis) } } - private val apiToken = p.getProperty("pinboard-api-token") - - @Test + private val localProps = Paths.get("local.properties") + private val apiToken = if (Files.exists(localProps)) { + val p = Properties().apply { Files.newInputStream(localProps).use { fis -> load(fis) }} + p.getProperty("pinboard-api-token", "") + } else { + System.getenv("PINBOARD_API_TOKEN") + } + + @Test fun testAddPin() { val poster = PinboardPoster("") @@ -70,4 +77,4 @@ class PinboardPosterTest { Assert.assertFalse(poster.deletePin("foo.com"), "url: foo.com") } -} \ No newline at end of file +} From 8dc8b093a450c4e4d30548feb5f734bb6f5bdc89 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Sat, 4 Nov 2017 12:05:47 -0700 Subject: [PATCH 022/224] Added Kobalt test wrapper. --- .gitignore | 1 + kobalt/Build.kt.iml | 18 ++--- pinboard-poster.iml | 170 ++++++++++++++++++++++---------------------- 3 files changed, 95 insertions(+), 94 deletions(-) diff --git a/.gitignore b/.gitignore index 6322c7f..7ad0aa5 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,5 @@ /test-output ehthumbs.db kobaltBuild +kobaltw*-test Thumbs.db \ No newline at end of file diff --git a/kobalt/Build.kt.iml b/kobalt/Build.kt.iml index 430caa3..6a125c7 100644 --- a/kobalt/Build.kt.iml +++ b/kobalt/Build.kt.iml @@ -18,6 +18,15 @@ + + + + + + + + + @@ -29,14 +38,5 @@ - - - - - - - - - \ No newline at end of file diff --git a/pinboard-poster.iml b/pinboard-poster.iml index 20330cb..6ebe439 100644 --- a/pinboard-poster.iml +++ b/pinboard-poster.iml @@ -21,91 +21,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - + @@ -121,9 +40,90 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 2521edba4610c327e5831c7252fbd5e75a3deac5 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Sat, 4 Nov 2017 12:11:27 -0700 Subject: [PATCH 023/224] Reformat. --- .../erik/pinboard/PinboardPosterTest.kt | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt b/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt index 37b1581..255a5d4 100644 --- a/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt +++ b/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt @@ -33,23 +33,22 @@ package net.thauvin.erik.pinboard import org.testng.Assert import org.testng.annotations.Test -import java.io.FileInputStream import java.nio.file.Files import java.nio.file.Paths -import java.util.Properties +import java.util.* class PinboardPosterTest { private val url = "http://www.foo.com/" private val desc = "This is a test." - private val localProps = Paths.get("local.properties") - private val apiToken = if (Files.exists(localProps)) { - val p = Properties().apply { Files.newInputStream(localProps).use { fis -> load(fis) }} - p.getProperty("pinboard-api-token", "") - } else { - System.getenv("PINBOARD_API_TOKEN") - } - - @Test + private val localProps = Paths.get("local.properties") + private val apiToken = if (Files.exists(localProps)) { + val p = Properties().apply { Files.newInputStream(localProps).use { fis -> load(fis) } } + p.getProperty("pinboard-api-token", "") + } else { + System.getenv("PINBOARD_API_TOKEN") + } + + @Test fun testAddPin() { val poster = PinboardPoster("") From 87357f51274d55d394f9d2d77d80b4aae88d0126 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 7 Nov 2017 12:12:42 -0800 Subject: [PATCH 024/224] Added tests to build. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cda7257..4a6654e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,4 +16,4 @@ cache: before_cache: - rm -rf .kobalt/* -script: ./kobaltw clean assemble \ No newline at end of file +script: ./kobaltw clean assemble test \ No newline at end of file From e857d3d3aacc08cc213b5ce9c81463a6fef10f68 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 8 Nov 2017 01:03:22 -0800 Subject: [PATCH 025/224] Added retrieving API token from a local property or environment variable. --- README.md | 42 ++++++++++++- kobalt/src/Build.kt | 13 +--- .../thauvin/erik/pinboard/JavaExample.java | 39 +++++++++++- .../thauvin/erik/pinboard/PinboardPoster.kt | 62 ++++++++++++++----- .../erik/pinboard/PinboardPosterTest.kt | 22 ++++--- 5 files changed, 139 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 262bc60..8b753a1 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ poster.addPin("http://www.example.com/foo", "This is a test") poster.deletePin("http:///www.example.com/bar") ``` -[View Example](https://github.com/ethauvin/pinboard-poster/blob/master/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt#L203) +[View Example](https://github.com/ethauvin/pinboard-poster/blob/master/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt#L219) ### Java ```java @@ -116,6 +116,46 @@ logger.setLevel(Level.FINE); or using a logging properties file. +## API Authentication Token + +The token can also be located in a [properties file](https://en.wikipedia.org/wiki/.properties) or environment variable. + +### Local Property + +For example, using the default `PINBOARD_API_TOKEN` key value from a `local.properties` file: + +```ini +# local.properties +PINBOARD_API_TOKEN=user\:TOKEN +``` + +```kotlin +val poster = PinboardPoster(Paths.get("local.properties")) +``` + +To specify your own key: + +```ini +# my.properties +my.api.key=user\:TOKEN +``` + +```kotlin +val poster = PinboardPoster(Paths.get("my.properties"), "my.api.key") +``` + +### Environment Variable + +If no arguments are passed to the constructor, the `PINBOARD_API_TOKEN` environment variable will be used, if any. + +```sh +export PINBOARD_API_TOKEN="user:TOKEN" +``` + +```kotlin +val poster = PinboardPoster() +``` + ## API End Point The API end point is automatically configured to `https://api.pinboard.in/v1/`. Since Pinboard uses the `del.ico.us` API, the library could potentially be used with another compatible service. To configure the API end point, use: diff --git a/kobalt/src/Build.kt b/kobalt/src/Build.kt index d030b58..03e6f1d 100644 --- a/kobalt/src/Build.kt +++ b/kobalt/src/Build.kt @@ -11,9 +11,6 @@ import org.apache.maven.model.Developer import org.apache.maven.model.License import org.apache.maven.model.Model import org.apache.maven.model.Scm -import java.io.File -import java.io.FileInputStream -import java.util.* val bs = buildScript { plugins("net.thauvin.erik:kobalt-versioneye:", "net.thauvin.erik:kobalt-maven-local:") @@ -26,12 +23,6 @@ val p = project { artifactId = name version = "0.9.2" - val localProperties = Properties().apply { - val f = "local.properties" - if (File(f).exists()) FileInputStream(f).use { fis -> load(fis) } - } - val apiToken = localProperties.getProperty("pinboard-api-token", "") - pom = Model().apply { description = project.description url = "https://github.com/ethauvin/pinboard-poster" @@ -67,13 +58,13 @@ val p = project { application { mainClass = "net.thauvin.erik.pinboard.PinboardPosterKt" - args(apiToken) + ignoreErrorStream = true } application { taskName = "runJava" mainClass = "net.thauvin.erik.pinboard.JavaExample" - args(apiToken) + ignoreErrorStream = true } install { diff --git a/src/main/java/net/thauvin/erik/pinboard/JavaExample.java b/src/main/java/net/thauvin/erik/pinboard/JavaExample.java index 214e3ef..d5b4ff4 100644 --- a/src/main/java/net/thauvin/erik/pinboard/JavaExample.java +++ b/src/main/java/net/thauvin/erik/pinboard/JavaExample.java @@ -31,15 +31,52 @@ */ package net.thauvin.erik.pinboard; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Properties; +import java.util.logging.ConsoleHandler; +import java.util.logging.Level; +import java.util.logging.Logger; + public class JavaExample { public static void main(String[] args) { final String url = "http://www.example.com/pinboard"; - final PinboardPoster poster = new PinboardPoster(args[0]); + final Path properties = Paths.get("local.properties"); + final PinboardPoster poster; + if (args.length == 1) { + // API Token is an argument + poster = new PinboardPoster(args[0]); + } else if (Files.exists(properties)) { + // API Token is in local.properties (PINBOARD_API_TOKEN) + final Properties p = new Properties(); + try (final InputStream stream = Files.newInputStream(properties)) { + p.load(stream); + } catch (IOException ignore) { + ; + } + poster = new PinboardPoster(p); + } else { + // API Token is an environment variable (PINBOARD_API_TOKEN) or empty + poster = new PinboardPoster(); + } + + // Set logging levels + final ConsoleHandler consoleHandler = new ConsoleHandler(); + consoleHandler.setLevel(Level.FINE); + final Logger logger = poster.getLogger(); + logger.addHandler(consoleHandler); + logger.setLevel(Level.FINE); + + // Add Pin if (poster.addPin(url, "Testing", "Extended test", "test kotlin")) { System.out.println("Added: " + url); } + // Delete Pin if (poster.deletePin(url)) { System.out.println("Deleted: " + url); } diff --git a/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt b/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt index 9fef784..191c796 100644 --- a/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt +++ b/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt @@ -31,12 +31,16 @@ */ package net.thauvin.erik.pinboard +import net.thauvin.erik.pinboard.Constants.ENV_API_TOKEN import okhttp3.HttpUrl import okhttp3.OkHttpClient import okhttp3.Request import org.xml.sax.InputSource import java.io.StringReader import java.net.URL +import java.nio.file.Files +import java.nio.file.Paths +import java.util.* import java.util.logging.ConsoleHandler import java.util.logging.Level import java.util.logging.Logger @@ -46,9 +50,21 @@ object Constants { const val API_ENDPOINT = "https://api.pinboard.in/v1/" const val AUTH_TOKEN = "auth_token" const val DONE = "done" + const val ENV_API_TOKEN = "PINBOARD_API_TOKEN" } -open class PinboardPoster(var apiToken: String) { +open class PinboardPoster() { + constructor(apiToken: String) : this() { + this.apiToken = apiToken + } + + @JvmOverloads + constructor(properties: Properties, key: String = ENV_API_TOKEN) : this() { + this.apiToken = properties.getProperty(key, "") + } + + var apiToken: String = if (System.getenv(ENV_API_TOKEN).isNullOrBlank()) "" else System.getenv(ENV_API_TOKEN) + var apiEndPoint: String = Constants.API_ENDPOINT val logger: Logger by lazy { Logger.getLogger(PinboardPoster::class.java.simpleName) } @@ -201,23 +217,37 @@ open class PinboardPoster(var apiToken: String) { } fun main(args: Array) { - if (args.size == 1) { - val url = "http://www.example.com/pinboard" - val poster = PinboardPoster(args[0]) + val url = "http://www.example.com/pinboard" + val properties = Paths.get("local.properties") + val poster = when { + args.size == 1 -> + // API Token is an argument + PinboardPoster(args[0]) + Files.exists(properties) -> + // API Token is in a local.properties (PINBOARD_API_TOKEN) + PinboardPoster( + Properties().apply { + Files.newInputStream(properties).use { fis -> load(fis) } + }.getProperty(ENV_API_TOKEN, "") + ) + else -> + // API Token is an environment variable (PINBOARD_API_TOKEN) or empty; + PinboardPoster() + } - with(poster.logger) { - addHandler(ConsoleHandler().apply { level = Level.FINE }) - level = Level.FINE - } + // Set logging levels + with(poster.logger) { + addHandler(ConsoleHandler().apply { level = Level.FINE }) + level = Level.FINE + } - if (poster.addPin(url, "Testing", "Extended test", "test kotlin")) { - println("Added: $url") - } + // Add Pin + if (poster.addPin(url, "Testing", "Extended test", "test kotlin")) { + println("Added: $url") + } - if (poster.deletePin(url)) { - println("Deleted: $url") - } - } else { - println("Please specify a valid API token. (eg. user:TOKEN)") + // Delete Pin + if (poster.deletePin(url)) { + println("Deleted: $url") } } \ No newline at end of file diff --git a/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt b/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt index 255a5d4..bfd72e8 100644 --- a/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt +++ b/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt @@ -41,16 +41,10 @@ class PinboardPosterTest { private val url = "http://www.foo.com/" private val desc = "This is a test." private val localProps = Paths.get("local.properties") - private val apiToken = if (Files.exists(localProps)) { - val p = Properties().apply { Files.newInputStream(localProps).use { fis -> load(fis) } } - p.getProperty("pinboard-api-token", "") - } else { - System.getenv("PINBOARD_API_TOKEN") - } @Test fun testAddPin() { - val poster = PinboardPoster("") + var poster = PinboardPoster("") Assert.assertFalse(poster.addPin(url, desc), "apiToken: ") @@ -60,13 +54,13 @@ class PinboardPosterTest { //poster.apiToken = "foo:TESTING" //Assert.assertFalse(poster.addPin(url, desc), "apiToken: ${poster.apiToken}") - poster.apiToken = apiToken - Assert.assertTrue(poster.addPin(url, desc), "apiToken: $apiToken") + poster = pinboardPosterInstance() + Assert.assertTrue(poster.addPin(url, desc), "apiToken: ${Constants.ENV_API_TOKEN}") } @Test fun testDeletePin() { - val poster = PinboardPoster(apiToken) + val poster = pinboardPosterInstance() poster.apiEndPoint = "" Assert.assertFalse(poster.deletePin(url), "apiEndPoint: ") @@ -76,4 +70,12 @@ class PinboardPosterTest { Assert.assertFalse(poster.deletePin("foo.com"), "url: foo.com") } + + private fun pinboardPosterInstance(): PinboardPoster { + return if (Files.exists(localProps)) { + PinboardPoster(Properties().apply { Files.newInputStream(localProps).use { fis -> load(fis) } }) + } else { + PinboardPoster() + } + } } From 5317ea26151710fe423cbf8db63f3d8c5d9d16aa Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 8 Nov 2017 10:55:50 -0800 Subject: [PATCH 026/224] Kobalt update to 1.0.91. --- kobalt/wrapper/kobalt-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties index 21b1f73..be1be45 100644 --- a/kobalt/wrapper/kobalt-wrapper.properties +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=1.0.90 \ No newline at end of file +kobalt.version=1.0.91 \ No newline at end of file From 7826fbb2e5e78125997468a0d627986be98b9d6f Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 8 Nov 2017 11:37:58 -0800 Subject: [PATCH 027/224] Version update. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8b753a1..ec04161 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ To install and run from Maven, configure an artifact as follows: net.thauvin.erik pinboard-poster - 0.9.1 + 0.9.2 ``` @@ -51,7 +51,7 @@ To install and run from Gradle, add the following to the build.gradle file: ```gradle dependencies { - compile 'net.thauvin.erik:pinboard-poster:0.9.1' + compile 'net.thauvin.erik:pinboard-poster:0.9.2' } ``` @@ -61,7 +61,7 @@ To install and run from Kobalt, add the following to the Build.kt file: ```gradle dependencies { - compile("net.thauvin.erik:pinboard-poster:0.9.1") + compile("net.thauvin.erik:pinboard-poster:0.9.2") } ``` From f74ebf3d0c21d6b18a1679d932614630c2c64e18 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 8 Nov 2017 17:47:56 -0800 Subject: [PATCH 028/224] Added license. --- LICENSE.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..15db583 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,32 @@ +Software License Agreement (BSD License) +---------------------------------------- + +Copyright (c) 2017, Erik C. Thauvin (erik@thauvin.net)\ +All rights reserved. + + +Redistribution and use of this software in source and binary forms, with or +without modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of this project nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission. + +_This software is provided by the copyright holders and contributors "as is" +and any express or implied warranties, including, but not limited to, the +implied warranties of merchantability and fitness for a particular purpose are +disclaimed. In no event shall the copyright owner or contributors be liable for +any direct, indirect, incidental, special, exemplary, or consequential damages +(including, but not limited to, procurement of substitute goods or services; +loss of use, data, or profits; or business interruption) however caused and on +any theory of liability, whether in contract, strict liability, or tort +(including negligence or otherwise) arising in any way out of the use of this +software, even if advised of the possibility of such damage._ \ No newline at end of file From 169bab65f9c5b80331ff578ed07c81df747aae93 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 8 Nov 2017 17:52:36 -0800 Subject: [PATCH 029/224] Renamed. --- LICENCE.txt | 27 +++++++++++++++++++++++++++ LICENSE.md | 32 -------------------------------- 2 files changed, 27 insertions(+), 32 deletions(-) create mode 100644 LICENCE.txt delete mode 100644 LICENSE.md diff --git a/LICENCE.txt b/LICENCE.txt new file mode 100644 index 0000000..861c1ef --- /dev/null +++ b/LICENCE.txt @@ -0,0 +1,27 @@ +Copyright (c) 2017, Erik C. Thauvin (erik@thauvin.net) +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of this project nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index 15db583..0000000 --- a/LICENSE.md +++ /dev/null @@ -1,32 +0,0 @@ -Software License Agreement (BSD License) ----------------------------------------- - -Copyright (c) 2017, Erik C. Thauvin (erik@thauvin.net)\ -All rights reserved. - - -Redistribution and use of this software in source and binary forms, with or -without modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -* Neither the name of this project nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -_This software is provided by the copyright holders and contributors "as is" -and any express or implied warranties, including, but not limited to, the -implied warranties of merchantability and fitness for a particular purpose are -disclaimed. In no event shall the copyright owner or contributors be liable for -any direct, indirect, incidental, special, exemplary, or consequential damages -(including, but not limited to, procurement of substitute goods or services; -loss of use, data, or profits; or business interruption) however caused and on -any theory of liability, whether in contract, strict liability, or tort -(including negligence or otherwise) arising in any way out of the use of this -software, even if advised of the possibility of such damage._ \ No newline at end of file From 7c7c33b716724d3f674b2b9a76e2e4725fbaa852 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 8 Nov 2017 20:04:02 -0800 Subject: [PATCH 030/224] Fixed local property syntax. --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ec04161..0974365 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,11 @@ PINBOARD_API_TOKEN=user\:TOKEN ``` ```kotlin -val poster = PinboardPoster(Paths.get("local.properties")) +val properties = Properties().apply { + Files.newInputStream(Paths.get("local.properties")).use { fis -> load(fis) } +} + +val poster = PinboardPoster(properties) ``` To specify your own key: @@ -141,7 +145,8 @@ my.api.key=user\:TOKEN ``` ```kotlin -val poster = PinboardPoster(Paths.get("my.properties"), "my.api.key") +val properties = Properties().apply { FileInputStream("my.properties").use { fis -> load(fis) } } +val poster = PinboardPoster(properties, "my.api.key") ``` ### Environment Variable From 95428c22f8656d106387e5c88942a88c114d33c5 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 8 Nov 2017 20:10:48 -0800 Subject: [PATCH 031/224] Fixed example. --- src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt b/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt index 191c796..44b6fd3 100644 --- a/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt +++ b/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt @@ -228,7 +228,7 @@ fun main(args: Array) { PinboardPoster( Properties().apply { Files.newInputStream(properties).use { fis -> load(fis) } - }.getProperty(ENV_API_TOKEN, "") + } ) else -> // API Token is an environment variable (PINBOARD_API_TOKEN) or empty; From b4d411726f62896f37494923cd92b12d75d678e9 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 8 Nov 2017 22:09:20 -0800 Subject: [PATCH 032/224] Added constructor to specify a property file path directly. --- .../thauvin/erik/pinboard/JavaExample.java | 21 ++-------- .../thauvin/erik/pinboard/PinboardPoster.kt | 38 +++++++++++-------- .../erik/pinboard/PinboardPosterTest.kt | 14 +------ 3 files changed, 28 insertions(+), 45 deletions(-) diff --git a/src/main/java/net/thauvin/erik/pinboard/JavaExample.java b/src/main/java/net/thauvin/erik/pinboard/JavaExample.java index d5b4ff4..d252652 100644 --- a/src/main/java/net/thauvin/erik/pinboard/JavaExample.java +++ b/src/main/java/net/thauvin/erik/pinboard/JavaExample.java @@ -31,12 +31,8 @@ */ package net.thauvin.erik.pinboard; -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.Properties; import java.util.logging.ConsoleHandler; import java.util.logging.Level; import java.util.logging.Logger; @@ -44,24 +40,15 @@ import java.util.logging.Logger; public class JavaExample { public static void main(String[] args) { final String url = "http://www.example.com/pinboard"; - final Path properties = Paths.get("local.properties"); + final Path localProps = Paths.get("local.properties"); final PinboardPoster poster; if (args.length == 1) { // API Token is an argument poster = new PinboardPoster(args[0]); - } else if (Files.exists(properties)) { - // API Token is in local.properties (PINBOARD_API_TOKEN) - final Properties p = new Properties(); - try (final InputStream stream = Files.newInputStream(properties)) { - p.load(stream); - } catch (IOException ignore) { - ; - } - poster = new PinboardPoster(p); } else { - // API Token is an environment variable (PINBOARD_API_TOKEN) or empty - poster = new PinboardPoster(); + // API Token is in local.properties or PINBOARD_API_TOKEN environment variable + poster = new PinboardPoster(localProps); } // Set logging levels @@ -72,7 +59,7 @@ public class JavaExample { logger.setLevel(Level.FINE); // Add Pin - if (poster.addPin(url, "Testing", "Extended test", "test kotlin")) { + if (poster.addPin(url, "Testing", "Extended test", "test java")) { System.out.println("Added: " + url); } diff --git a/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt b/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt index 44b6fd3..495a11d 100644 --- a/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt +++ b/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt @@ -39,6 +39,7 @@ import org.xml.sax.InputSource import java.io.StringReader import java.net.URL import java.nio.file.Files +import java.nio.file.Path import java.nio.file.Paths import java.util.* import java.util.logging.ConsoleHandler @@ -58,9 +59,21 @@ open class PinboardPoster() { this.apiToken = apiToken } + @Suppress("unused") @JvmOverloads constructor(properties: Properties, key: String = ENV_API_TOKEN) : this() { - this.apiToken = properties.getProperty(key, "") + apiToken = properties.getProperty(key, apiToken) + } + + @JvmOverloads + constructor(propertiesFilePath: Path, key: String = ENV_API_TOKEN) : this() { + if (Files.exists(propertiesFilePath)) { + apiToken = Properties().apply { + Files.newInputStream(propertiesFilePath).use { nis -> + load(nis) + } + }.getProperty(key, apiToken) + } } var apiToken: String = if (System.getenv(ENV_API_TOKEN).isNullOrBlank()) "" else System.getenv(ENV_API_TOKEN) @@ -218,21 +231,14 @@ open class PinboardPoster() { fun main(args: Array) { val url = "http://www.example.com/pinboard" - val properties = Paths.get("local.properties") - val poster = when { - args.size == 1 -> - // API Token is an argument - PinboardPoster(args[0]) - Files.exists(properties) -> - // API Token is in a local.properties (PINBOARD_API_TOKEN) - PinboardPoster( - Properties().apply { - Files.newInputStream(properties).use { fis -> load(fis) } - } - ) - else -> - // API Token is an environment variable (PINBOARD_API_TOKEN) or empty; - PinboardPoster() + val localProp = Paths.get("local.properties") + + val poster = if (args.size == 1) { + // API Token is an argument + PinboardPoster(args[0]) + } else { + // API Token is in local.properties or PINBOARD_API_TOKEN environment variable + PinboardPoster(localProp) } // Set logging levels diff --git a/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt b/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt index bfd72e8..06cf351 100644 --- a/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt +++ b/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt @@ -33,9 +33,7 @@ package net.thauvin.erik.pinboard import org.testng.Assert import org.testng.annotations.Test -import java.nio.file.Files import java.nio.file.Paths -import java.util.* class PinboardPosterTest { private val url = "http://www.foo.com/" @@ -54,13 +52,13 @@ class PinboardPosterTest { //poster.apiToken = "foo:TESTING" //Assert.assertFalse(poster.addPin(url, desc), "apiToken: ${poster.apiToken}") - poster = pinboardPosterInstance() + poster = PinboardPoster(localProps) Assert.assertTrue(poster.addPin(url, desc), "apiToken: ${Constants.ENV_API_TOKEN}") } @Test fun testDeletePin() { - val poster = pinboardPosterInstance() + val poster = PinboardPoster(localProps) poster.apiEndPoint = "" Assert.assertFalse(poster.deletePin(url), "apiEndPoint: ") @@ -70,12 +68,4 @@ class PinboardPosterTest { Assert.assertFalse(poster.deletePin("foo.com"), "url: foo.com") } - - private fun pinboardPosterInstance(): PinboardPoster { - return if (Files.exists(localProps)) { - PinboardPoster(Properties().apply { Files.newInputStream(localProps).use { fis -> load(fis) } }) - } else { - PinboardPoster() - } - } } From 7cc91b52f1a2a07f109862437e299108ba0ce55f Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 8 Nov 2017 22:10:06 -0800 Subject: [PATCH 033/224] Kobalt wrapper update. --- .idea/kobalt.xml | 2 +- kobalt/Build.kt.iml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.idea/kobalt.xml b/.idea/kobalt.xml index 7f1760d..3e8b0d0 100644 --- a/.idea/kobalt.xml +++ b/.idea/kobalt.xml @@ -6,7 +6,7 @@ - + - + - + From 292e313b44759f70e10296c86b3bd105d2f0ca8f Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 8 Nov 2017 22:30:04 -0800 Subject: [PATCH 034/224] Version 0.9.3 --- README.md | 30 ++++++++++++++++++------------ kobalt/src/Build.kt | 2 +- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 0974365..9a9a920 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ To install and run from Maven, configure an artifact as follows: net.thauvin.erik pinboard-poster - 0.9.2 + 0.9.3 ``` @@ -51,7 +51,7 @@ To install and run from Gradle, add the following to the build.gradle file: ```gradle dependencies { - compile 'net.thauvin.erik:pinboard-poster:0.9.2' + compile 'net.thauvin.erik:pinboard-poster:0.9.3' } ``` @@ -61,7 +61,7 @@ To install and run from Kobalt, add the following to the Build.kt file: ```gradle dependencies { - compile("net.thauvin.erik:pinboard-poster:0.9.2") + compile("net.thauvin.erik:pinboard-poster:0.9.3") } ``` @@ -130,14 +130,10 @@ PINBOARD_API_TOKEN=user\:TOKEN ``` ```kotlin -val properties = Properties().apply { - Files.newInputStream(Paths.get("local.properties")).use { fis -> load(fis) } -} - -val poster = PinboardPoster(properties) +val poster = PinboardPoster(Paths.get("local.properties")) ``` -To specify your own key: +or by specifying your own key: ```ini # my.properties @@ -145,13 +141,23 @@ my.api.key=user\:TOKEN ``` ```kotlin -val properties = Properties().apply { FileInputStream("my.properties").use { fis -> load(fis) } } -val poster = PinboardPoster(properties, "my.api.key") +val poster = PinboardPoster(Paths.get("my.properties"), "my.api.key") ``` +or even specifying your own property: + +```kotlin +val p = Properties() +p.setProperty("api.key", "user:TOKEN") + +val poster = PinboardPoster(p, "api.key") +``` + +_In all cases, the value of the `PINBOARD_API_TOKEN` environment variable is used by default if the specified property is invalid or not found._ + ### Environment Variable -If no arguments are passed to the constructor, the `PINBOARD_API_TOKEN` environment variable will be used, if any. +If no arguments are passed to the constructor, the value of the `PINBOARD_API_TOKEN` environment variable will be used, if any. ```sh export PINBOARD_API_TOKEN="user:TOKEN" diff --git a/kobalt/src/Build.kt b/kobalt/src/Build.kt index 03e6f1d..0439817 100644 --- a/kobalt/src/Build.kt +++ b/kobalt/src/Build.kt @@ -21,7 +21,7 @@ val p = project { group = "net.thauvin.erik" description = "Pinboard Poster for Kotlin/Java" artifactId = name - version = "0.9.2" + version = "0.9.3" pom = Model().apply { description = project.description From dedb3a4ad4d775104e04278cbc95e91fc3ce22f8 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 8 Nov 2017 23:04:20 -0800 Subject: [PATCH 035/224] Fixed examples links. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9a9a920..3692d75 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ poster.addPin("http://www.example.com/foo", "This is a test") poster.deletePin("http:///www.example.com/bar") ``` -[View Example](https://github.com/ethauvin/pinboard-poster/blob/master/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt#L219) +[View Example](https://github.com/ethauvin/pinboard-poster/blob/master/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt#L232) ### Java ```java @@ -27,7 +27,7 @@ final PinboardPoster poster = new PinBboardPoster("user:TOKEN"); poster.addPin("http://www.example.com/foo", "This is a test"); poster.deletePin("http:///www.example.com/bar"); ``` -[View Example](https://github.com/ethauvin/pinboard-poster/blob/master/src/main/java/net/thauvin/erik/pinboard/JavaExample.java) +[View Example](https://github.com/ethauvin/pinboard-poster/blob/master/src/main/java/net/thauvin/erik/pinboard/JavaExample.java#L40) Your API authentication token is available on the [Pinboard settings page](https://pinboard.in/settings/password). From 96695c8bfdebf746c27a9b5b8ea7a0cef101a80c Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 16 Jan 2018 14:31:06 -0800 Subject: [PATCH 036/224] Updated copyright. --- .idea/copyright/Erik_s_Copyright_Notice.xml | 3 +-- LICENCE.txt | 2 +- src/main/java/net/thauvin/erik/pinboard/JavaExample.java | 2 +- .../kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt | 7 ++++++- .../kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.idea/copyright/Erik_s_Copyright_Notice.xml b/.idea/copyright/Erik_s_Copyright_Notice.xml index 08660a1..e000a9b 100644 --- a/.idea/copyright/Erik_s_Copyright_Notice.xml +++ b/.idea/copyright/Erik_s_Copyright_Notice.xml @@ -1,6 +1,5 @@ - \ No newline at end of file diff --git a/LICENCE.txt b/LICENCE.txt index 861c1ef..8bbc8da 100644 --- a/LICENCE.txt +++ b/LICENCE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2017, Erik C. Thauvin (erik@thauvin.net) +Copyright (c) 2017-2018, Erik C. Thauvin (erik@thauvin.net) All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/src/main/java/net/thauvin/erik/pinboard/JavaExample.java b/src/main/java/net/thauvin/erik/pinboard/JavaExample.java index d252652..6f609a6 100644 --- a/src/main/java/net/thauvin/erik/pinboard/JavaExample.java +++ b/src/main/java/net/thauvin/erik/pinboard/JavaExample.java @@ -1,7 +1,7 @@ /* * JavaExample.java * - * Copyright (c) 2017, Erik C. Thauvin (erik@thauvin.net) + * Copyright (c) 2017-2018, Erik C. Thauvin (erik@thauvin.net) * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt b/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt index 495a11d..7f6d8d5 100644 --- a/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt +++ b/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt @@ -1,7 +1,7 @@ /* * PinboardPoster.kt * - * Copyright (c) 2017, Erik C. Thauvin (erik@thauvin.net) + * Copyright (c) 2017-2018, Erik C. Thauvin (erik@thauvin.net) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,6 +36,7 @@ import okhttp3.HttpUrl import okhttp3.OkHttpClient import okhttp3.Request import org.xml.sax.InputSource +import java.io.File import java.io.StringReader import java.net.URL import java.nio.file.Files @@ -76,6 +77,10 @@ open class PinboardPoster() { } } + @Suppress("unused") + @JvmOverloads + constructor(propertyFile: File, key: String = ENV_API_TOKEN) : this(propertyFile.toPath(), key) + var apiToken: String = if (System.getenv(ENV_API_TOKEN).isNullOrBlank()) "" else System.getenv(ENV_API_TOKEN) var apiEndPoint: String = Constants.API_ENDPOINT diff --git a/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt b/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt index 06cf351..83c417e 100644 --- a/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt +++ b/src/test/kotlin/net/thauvin/erik/pinboard/PinboardPosterTest.kt @@ -1,7 +1,7 @@ /* * PinboardPosterTest.kt * - * Copyright (c) 2017, Erik C. Thauvin (erik@thauvin.net) + * Copyright (c) 2017-2018, Erik C. Thauvin (erik@thauvin.net) * All rights reserved. * * Redistribution and use in source and binary forms, with or without From 961167daeecdae6bdb77c9692ca085c7b9a903f9 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 16 Jan 2018 14:32:39 -0800 Subject: [PATCH 037/224] Moved to Gemasium since VersionEye is shutting down. --- README.md | 2 +- kobalt/src/Build.kt | 16 +++++++--------- pom.xml | 6 +++--- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 3692d75..06133ce 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # [Pinboard](https://pinboard.in) Poster for Kotlin/Java [![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](http://opensource.org/licenses/BSD-3-Clause) [![release](http://github-release-version.herokuapp.com/github/ethauvin/pinboard-poster/release.svg?style=flat)](https://github.com/ethauvin/pinboard-poster/releases/latest) [![Download](https://api.bintray.com/packages/ethauvin/maven/pinboard-poster/images/download.svg)](https://bintray.com/ethauvin/maven/pinboard-poster/_latestVersion) -[![Dependency Status](https://www.versioneye.com/user/projects/591c0293b81f680038a784b3/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/591c0293b81f680038a784b3) [![Build Status](https://travis-ci.org/ethauvin/pinboard-poster.svg?branch=master)](https://travis-ci.org/ethauvin/pinboard-poster) [![CircleCI](https://circleci.com/gh/ethauvin/pinboard-poster/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/pinboard-poster/tree/master) +[![Dependency Status](https://beta.gemnasium.com/badges/github.com/ethauvin/pinboard-poster.svg)](https://beta.gemnasium.com/projects/github.com/ethauvin/pinboard-poster) [![Build Status](https://travis-ci.org/ethauvin/pinboard-poster.svg?branch=master)](https://travis-ci.org/ethauvin/pinboard-poster) [![CircleCI](https://circleci.com/gh/ethauvin/pinboard-poster/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/pinboard-poster/tree/master) A small Kotlin/Java library for posting to [Pinboard](https://pinboard.in). diff --git a/kobalt/src/Build.kt b/kobalt/src/Build.kt index 0439817..5412ae9 100644 --- a/kobalt/src/Build.kt +++ b/kobalt/src/Build.kt @@ -6,14 +6,14 @@ import com.beust.kobalt.plugin.packaging.install import com.beust.kobalt.plugin.publish.autoGitTag import com.beust.kobalt.plugin.publish.bintray import com.beust.kobalt.project -import net.thauvin.erik.kobalt.plugin.versioneye.versionEye +import net.thauvin.erik.kobalt.plugin.pom2xml.pom2xml import org.apache.maven.model.Developer import org.apache.maven.model.License import org.apache.maven.model.Model import org.apache.maven.model.Scm val bs = buildScript { - plugins("net.thauvin.erik:kobalt-versioneye:", "net.thauvin.erik:kobalt-maven-local:") + plugins("net.thauvin.erik:kobalt-pom2xml:", "net.thauvin.erik:kobalt-maven-local:") } val p = project { @@ -43,8 +43,8 @@ val p = project { } dependencies { - compile("org.jetbrains.kotlin:kotlin-stdlib:1.1.51") - compile("com.squareup.okhttp3:okhttp:3.9.0") + compile("org.jetbrains.kotlin:kotlin-stdlib:1.2.10") + compile("com.squareup.okhttp3:okhttp:3.9.1") } dependenciesTest { @@ -89,9 +89,7 @@ val p = project { sign = true } - versionEye { - org = "Thauvin" - team = "Owners" - pom = true + pom2xml { + } -} +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 58cd66a..155261c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 net.thauvin.erik pinboard-poster - 0.9.2 + 0.9.3 pinboard-poster Pinboard Poster for Kotlin/Java https://github.com/ethauvin/pinboard-poster @@ -30,12 +30,12 @@ org.jetbrains.kotlin kotlin-stdlib - 1.1.51 + 1.2.10 com.squareup.okhttp3 okhttp - 3.9.0 + 3.9.1 org.testng From d6b5b2c931c686bafcd6fe09a9a3d14ff12b1449 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 16 Jan 2018 14:33:13 -0800 Subject: [PATCH 038/224] Kobalt 1.0.100 update. --- .idea/kobalt.xml | 2 +- .idea/kotlinc.xml | 7 +++++ kobalt/Build.kt.iml | 24 ++++++++-------- kobalt/wrapper/kobalt-wrapper.properties | 2 +- pinboard-poster.iml | 36 ++++++++++++------------ 5 files changed, 39 insertions(+), 32 deletions(-) create mode 100644 .idea/kotlinc.xml diff --git a/.idea/kobalt.xml b/.idea/kobalt.xml index 3e8b0d0..92b669e 100644 --- a/.idea/kobalt.xml +++ b/.idea/kobalt.xml @@ -6,7 +6,7 @@ + + org.jetbrains.kotlin + kotlin-stdlib-common + 1.9.21 + compile + + + org.jetbrains.kotlin + kotlin-stdlib-jdk7 + 1.9.21 + compile + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + 1.9.21 + compile + com.squareup.okhttp3 okhttp diff --git a/src/bld/java/net/thauvin/erik/pinboard/PinboardPosterBuild.java b/src/bld/java/net/thauvin/erik/pinboard/PinboardPosterBuild.java index f30b68f..91100d8 100644 --- a/src/bld/java/net/thauvin/erik/pinboard/PinboardPosterBuild.java +++ b/src/bld/java/net/thauvin/erik/pinboard/PinboardPosterBuild.java @@ -34,6 +34,7 @@ package net.thauvin.erik.pinboard; import rife.bld.BuildCommand; import rife.bld.Project; import rife.bld.extension.CompileKotlinOperation; +import rife.bld.extension.DetektOperation; import rife.bld.extension.JacocoReportOperation; import rife.bld.extension.dokka.DokkaOperation; import rife.bld.extension.dokka.LoggingLevel; @@ -66,9 +67,13 @@ public class PinboardPosterBuild extends Project { autoDownloadPurge = true; repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL); - var okHttp = version(4, 12, 0); + final var okHttp = version(4, 12, 0); + final var kotlin = version(1, 9, 21); scope(compile) - .include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", version(1, 9, 21))) + .include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin)) + .include(dependency("org.jetbrains.kotlin", "kotlin-stdlib-common", kotlin)) + .include(dependency("org.jetbrains.kotlin", "kotlin-stdlib-jdk7", kotlin)) + .include(dependency("org.jetbrains.kotlin", "kotlin-stdlib-jdk8", kotlin)) .include(dependency("com.squareup.okhttp3", "okhttp", okHttp)) .include(dependency("com.squareup.okhttp3", "logging-interceptor", okHttp)); scope(test) @@ -122,6 +127,23 @@ public class PinboardPosterBuild extends Project { .execute(); } + @BuildCommand(summary = "Checks source with Detekt") + public void detekt() throws ExitStatusException, IOException, InterruptedException { + new DetektOperation() + .fromProject(this) + .baseline("config/detekt/baseline.xml") + .execute(); + } + + @BuildCommand(value = "detekt-baseline", summary = "Creates the Detekt baseline") + public void detektBaseline() throws ExitStatusException, IOException, InterruptedException { + new DetektOperation() + .fromProject(this) + .baseline("config/detekt/baseline.xml") + .createBaseline(true) + .execute(); + } + @BuildCommand(summary = "Generates JaCoCo Reports") public void jacoco() throws IOException { new JacocoReportOperation() From e7a6b3481c38d01cd6d504d49fb46b2625963fbd Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Sun, 26 Nov 2023 00:29:39 -0800 Subject: [PATCH 182/224] Version 1.1.1 --- .../java/net/thauvin/erik/pinboard/samples/ExampleBuild.java | 2 +- examples/gradle/java/build.gradle | 2 +- examples/gradle/kotlin/build.gradle.kts | 2 +- pom.xml | 2 +- src/bld/java/net/thauvin/erik/pinboard/PinboardPosterBuild.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/bld/src/bld/java/net/thauvin/erik/pinboard/samples/ExampleBuild.java b/examples/bld/src/bld/java/net/thauvin/erik/pinboard/samples/ExampleBuild.java index cebc20c..6f1eab6 100644 --- a/examples/bld/src/bld/java/net/thauvin/erik/pinboard/samples/ExampleBuild.java +++ b/examples/bld/src/bld/java/net/thauvin/erik/pinboard/samples/ExampleBuild.java @@ -25,7 +25,7 @@ public class ExampleBuild extends BaseProject { repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, SONATYPE_SNAPSHOTS_LEGACY); scope(compile) - .include(dependency("net.thauvin.erik", "pinboard-poster", version(1, 1, 1, "SNAPSHOT"))); + .include(dependency("net.thauvin.erik", "pinboard-poster", version(1, 1, 1))); } public static void main(String[] args) { diff --git a/examples/gradle/java/build.gradle b/examples/gradle/java/build.gradle index 3cf126d..a9a4334 100644 --- a/examples/gradle/java/build.gradle +++ b/examples/gradle/java/build.gradle @@ -19,5 +19,5 @@ repositories { } dependencies { - implementation 'net.thauvin.erik:pinboard-poster:1.1.1-SNAPSHOT' + implementation 'net.thauvin.erik:pinboard-poster:1.1.1' } diff --git a/examples/gradle/kotlin/build.gradle.kts b/examples/gradle/kotlin/build.gradle.kts index 151e355..4359cba 100644 --- a/examples/gradle/kotlin/build.gradle.kts +++ b/examples/gradle/kotlin/build.gradle.kts @@ -14,7 +14,7 @@ repositories { } dependencies { - implementation("net.thauvin.erik:pinboard-poster:1.1.1-SNAPSHOT") + implementation("net.thauvin.erik:pinboard-poster:1.1.1") } java { diff --git a/pom.xml b/pom.xml index c36e607..666cbb6 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 net.thauvin.erik pinboard-poster - 1.1.1-SNAPSHOT + 1.1.1 pinboard-poster A small library for posting to Pinboard https://github.com/ethauvin/pinboard-poster diff --git a/src/bld/java/net/thauvin/erik/pinboard/PinboardPosterBuild.java b/src/bld/java/net/thauvin/erik/pinboard/PinboardPosterBuild.java index 91100d8..e8c0149 100644 --- a/src/bld/java/net/thauvin/erik/pinboard/PinboardPosterBuild.java +++ b/src/bld/java/net/thauvin/erik/pinboard/PinboardPosterBuild.java @@ -58,7 +58,7 @@ public class PinboardPosterBuild extends Project { public PinboardPosterBuild() { pkg = "net.thauvin.erik"; name = "pinboard-poster"; - version = version(1, 1, 1, "SNAPSHOT"); + version = version(1, 1, 1); mainClass = pkg + ".PinboardPoster"; From c9d4ec46df09dfb209c490bd9f53b3c281628626 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Sun, 26 Nov 2023 00:39:53 -0800 Subject: [PATCH 183/224] Updated version in README --- README.md | 4 ++-- .../java/net/thauvin/erik/pinboard/PinboardPosterBuild.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 73561f4..eb0a67b 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ To use with [bld](https://rife2.com/bld), include the following dependency in yo repositories = List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS_LEGACY); scope(compile) - .include(dependency("net.thauvin.erik:pinboard-poster:1.1.0")); + .include(dependency("net.thauvin.erik:pinboard-poster:1.1.1")); ``` Be sure to use the [bld Kotlin extension](https://github.com/rife2/bld-kotlin) in your project. @@ -73,7 +73,7 @@ repositories { } dependencies { - compile 'net.thauvin.erik:pinboard-poster:1.1.0' + compile 'net.thauvin.erik:pinboard-poster:1.1.1' } ``` diff --git a/src/bld/java/net/thauvin/erik/pinboard/PinboardPosterBuild.java b/src/bld/java/net/thauvin/erik/pinboard/PinboardPosterBuild.java index e8c0149..6829cc3 100644 --- a/src/bld/java/net/thauvin/erik/pinboard/PinboardPosterBuild.java +++ b/src/bld/java/net/thauvin/erik/pinboard/PinboardPosterBuild.java @@ -58,7 +58,7 @@ public class PinboardPosterBuild extends Project { public PinboardPosterBuild() { pkg = "net.thauvin.erik"; name = "pinboard-poster"; - version = version(1, 1, 1); + version = version(1, 1, 2, "SNAPSHOT"); mainClass = pkg + ".PinboardPoster"; From 42749309887f9724eee25f5fa391855bdca7aa11 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 31 Jan 2024 15:58:22 -0800 Subject: [PATCH 184/224] Bumped bld to 1.8.0 --- .idea/libraries/bld.xml | 4 ++-- .idea/misc.xml | 1 + .vscode/settings.json | 2 +- README.md | 1 + examples/bld/.idea/libraries/bld.xml | 4 ++-- examples/bld/.vscode/settings.json | 2 +- examples/bld/lib/bld/bld-wrapper.jar | Bin 27321 -> 27293 bytes examples/bld/lib/bld/bld-wrapper.properties | 2 +- .../erik/pinboard/samples/ExampleBuild.java | 2 +- lib/bld/bld-wrapper.jar | Bin 27321 -> 27293 bytes lib/bld/bld-wrapper.properties | 8 ++++---- 11 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.idea/libraries/bld.xml b/.idea/libraries/bld.xml index ca84ff0..bff4f62 100644 --- a/.idea/libraries/bld.xml +++ b/.idea/libraries/bld.xml @@ -2,12 +2,12 @@ - + - + diff --git a/.idea/misc.xml b/.idea/misc.xml index c80528e..2adb169 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -16,6 +16,7 @@