-
-
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
deleted file mode 100644
index dd4c951..0000000
--- a/.idea/inspectionProfiles/profiles_settings.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
deleted file mode 100644
index 44174d6..0000000
--- a/.idea/kotlinc.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries-with-intellij-classes.xml b/.idea/libraries-with-intellij-classes.xml
deleted file mode 100644
index 9fa3156..0000000
--- a/.idea/libraries-with-intellij-classes.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/bld.xml b/.idea/libraries/bld.xml
new file mode 100644
index 0000000..153a060
--- /dev/null
+++ b/.idea/libraries/bld.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/libraries/compile.xml b/.idea/libraries/compile.xml
new file mode 100644
index 0000000..99cc0c0
--- /dev/null
+++ b/.idea/libraries/compile.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/runtime.xml b/.idea/libraries/runtime.xml
new file mode 100644
index 0000000..d4069f2
--- /dev/null
+++ b/.idea/libraries/runtime.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/test.xml b/.idea/libraries/test.xml
new file mode 100644
index 0000000..57ed5ef
--- /dev/null
+++ b/.idea/libraries/test.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 4ca97d5..2adb169 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,7 +1,27 @@
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 917a540..55adcb9 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -2,7 +2,8 @@
-
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/Run Tests.xml b/.idea/runConfigurations/Run Tests.xml
new file mode 100644
index 0000000..2d4326e
--- /dev/null
+++ b/.idea/runConfigurations/Run Tests.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/scopes/Source.xml b/.idea/scopes/Source.xml
deleted file mode 100644
index 942e059..0000000
--- a/.idea/scopes/Source.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
deleted file mode 100644
index e96534f..0000000
--- a/.idea/uiDesigner.xml
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 94a25f7..35eb1dd 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..f25500c
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,11 @@
+{
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "type": "java",
+ "name": "Run Tests",
+ "request": "launch",
+ "mainClass": "net.thauvin.erik.pinboard.PinboardPosterTest"
+ }
+ ]
+}
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..ba429d0
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,15 @@
+{
+ "java.project.sourcePaths": [
+ "src/main/java",
+ "src/main/resources",
+ "src/test/java",
+ "src/test/resources",
+ "src/bld/java",
+ "src/bld/resources"
+ ],
+ "java.configuration.updateBuildConfiguration": "automatic",
+ "java.project.referencedLibraries": [
+ "${HOME}/.bld/dist/bld-2.2.1.jar",
+ "lib/**/*.jar"
+ ]
+}
diff --git a/LICENSE.txt b/LICENSE.txt
index d53e5a1..9926d00 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,4 +1,4 @@
-Copyright (c) 2017-2023, Erik C. Thauvin (erik@thauvin.net)
+Copyright (c) 2017-2025, Erik C. Thauvin (erik@thauvin.net)
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/README.md b/README.md
index 9493ee0..cdf7df5 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,15 @@
# [Pinboard](https://pinboard.in) Poster for Kotlin, Java and Android
-[](https://opensource.org/licenses/BSD-3-Clause) [](https://github.com/ethauvin/pinboard-poster/releases/latest)
-[](https://oss.sonatype.org/content/repositories/snapshots/net/thauvin/erik/pinboard-poster/)
+[](https://opensource.org/licenses/BSD-3-Clause)
+[](https://kotlinlang.org/)
+[](https://rife2.com/bld)
+[](https://github.com/ethauvin/pinboard-poster/releases/latest)
[](https://central.sonatype.com/artifact/net.thauvin.erik/pinboard-poster)
+[](https://oss.sonatype.org/content/repositories/snapshots/net/thauvin/erik/pinboard-poster/)
+
[](https://sonarcloud.io/dashboard?id=ethauvin_pinboard-poster)
-[](https://github.com/ethauvin/pinboard-poster/actions/workflows/gradle.yml)
+[](https://github.com/ethauvin/pinboard-poster/actions/workflows/bld.yml)
[](https://circleci.com/gh/ethauvin/pinboard-poster/tree/master)
A small library for posting to [Pinboard](https://pinboard.in).
@@ -18,13 +22,13 @@ A small library for posting to [Pinboard](https://pinboard.in).
val poster = PinboardPoster("user:TOKEN")
-poster.addPin("https://www.example.com/foo", "This is a test")
-poster.addPin("https://examples.com", "This is a test", tags = arrayOf("foo", "bar"))
-poster.deletePin("https:///www.example.com/bar")
+poster.addPin("https://example.com/foo", "This is a test")
+poster.addPin("https://example.com", "This is a test", tags = arrayOf("foo", "bar"))
+poster.deletePin("https://example.com/bar")
```
-[View Example](https://github.com/ethauvin/pinboard-poster/blob/master/samples/kotlin/src/main/kotlin/net/thauvin/erik/pinboard/samples/KotlinExample.kt)
+[View Examples](https://github.com/ethauvin/pinboard-poster/blob/master/examples)
### Java
@@ -32,22 +36,34 @@ poster.deletePin("https:///www.example.com/bar")
final PinboardPoster poster = new PinBboardPoster("user:TOKEN");
-poster.addPin("https://www.example.com/foo", "This is a test");
-poster.addPin(new PinConfig.Builder()
- .url("https://example.com")
- .description("This is a test")
+poster.addPin("https://example.com/foo", "This is a test");
+poster.addPin(new PinConfig.Builder("https://example.com", "This is a test")
.tags("foo", "bar")
.build());
-poster.deletePin("https:///www.example.com/bar");
+poster.deletePin("https://example.com/bar");
```
-[View Example](https://github.com/ethauvin/pinboard-poster/blob/master/samples/java/src/main/java/net/thauvin/erik/pinboard/samples/JavaExample.java)
+[View Examples](https://github.com/ethauvin/pinboard-poster/blob/master/examples)
Your API authentication token is available on the [Pinboard settings page](https://pinboard.in/settings/password).
-## Usage with Gradle, Maven, etc.
+## bld
-To install and run from Gradle, add the following to the build.gradle file:
+To use with [bld](https://rife2.com/bld), include the following dependency in your [build](https://github.com/ethauvin/pinboard-poster/blob/master/examples/bld/src/bld/java/net/thauvin/erik/pinboard/samples/ExampleBuild.java) file:
+
+```java
+repositories = List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS_LEGACY);
+
+scope(compile)
+ .include(dependency("net.thauvin.erik:pinboard-poster:1.2.0"));
+```
+Be sure to use the [bld Kotlin extension](https://github.com/rife2/bld-kotlin) in your project.
+
+[View Example](https://github.com/ethauvin/pinboard-poster/blob/master/examples/bld/)
+
+## Gradle, Maven, etc.
+
+To install and run from Gradle, add the following to the `build.gradle` file:
```gradle
repositories {
@@ -55,12 +71,11 @@ repositories {
}
dependencies {
- compile 'net.thauvin.erik:pinboard-poster:1.1.0'
+ compile 'net.thauvin.erik:pinboard-poster:1.2.0'
}
```
-[View Example](https://github.com/ethauvin/pinboard-poster/blob/master/samples/java/build.gradle)
-[View Kotlin DSL Example](https://github.com/ethauvin/pinboard-poster/blob/master/samples/kotlin/build.gradle.kts)
+[View Examples](https://github.com/ethauvin/pinboard-poster/blob/master/examples/gradle/)
Instructions for using with Maven, Ivy, etc. can be found on [Maven Central](https://central.sonatype.com/artifact/net.thauvin.erik/pinboard-poster).
@@ -107,6 +122,7 @@ The library used [`java.util.logging`](https://docs.oracle.com/javase/8/docs/api
with(poster.logger) {
addHandler(ConsoleHandler().apply { level = Level.FINE })
level = Level.FINE
+ useParentHandlers = false
}
```
@@ -118,6 +134,7 @@ consoleHandler.setLevel(Level.FINE);
final Logger logger = poster.getLogger();
logger.addHandler(consoleHandler);
logger.setLevel(Level.FINE);
+logger.setUseParentHandlers(false);
```
or using a logging properties file.
@@ -180,3 +197,21 @@ The API end point is automatically configured to `https://api.pinboard.in/v1/`.
```kotlin
poster.apiEndPoint = "https://www.example.com/v1"
```
+
+## Contributing
+
+If you want to contribute to this project, all you have to do is clone the GitHub
+repository:
+
+```console
+git clone git@github.com:ethauvin/pinboard-poster.git
+```
+
+Then use [bld](https://rife2.com/bld) to build:
+
+```console
+cd pinboard-poster
+./bld compile
+```
+
+The project has an [IntelliJ IDEA](https://www.jetbrains.com/idea/) project structure. You can just open it after all the dependencies were downloaded and peruse the code.
diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml
index a9514a0..ace99d2 100644
--- a/bitbucket-pipelines.yml
+++ b/bitbucket-pipelines.yml
@@ -1,9 +1,20 @@
-image: maven:3-openjdk-18
+image: ubuntu:latest
pipelines:
default:
- step:
- caches:
- - gradle
+ name: Test with bld
script:
- - bash ./gradlew check
+ # Install latest Java & Kotlin via SDKMAN!
+ - apt-get update -qq && apt-get install -y curl zip
+ - curl -s "https://get.sdkman.io" | bash
+ - echo sdkman_auto_answer=true > $HOME/.sdkman/etc/config
+ - echo sdkman_auto_selfupdate=true >> $HOME/.sdkman/etc/config
+ - source "$HOME/.sdkman/bin/sdkman-init.sh"
+ - sdk install java
+ - sdk install kotlin
+ - source "$HOME/.sdkman/bin/sdkman-init.sh"
+ # Download, compile and test with bld
+ - ./bld download
+ - ./bld compile
+ - ./bld test
diff --git a/bld b/bld
new file mode 100755
index 0000000..3c1df97
--- /dev/null
+++ b/bld
@@ -0,0 +1,2 @@
+#!/usr/bin/env sh
+java -jar "$(dirname "$0")/lib/bld/bld-wrapper.jar" "$0" --build net.thauvin.erik.pinboard.PinboardPosterBuild "$@"
diff --git a/bld.bat b/bld.bat
new file mode 100644
index 0000000..1262822
--- /dev/null
+++ b/bld.bat
@@ -0,0 +1,4 @@
+@echo off
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+java -jar "%DIRNAME%/lib/bld/bld-wrapper.jar" "%0" --build net.thauvin.erik.pinboard.PinboardPosterBuild %*
diff --git a/build.gradle.kts b/build.gradle.kts
deleted file mode 100644
index 61463aa..0000000
--- a/build.gradle.kts
+++ /dev/null
@@ -1,214 +0,0 @@
-import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
-import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
-import org.gradle.api.tasks.testing.logging.TestExceptionFormat
-import org.gradle.api.tasks.testing.logging.TestLogEvent
-
-plugins {
- id("com.github.ben-manes.versions") version "0.48.0"
- id("io.gitlab.arturbosch.detekt") version "1.23.1"
- id("java")
- id("maven-publish")
- id("org.jetbrains.dokka") version "1.9.0"
- id("org.jetbrains.kotlinx.kover") version "0.7.3"
- id("org.sonarqube") version "4.4.0.3356"
- id("signing")
- kotlin("jvm") version "1.9.10"
-}
-
-group = "net.thauvin.erik"
-version = "1.1.0"
-description = "A small library for posting to Pinboard"
-
-val gitHub = "ethauvin/$name"
-val mavenUrl = "https://github.com/$gitHub"
-val deployDir = "deploy"
-var isRelease = "release" in gradle.startParameter.taskNames
-
-val publicationName = "mavenJava"
-
-object Versions {
- const val OKHTTP = "4.11.0"
-}
-
-fun isNonStable(version: String): Boolean {
- val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) }
- val regex = "^[0-9,.v-]+(-r)?$".toRegex()
- val isStable = stableKeyword || regex.matches(version)
- return isStable.not()
-}
-
-repositories {
- mavenCentral()
- maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }
-}
-
-dependencies {
- implementation(platform(kotlin("bom")))
-
- implementation("com.squareup.okhttp3:okhttp:${Versions.OKHTTP}")
- implementation("com.squareup.okio:okio:3.5.0")
- implementation("com.squareup.okhttp3:logging-interceptor:${Versions.OKHTTP}")
-
- testImplementation("org.testng:testng:7.8.0")
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_11
- targetCompatibility = JavaVersion.VERSION_11
- withSourcesJar()
-}
-
-detekt {
- //toolVersion = "main-SNAPSHOT"
- baseline = project.rootDir.resolve("config/detekt/baseline.xml")
-}
-
-koverReport {
- defaults {
- xml {
- onCheck = true
- }
- html {
- onCheck = true
- }
- }
-}
-
-sonarqube {
- properties {
- property("sonar.projectKey", "ethauvin_$name")
- property("sonar.organization", "ethauvin-github")
- property("sonar.host.url", "https://sonarcloud.io")
- property("sonar.sourceEncoding", "UTF-8")
- property("sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/kover/report.xml")
- }
-}
-
-val javadocJar by tasks.creating(Jar::class) {
- dependsOn(tasks.dokkaJavadoc)
- from(tasks.dokkaJavadoc)
- archiveClassifier.set("javadoc")
- description = "Assembles a JAR of the generated Javadoc."
- group = JavaBasePlugin.DOCUMENTATION_GROUP
-}
-
-tasks {
- withType {
- testLogging {
- exceptionFormat = TestExceptionFormat.FULL
- events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
- }
-
- useTestNG()
- }
-
- withType {
- kotlinOptions.jvmTarget = java.targetCompatibility.toString()
- }
-
- withType {
- destination = file("$projectDir/pom.xml")
- }
-
- withType {
- rejectVersionIf {
- isNonStable(candidate.version)
- }
- }
-
- clean {
- doLast {
- project.delete(fileTree(deployDir))
- }
- }
-
- val copyToDeploy by registering(Copy::class) {
- from(configurations.runtimeClasspath) {
- exclude("annotations-*.jar")
- exclude("kotlin-*.jar")
- }
- from(jar)
- into(deployDir)
- }
-
- register("deploy") {
- description = "Copies all needed files to the $deployDir directory."
- group = PublishingPlugin.PUBLISH_TASK_GROUP
- dependsOn(clean, build, jar)
- outputs.dir(deployDir)
- inputs.files(copyToDeploy)
- mustRunAfter(clean)
- }
-
- val gitIsDirty by registering(Exec::class) {
- description = "Fails if git has uncommitted changes."
- group = "verification"
- commandLine("git", "diff", "--quiet", "--exit-code")
- }
-
- val gitTag by registering(Exec::class) {
- description = "Tags the local repository with version ${project.version}"
- group = PublishingPlugin.PUBLISH_TASK_GROUP
- dependsOn(gitIsDirty)
- if (isRelease) {
- commandLine("git", "tag", "-a", project.version, "-m", "Version ${project.version}")
- }
- }
-
- register("release") {
- description = "Publishes version ${project.version} to local repository."
- group = PublishingPlugin.PUBLISH_TASK_GROUP
- dependsOn(wrapper, "deploy", gitTag, publishToMavenLocal)
- }
-}
-
-publishing {
- publications {
- create(publicationName) {
- from(components["java"])
- artifact(javadocJar)
- pom {
- name.set(project.name)
- description.set(project.description)
- url.set(mavenUrl)
- licenses {
- license {
- name.set("BSD 3-Clause")
- url.set("https://opensource.org/licenses/BSD-3-Clause")
- }
- }
- developers {
- developer {
- id.set("ethauvin")
- name.set("Erik C. Thauvin")
- email.set("erik@thauvin.net")
- url.set("https://erik.thauvin.net/")
- }
- }
- scm {
- connection.set("scm:git:https//github.com/$gitHub.git")
- developerConnection.set("scm:git:git@github.com:$gitHub.git")
- url.set(mavenUrl)
- }
- issueManagement {
- system.set("GitHub")
- url.set("$mavenUrl/issues")
- }
- }
- }
- }
- repositories {
- maven {
- name = "ossrh"
- url = if (project.version.toString().contains("SNAPSHOT"))
- uri("https://oss.sonatype.org/content/repositories/snapshots/") else
- uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
- credentials(PasswordCredentials::class)
- }
- }
-}
-
-signing {
- useGpgCmd()
- sign(publishing.publications[publicationName])
-}
diff --git a/config/detekt/baseline.xml b/config/detekt/baseline.xml
index 278860b..3f97ec1 100644
--- a/config/detekt/baseline.xml
+++ b/config/detekt/baseline.xml
@@ -1,12 +1,11 @@
-
+
-
+
- LongParameterList:PinConfig.kt$PinConfig$( val url: String, val description: String, val extended: String, val tags: Array<out String>, val dt: ZonedDateTime, val replace: Boolean, val shared: Boolean, val toRead: Boolean )
+ LongParameterList:PinConfig.kt$PinConfig$( var url: String, var description: String, var extended: String = "", var tags: Array<out String> = emptyArray(), var dt: ZonedDateTime = ZonedDateTime.now(), var replace: Boolean = true, var shared: Boolean = true, var toRead: Boolean = false )LongParameterList:PinboardPoster.kt$PinboardPoster$( url: String, description: String, extended: String = "", vararg tags: String = emptyArray(), dt: ZonedDateTime = ZonedDateTime.now(), replace: Boolean = true, shared: Boolean = true, toRead: Boolean = false )
- NestedBlockDepth:PinboardPoster.kt$PinboardPoster$private fun executeMethod(method: String, params: Map<String, String>): Boolean
+ NestedBlockDepth:PinboardPoster.kt$PinboardPoster$private fun executeMethod(method: String, params: Map<String, String>): BooleanThrowsCount:PinboardPoster.kt$PinboardPoster$@Throws(IOException::class) internal fun parseMethodResponse(method: String, response: String)TooManyFunctions:PinConfig.kt$PinConfig$Builder
- WildcardImport:PinboardPosterTest.kt$import org.testng.Assert.*
diff --git a/deploy.sh b/deploy.sh
deleted file mode 100755
index f7caf5f..0000000
--- a/deploy.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-./gradlew deploy
-[ $? -eq 0 ] && scp deploy/*.jar nix3.thauvin.us:/opt/lib/jtalk-ee/pinboard-poster
diff --git a/examples/bld/.gitignore b/examples/bld/.gitignore
new file mode 100644
index 0000000..a2805aa
--- /dev/null
+++ b/examples/bld/.gitignore
@@ -0,0 +1,55 @@
+.gradle
+.DS_Store
+build
+lib/bld/**
+!lib/bld/bld-wrapper.jar
+!lib/bld/bld-wrapper.properties
+lib/compile/
+lib/runtime/
+lib/standalone/
+lib/test/
+
+# IDEA ignores
+
+# User-specific
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+.idea/**/usage.statistics.xml
+.idea/**/dictionaries
+.idea/**/shelf
+
+# AWS User-specific
+.idea/**/aws.xml
+
+# Generated files
+.idea/**/contentModel.xml
+
+# Sensitive or high-churn files
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+.idea/**/dbnavigator.xml
+
+# Gradle
+.idea/**/gradle.xml
+
+# Mongo Explorer plugin
+.idea/**/mongoSettings.xml
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# SonarLint plugin
+.idea/sonarlint/
+
+# Editor-based Rest Client
+.idea/httpRequests
\ No newline at end of file
diff --git a/examples/bld/.idea/.gitignore b/examples/bld/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/examples/bld/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/examples/bld/.idea/.name b/examples/bld/.idea/.name
new file mode 100644
index 0000000..6782949
--- /dev/null
+++ b/examples/bld/.idea/.name
@@ -0,0 +1 @@
+pinboard-poster-examples-bld
\ No newline at end of file
diff --git a/examples/bld/.idea/app.iml b/examples/bld/.idea/app.iml
new file mode 100644
index 0000000..2d05353
--- /dev/null
+++ b/examples/bld/.idea/app.iml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/bld/.idea/bld.iml b/examples/bld/.idea/bld.iml
new file mode 100644
index 0000000..e63e11e
--- /dev/null
+++ b/examples/bld/.idea/bld.iml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/bld/.idea/bld.xml b/examples/bld/.idea/bld.xml
new file mode 100644
index 0000000..6600cee
--- /dev/null
+++ b/examples/bld/.idea/bld.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/bld/.idea/inspectionProfiles/Project_Default.xml b/examples/bld/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..1e01b48
--- /dev/null
+++ b/examples/bld/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/bld/.idea/libraries/bld.xml b/examples/bld/.idea/libraries/bld.xml
new file mode 100644
index 0000000..153a060
--- /dev/null
+++ b/examples/bld/.idea/libraries/bld.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/bld/.idea/libraries/compile.xml b/examples/bld/.idea/libraries/compile.xml
new file mode 100644
index 0000000..99cc0c0
--- /dev/null
+++ b/examples/bld/.idea/libraries/compile.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/bld/.idea/libraries/runtime.xml b/examples/bld/.idea/libraries/runtime.xml
new file mode 100644
index 0000000..d4069f2
--- /dev/null
+++ b/examples/bld/.idea/libraries/runtime.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/bld/.idea/libraries/test.xml b/examples/bld/.idea/libraries/test.xml
new file mode 100644
index 0000000..57ed5ef
--- /dev/null
+++ b/examples/bld/.idea/libraries/test.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/bld/.idea/misc.xml b/examples/bld/.idea/misc.xml
new file mode 100644
index 0000000..f522a9e
--- /dev/null
+++ b/examples/bld/.idea/misc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/examples/bld/.idea/modules.xml b/examples/bld/.idea/modules.xml
new file mode 100644
index 0000000..55adcb9
--- /dev/null
+++ b/examples/bld/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/bld/.idea/runConfigurations/Run Tests.xml b/examples/bld/.idea/runConfigurations/Run Tests.xml
new file mode 100644
index 0000000..e5f873f
--- /dev/null
+++ b/examples/bld/.idea/runConfigurations/Run Tests.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/bld/.idea/vcs.xml b/examples/bld/.idea/vcs.xml
new file mode 100644
index 0000000..b2bdec2
--- /dev/null
+++ b/examples/bld/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/bld/.vscode/launch.json b/examples/bld/.vscode/launch.json
new file mode 100644
index 0000000..b183bbe
--- /dev/null
+++ b/examples/bld/.vscode/launch.json
@@ -0,0 +1,11 @@
+{
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "type": "java",
+ "name": "Run Tests",
+ "request": "launch",
+ "mainClass": "net.thauvin.erik.pinboard.samples.JavaExampleTest"
+ }
+ ]
+}
diff --git a/examples/bld/.vscode/settings.json b/examples/bld/.vscode/settings.json
new file mode 100644
index 0000000..ba429d0
--- /dev/null
+++ b/examples/bld/.vscode/settings.json
@@ -0,0 +1,15 @@
+{
+ "java.project.sourcePaths": [
+ "src/main/java",
+ "src/main/resources",
+ "src/test/java",
+ "src/test/resources",
+ "src/bld/java",
+ "src/bld/resources"
+ ],
+ "java.configuration.updateBuildConfiguration": "automatic",
+ "java.project.referencedLibraries": [
+ "${HOME}/.bld/dist/bld-2.2.1.jar",
+ "lib/**/*.jar"
+ ]
+}
diff --git a/examples/bld/README.md b/examples/bld/README.md
new file mode 100644
index 0000000..ad5401c
--- /dev/null
+++ b/examples/bld/README.md
@@ -0,0 +1,18 @@
+## Kotlin Example
+To compile & run the Kotlin example:
+
+```console
+./bld compile
+
+./bld run
+```
+
+## Java Example
+
+To compile & run the Java example:
+
+```console
+./bld compile
+
+./bld run-java
+```
diff --git a/examples/bld/bld b/examples/bld/bld
new file mode 100755
index 0000000..1a39c97
--- /dev/null
+++ b/examples/bld/bld
@@ -0,0 +1,2 @@
+#!/usr/bin/env sh
+java -jar "$(dirname "$0")/lib/bld/bld-wrapper.jar" "$0" --build net.thauvin.erik.pinboard.samples.ExampleBuild "$@"
diff --git a/examples/bld/bld.bat b/examples/bld/bld.bat
new file mode 100644
index 0000000..6357553
--- /dev/null
+++ b/examples/bld/bld.bat
@@ -0,0 +1,4 @@
+@echo off
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+java -jar "%DIRNAME%/lib/bld/bld-wrapper.jar" "%0" --build net.thauvin.erik.pinboard.samples.ExampleBuild %*
diff --git a/examples/bld/lib/bld/bld-wrapper.jar b/examples/bld/lib/bld/bld-wrapper.jar
new file mode 100644
index 0000000..968a8ab
Binary files /dev/null and b/examples/bld/lib/bld/bld-wrapper.jar differ
diff --git a/examples/bld/lib/bld/bld-wrapper.properties b/examples/bld/lib/bld/bld-wrapper.properties
new file mode 100644
index 0000000..1f1009d
--- /dev/null
+++ b/examples/bld/lib/bld/bld-wrapper.properties
@@ -0,0 +1,7 @@
+bld.downloadExtensionJavadoc=false
+bld.downloadExtensionSources=true
+bld.downloadLocation=
+bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.1.0-SNAPSHOT
+bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
+bld.sourceDirectories=
+bld.version=2.2.1
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
new file mode 100644
index 0000000..6fc8142
--- /dev/null
+++ b/examples/bld/src/bld/java/net/thauvin/erik/pinboard/samples/ExampleBuild.java
@@ -0,0 +1,54 @@
+package net.thauvin.erik.pinboard.samples;
+
+import rife.bld.BaseProject;
+import rife.bld.BuildCommand;
+import rife.bld.extension.CompileKotlinOperation;
+import rife.bld.extension.kotlin.CompileOptions;
+import rife.bld.operations.RunOperation;
+
+import java.util.List;
+
+import static rife.bld.dependencies.Repository.*;
+import static rife.bld.dependencies.Scope.compile;
+
+public class ExampleBuild extends BaseProject {
+ public ExampleBuild() {
+ pkg = "net.thauvin.erik.pinboard.samples";
+ name = "Example";
+ version = version(0, 1, 0);
+
+ mainClass = pkg + ".KotlinExampleKt";
+
+ javaRelease = 11;
+ downloadSources = true;
+ autoDownloadPurge = true;
+
+ repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, SONATYPE_SNAPSHOTS_LEGACY);
+
+ scope(compile)
+ .include(dependency("net.thauvin.erik", "pinboard-poster", version(1, 2, 1, "SNAPSHOT")));
+ }
+
+ public static void main(String[] args) {
+ new ExampleBuild().start(args);
+ }
+
+ @Override
+ public void compile() throws Exception {
+ new CompileKotlinOperation()
+ .fromProject(this)
+ .compileOptions(new CompileOptions().verbose(true))
+ .execute();
+
+ // Also compile the Java source code
+ super.compile();
+ }
+
+ @BuildCommand(value = "run-java", summary = "Runs the Java example")
+ public void runJava() throws Exception {
+ new RunOperation()
+ .fromProject(this)
+ .mainClass(pkg + ".JavaExample")
+ .execute();
+ }
+}
diff --git a/samples/java/src/main/java/net/thauvin/erik/pinboard/samples/JavaExample.java b/examples/bld/src/main/java/net/thauvin/erik/pinboard/samples/JavaExample.java
similarity index 68%
rename from samples/java/src/main/java/net/thauvin/erik/pinboard/samples/JavaExample.java
rename to examples/bld/src/main/java/net/thauvin/erik/pinboard/samples/JavaExample.java
index 0aa16f0..1ef224b 100644
--- a/samples/java/src/main/java/net/thauvin/erik/pinboard/samples/JavaExample.java
+++ b/examples/bld/src/main/java/net/thauvin/erik/pinboard/samples/JavaExample.java
@@ -27,20 +27,21 @@ public class JavaExample {
final Logger logger = poster.getLogger();
logger.addHandler(consoleHandler);
logger.setLevel(Level.FINE);
+ logger.setUseParentHandlers(false);
- // Add Pin
- if (poster.addPin(new PinConfig.Builder()
- .url(url)
- .description("Testing")
- .extended("Extra")
- .tags("test", "java")
- .build())) {
- System.out.println("Added: " + url);
- }
+ if (poster.validate()) {
+ // Add Pin
+ if (poster.addPin(new PinConfig.Builder(url, "Testing")
+ .extended("Extra")
+ .tags("test", "java")
+ .build())) {
+ System.out.println("Added: " + url);
+ }
- // Delete Pin
- if (poster.deletePin(url)) {
- System.out.println("Deleted: " + url);
+ // Delete Pin
+ if (poster.deletePin(url)) {
+ System.out.println("Deleted: " + url);
+ }
}
}
}
diff --git a/samples/kotlin/src/main/kotlin/net/thauvin/erik/pinboard/samples/KotlinExample.kt b/examples/bld/src/main/kotlin/net/thauvin/erik/pinboard/samples/KotlinExample.kt
similarity index 67%
rename from samples/kotlin/src/main/kotlin/net/thauvin/erik/pinboard/samples/KotlinExample.kt
rename to examples/bld/src/main/kotlin/net/thauvin/erik/pinboard/samples/KotlinExample.kt
index 0582144..1b48e82 100644
--- a/samples/kotlin/src/main/kotlin/net/thauvin/erik/pinboard/samples/KotlinExample.kt
+++ b/examples/bld/src/main/kotlin/net/thauvin/erik/pinboard/samples/KotlinExample.kt
@@ -20,15 +20,18 @@ fun main(args: Array) {
with(poster.logger) {
addHandler(ConsoleHandler().apply { level = Level.FINE })
level = Level.FINE
+ useParentHandlers = false
}
- // Add Pin
- if (poster.addPin(url, "Testing", "Extended test", tags = arrayOf("test", "kotlin"))) {
- println("Added: $url")
- }
+ if (poster.validate()) {
+ // Add Pin
+ if (poster.addPin(url, "Testing", "Extended test", tags = arrayOf("test", "kotlin"))) {
+ println("Added: $url")
+ }
- // Delete Pin
- if (poster.deletePin(url)) {
- println("Deleted: $url")
+ // Delete Pin
+ if (poster.deletePin(url)) {
+ println("Deleted: $url")
+ }
}
}
diff --git a/samples/java/.editorconfig b/examples/gradle/java/.editorconfig
similarity index 100%
rename from samples/java/.editorconfig
rename to examples/gradle/java/.editorconfig
diff --git a/samples/java/.gitignore b/examples/gradle/java/.gitignore
similarity index 100%
rename from samples/java/.gitignore
rename to examples/gradle/java/.gitignore
diff --git a/examples/gradle/java/.idea/.gitignore b/examples/gradle/java/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/examples/gradle/java/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/examples/gradle/java/.idea/.name b/examples/gradle/java/.idea/.name
new file mode 100644
index 0000000..4f5dba1
--- /dev/null
+++ b/examples/gradle/java/.idea/.name
@@ -0,0 +1 @@
+pinboard-poster-examples-gradle-java
\ No newline at end of file
diff --git a/examples/gradle/java/.idea/compiler.xml b/examples/gradle/java/.idea/compiler.xml
new file mode 100644
index 0000000..fb7f4a8
--- /dev/null
+++ b/examples/gradle/java/.idea/compiler.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/gradle/java/.idea/inspectionProfiles/Project_Default.xml b/examples/gradle/java/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..1e01b48
--- /dev/null
+++ b/examples/gradle/java/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/examples/gradle/java/.idea/jarRepositories.xml
similarity index 53%
rename from .idea/jarRepositories.xml
rename to examples/gradle/java/.idea/jarRepositories.xml
index 646928b..a529ef2 100644
--- a/.idea/jarRepositories.xml
+++ b/examples/gradle/java/.idea/jarRepositories.xml
@@ -16,30 +16,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/gradle/java/.idea/misc.xml b/examples/gradle/java/.idea/misc.xml
new file mode 100644
index 0000000..7adacb2
--- /dev/null
+++ b/examples/gradle/java/.idea/misc.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/examples/gradle/java/.idea/vcs.xml b/examples/gradle/java/.idea/vcs.xml
new file mode 100644
index 0000000..c2365ab
--- /dev/null
+++ b/examples/gradle/java/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/gradle/java/README.md b/examples/gradle/java/README.md
new file mode 100644
index 0000000..caf0563
--- /dev/null
+++ b/examples/gradle/java/README.md
@@ -0,0 +1,5 @@
+## Run the Example
+
+```console
+./gradlew run
+```
diff --git a/examples/gradle/java/build.gradle b/examples/gradle/java/build.gradle
new file mode 100644
index 0000000..e0eceee
--- /dev/null
+++ b/examples/gradle/java/build.gradle
@@ -0,0 +1,26 @@
+plugins {
+ id 'com.github.ben-manes.versions' version '0.51.0'
+ id 'java'
+ id 'application'
+}
+
+defaultTasks 'run'
+
+application {
+ mainClass = 'net.thauvin.erik.pinboard.samples.JavaExample'
+}
+
+java {
+ sourceCompatibility = JavaVersion.VERSION_11
+ targetCompatibility = JavaVersion.VERSION_11
+}
+
+repositories {
+ mavenLocal()
+ mavenCentral()
+ maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }
+}
+
+dependencies {
+ implementation 'net.thauvin.erik:pinboard-poster:1.2.1-SNAPSHOT'
+}
diff --git a/examples/gradle/java/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/java/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..9bbc975
Binary files /dev/null and b/examples/gradle/java/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/java/gradle/wrapper/gradle-wrapper.properties
similarity index 94%
rename from gradle/wrapper/gradle-wrapper.properties
rename to examples/gradle/java/gradle/wrapper/gradle-wrapper.properties
index ac72c34..37f853b 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/examples/gradle/java/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/samples/kotlin/gradlew b/examples/gradle/java/gradlew
similarity index 91%
rename from samples/kotlin/gradlew
rename to examples/gradle/java/gradlew
index 0adc8e1..faf9300 100755
--- a/samples/kotlin/gradlew
+++ b/examples/gradle/java/gradlew
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+# SPDX-License-Identifier: Apache-2.0
+#
##############################################################################
#
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
-# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -84,7 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
-APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -145,7 +147,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
- # shellcheck disable=SC3045
+ # shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -153,7 +155,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
- # shellcheck disable=SC3045
+ # shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -202,11 +204,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
-# Collect all arguments for the java command;
-# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
-# shell script including quotes and variable substitutions, so put them in
-# double quotes to make sure that they get re-expanded; and
-# * put everything else in single quotes, so that it's not re-expanded.
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
diff --git a/samples/kotlin/gradlew.bat b/examples/gradle/java/gradlew.bat
similarity index 91%
rename from samples/kotlin/gradlew.bat
rename to examples/gradle/java/gradlew.bat
index 93e3f59..9d21a21 100644
--- a/samples/kotlin/gradlew.bat
+++ b/examples/gradle/java/gradlew.bat
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
goto fail
@@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
goto fail
diff --git a/samples/java/settings.gradle b/examples/gradle/java/settings.gradle
similarity index 84%
rename from samples/java/settings.gradle
rename to examples/gradle/java/settings.gradle
index e7ecd5d..87b714a 100644
--- a/samples/java/settings.gradle
+++ b/examples/gradle/java/settings.gradle
@@ -7,4 +7,4 @@
* in the user guide at https://docs.gradle.org/4.8/userguide/multi_project_builds.html
*/
-rootProject.name = 'samples-java'
+rootProject.name = 'pinboard-poster-examples-gradle-java'
diff --git a/examples/gradle/java/src/main/java/net/thauvin/erik/pinboard/samples/JavaExample.java b/examples/gradle/java/src/main/java/net/thauvin/erik/pinboard/samples/JavaExample.java
new file mode 100644
index 0000000..1ef224b
--- /dev/null
+++ b/examples/gradle/java/src/main/java/net/thauvin/erik/pinboard/samples/JavaExample.java
@@ -0,0 +1,47 @@
+package net.thauvin.erik.pinboard.samples;
+
+import net.thauvin.erik.pinboard.PinConfig;
+import net.thauvin.erik.pinboard.PinboardPoster;
+
+import java.nio.file.Paths;
+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 = "https://example.com/pinboard";
+ final PinboardPoster poster;
+
+ if (args.length == 1) {
+ // API Token is an argument
+ poster = new PinboardPoster(args[0]);
+ } else {
+ // API Token is in local.properties or PINBOARD_API_TOKEN environment variable
+ poster = new PinboardPoster(Paths.get("local.properties"));
+ }
+
+ // Set logging levels
+ final ConsoleHandler consoleHandler = new ConsoleHandler();
+ consoleHandler.setLevel(Level.FINE);
+ final Logger logger = poster.getLogger();
+ logger.addHandler(consoleHandler);
+ logger.setLevel(Level.FINE);
+ logger.setUseParentHandlers(false);
+
+ if (poster.validate()) {
+ // Add Pin
+ if (poster.addPin(new PinConfig.Builder(url, "Testing")
+ .extended("Extra")
+ .tags("test", "java")
+ .build())) {
+ System.out.println("Added: " + url);
+ }
+
+ // Delete Pin
+ if (poster.deletePin(url)) {
+ System.out.println("Deleted: " + url);
+ }
+ }
+ }
+}
diff --git a/samples/kotlin/.editorconfig b/examples/gradle/kotlin/.editorconfig
similarity index 100%
rename from samples/kotlin/.editorconfig
rename to examples/gradle/kotlin/.editorconfig
diff --git a/samples/kotlin/.gitignore b/examples/gradle/kotlin/.gitignore
similarity index 100%
rename from samples/kotlin/.gitignore
rename to examples/gradle/kotlin/.gitignore
diff --git a/examples/gradle/kotlin/.idea/.gitignore b/examples/gradle/kotlin/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/examples/gradle/kotlin/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/examples/gradle/kotlin/.idea/.name b/examples/gradle/kotlin/.idea/.name
new file mode 100644
index 0000000..7379aed
--- /dev/null
+++ b/examples/gradle/kotlin/.idea/.name
@@ -0,0 +1 @@
+pinboard-post-examples-gradle-kotlin
\ No newline at end of file
diff --git a/examples/gradle/kotlin/.idea/compiler.xml b/examples/gradle/kotlin/.idea/compiler.xml
new file mode 100644
index 0000000..fb7f4a8
--- /dev/null
+++ b/examples/gradle/kotlin/.idea/compiler.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/gradle/kotlin/.idea/inspectionProfiles/Project_Default.xml b/examples/gradle/kotlin/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..1e01b48
--- /dev/null
+++ b/examples/gradle/kotlin/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/gradle/kotlin/.idea/jarRepositories.xml b/examples/gradle/kotlin/.idea/jarRepositories.xml
new file mode 100644
index 0000000..a529ef2
--- /dev/null
+++ b/examples/gradle/kotlin/.idea/jarRepositories.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/samples-kotlin.iml b/examples/gradle/kotlin/.idea/kotlin.iml
similarity index 82%
rename from .idea/modules/samples-kotlin.iml
rename to examples/gradle/kotlin/.idea/kotlin.iml
index 813d9e8..d6ebd48 100644
--- a/.idea/modules/samples-kotlin.iml
+++ b/examples/gradle/kotlin/.idea/kotlin.iml
@@ -2,7 +2,7 @@
-
+
diff --git a/examples/gradle/kotlin/.idea/kotlinc.xml b/examples/gradle/kotlin/.idea/kotlinc.xml
new file mode 100644
index 0000000..6d0ee1c
--- /dev/null
+++ b/examples/gradle/kotlin/.idea/kotlinc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/gradle/kotlin/.idea/misc.xml b/examples/gradle/kotlin/.idea/misc.xml
new file mode 100644
index 0000000..034d4d4
--- /dev/null
+++ b/examples/gradle/kotlin/.idea/misc.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/gradle/kotlin/.idea/modules.xml b/examples/gradle/kotlin/.idea/modules.xml
new file mode 100644
index 0000000..a168080
--- /dev/null
+++ b/examples/gradle/kotlin/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/gradle/kotlin/.idea/vcs.xml b/examples/gradle/kotlin/.idea/vcs.xml
new file mode 100644
index 0000000..c2365ab
--- /dev/null
+++ b/examples/gradle/kotlin/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/gradle/kotlin/README.md b/examples/gradle/kotlin/README.md
new file mode 100644
index 0000000..caf0563
--- /dev/null
+++ b/examples/gradle/kotlin/README.md
@@ -0,0 +1,5 @@
+## Run the Example
+
+```console
+./gradlew run
+```
diff --git a/samples/kotlin/build.gradle.kts b/examples/gradle/kotlin/build.gradle.kts
similarity index 54%
rename from samples/kotlin/build.gradle.kts
rename to examples/gradle/kotlin/build.gradle.kts
index 0edfbaf..f41881f 100644
--- a/samples/kotlin/build.gradle.kts
+++ b/examples/gradle/kotlin/build.gradle.kts
@@ -2,21 +2,20 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("application")
- id("com.github.ben-manes.versions") version "0.48.0"
- kotlin("jvm") version "1.9.10"
+ id("com.github.ben-manes.versions") version "0.51.0"
+ kotlin("jvm") version "2.1.20"
}
-// ./gradlew run
-
defaultTasks(ApplicationPlugin.TASK_RUN_NAME)
repositories {
mavenLocal()
mavenCentral()
+ maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }
}
dependencies {
- implementation("net.thauvin.erik:pinboard-poster:1.1.0")
+ implementation("net.thauvin.erik:pinboard-poster:1.2.1-SNAPSHOT")
}
java {
@@ -28,8 +27,6 @@ application {
mainClass.set("net.thauvin.erik.pinboard.samples.KotlinExampleKt")
}
-tasks {
- withType().configureEach {
- kotlinOptions.jvmTarget = java.targetCompatibility.toString()
- }
+kotlin {
+ compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11)
}
diff --git a/examples/gradle/kotlin/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/kotlin/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..9bbc975
Binary files /dev/null and b/examples/gradle/kotlin/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/samples/java/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/kotlin/gradle/wrapper/gradle-wrapper.properties
similarity index 94%
rename from samples/java/gradle/wrapper/gradle-wrapper.properties
rename to examples/gradle/kotlin/gradle/wrapper/gradle-wrapper.properties
index ac72c34..37f853b 100644
--- a/samples/java/gradle/wrapper/gradle-wrapper.properties
+++ b/examples/gradle/kotlin/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/gradlew b/examples/gradle/kotlin/gradlew
similarity index 91%
rename from gradlew
rename to examples/gradle/kotlin/gradlew
index 0adc8e1..faf9300 100755
--- a/gradlew
+++ b/examples/gradle/kotlin/gradlew
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+# SPDX-License-Identifier: Apache-2.0
+#
##############################################################################
#
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
-# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -84,7 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
-APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -145,7 +147,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
- # shellcheck disable=SC3045
+ # shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -153,7 +155,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
- # shellcheck disable=SC3045
+ # shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -202,11 +204,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
-# Collect all arguments for the java command;
-# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
-# shell script including quotes and variable substitutions, so put them in
-# double quotes to make sure that they get re-expanded; and
-# * put everything else in single quotes, so that it's not re-expanded.
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
diff --git a/gradlew.bat b/examples/gradle/kotlin/gradlew.bat
similarity index 91%
rename from gradlew.bat
rename to examples/gradle/kotlin/gradlew.bat
index 93e3f59..9d21a21 100644
--- a/gradlew.bat
+++ b/examples/gradle/kotlin/gradlew.bat
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
goto fail
@@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
goto fail
diff --git a/examples/gradle/kotlin/settings.gradle.kts b/examples/gradle/kotlin/settings.gradle.kts
new file mode 100644
index 0000000..5d8ff15
--- /dev/null
+++ b/examples/gradle/kotlin/settings.gradle.kts
@@ -0,0 +1 @@
+rootProject.name = "pinboard-post-examples-gradle-kotlin"
diff --git a/examples/gradle/kotlin/src/main/kotlin/net/thauvin/erik/pinboard/samples/KotlinExample.kt b/examples/gradle/kotlin/src/main/kotlin/net/thauvin/erik/pinboard/samples/KotlinExample.kt
new file mode 100644
index 0000000..1b48e82
--- /dev/null
+++ b/examples/gradle/kotlin/src/main/kotlin/net/thauvin/erik/pinboard/samples/KotlinExample.kt
@@ -0,0 +1,37 @@
+package net.thauvin.erik.pinboard.samples
+
+import net.thauvin.erik.pinboard.PinboardPoster
+import java.nio.file.Paths
+import java.util.logging.ConsoleHandler
+import java.util.logging.Level
+
+fun main(args: Array) {
+ val url = "https://example.com/pinboard"
+
+ 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(Paths.get("local.properties"))
+ }
+
+ // Set logging levels
+ with(poster.logger) {
+ addHandler(ConsoleHandler().apply { level = Level.FINE })
+ level = Level.FINE
+ useParentHandlers = false
+ }
+
+ if (poster.validate()) {
+ // Add Pin
+ if (poster.addPin(url, "Testing", "Extended test", tags = arrayOf("test", "kotlin"))) {
+ println("Added: $url")
+ }
+
+ // Delete Pin
+ if (poster.deletePin(url)) {
+ println("Deleted: $url")
+ }
+ }
+}
diff --git a/gradle.properties b/gradle.properties
deleted file mode 100644
index e69de29..0000000
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 7f93135..0000000
Binary files a/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/lib/bld/bld-wrapper.jar b/lib/bld/bld-wrapper.jar
new file mode 100644
index 0000000..7add961
Binary files /dev/null and b/lib/bld/bld-wrapper.jar differ
diff --git a/lib/bld/bld-wrapper.properties b/lib/bld/bld-wrapper.properties
new file mode 100644
index 0000000..fc9463a
--- /dev/null
+++ b/lib/bld/bld-wrapper.properties
@@ -0,0 +1,10 @@
+bld.downloadExtensionJavadoc=false
+bld.downloadExtensionSources=true
+bld.downloadLocation=
+bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.10-SNAPSHOT
+bld.extension-dokka=com.uwyn.rife2:bld-dokka:1.0.4-SNAPSHOT
+bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.10-SNAPSHOT
+bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.1.0-SNAPSHOT
+bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
+bld.sourceDirectories=
+bld.version=2.2.1
diff --git a/pinboard-poster.iml b/pinboard-poster.iml
deleted file mode 100644
index 6afc535..0000000
--- a/pinboard-poster.iml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-