+
+
\ No newline at end of file
diff --git a/.idea/intellij-javadocs-4.0.1.xml b/.idea/intellij-javadocs-4.0.1.xml
new file mode 100644
index 0000000..d3e96f9
--- /dev/null
+++ b/.idea/intellij-javadocs-4.0.1.xml
@@ -0,0 +1,204 @@
+
+
+
+
+ UPDATE
+ false
+ true
+
+ TYPE
+ METHOD
+ FIELD
+
+
+ DEFAULT
+ PUBLIC
+ PROTECTED
+
+
+
+
+
+ ^.*(public|protected|private)*.+interface\s+\w+.*
+ /**\n
+ * The interface ${name}.\n
+<#if element.typeParameters?has_content> * \n
+</#if>
+<#list element.typeParameters as typeParameter>
+ * @param <${typeParameter.name}> the type parameter\n
+</#list>
+ */
+
+
+ ^.*(public|protected|private)*.+enum\s+\w+.*
+ /**\n
+ * The enum ${name}.\n
+ */
+
+
+ ^.*(public|protected|private)*.+class\s+\w+.*
+ /**\n
+ * The type ${name}.\n
+<#if element.typeParameters?has_content> * \n
+</#if>
+<#list element.typeParameters as typeParameter>
+ * @param <${typeParameter.name}> the type parameter\n
+</#list>
+ */
+
+
+ .+
+ /**\n
+ * The type ${name}.\n
+ */
+
+
+
+
+ .+
+ /**\n
+ * Instantiates a new ${name}.\n
+<#if element.parameterList.parameters?has_content>
+ *\n
+</#if>
+<#list element.parameterList.parameters as parameter>
+ * @param ${parameter.name} the ${paramNames[parameter.name]}\n
+</#list>
+<#if element.throwsList.referenceElements?has_content>
+ *\n
+</#if>
+<#list element.throwsList.referenceElements as exception>
+ * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
+</#list>
+ */
+
+
+
+
+ ^.*(public|protected|private)*\s*.*(\w(\s*<.+>)*)+\s+get\w+\s*\(.*\).+
+ /**\n
+ * Gets ${partName}.\n
+<#if element.typeParameters?has_content> * \n
+</#if>
+<#list element.typeParameters as typeParameter>
+ * @param <${typeParameter.name}> the type parameter\n
+</#list>
+<#if element.parameterList.parameters?has_content>
+ *\n
+</#if>
+<#list element.parameterList.parameters as parameter>
+ * @param ${parameter.name} the ${paramNames[parameter.name]}\n
+</#list>
+<#if isNotVoid>
+ *\n
+ * @return the ${partName}\n
+</#if>
+<#if element.throwsList.referenceElements?has_content>
+ *\n
+</#if>
+<#list element.throwsList.referenceElements as exception>
+ * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
+</#list>
+ */
+
+
+ ^.*(public|protected|private)*\s*.*(void|\w(\s*<.+>)*)+\s+set\w+\s*\(.*\).+
+ /**\n
+ * Sets ${partName}.\n
+<#if element.typeParameters?has_content> * \n
+</#if>
+<#list element.typeParameters as typeParameter>
+ * @param <${typeParameter.name}> the type parameter\n
+</#list>
+<#if element.parameterList.parameters?has_content>
+ *\n
+</#if>
+<#list element.parameterList.parameters as parameter>
+ * @param ${parameter.name} the ${paramNames[parameter.name]}\n
+</#list>
+<#if isNotVoid>
+ *\n
+ * @return the ${partName}\n
+</#if>
+<#if element.throwsList.referenceElements?has_content>
+ *\n
+</#if>
+<#list element.throwsList.referenceElements as exception>
+ * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
+</#list>
+ */
+
+
+ ^.*((public\s+static)|(static\s+public))\s+void\s+main\s*\(\s*String\s*(\[\s*\]|\.\.\.)\s+\w+\s*\).+
+ /**\n
+ * The entry point of application.\n
+
+ <#if element.parameterList.parameters?has_content>
+ *\n
+</#if>
+ * @param ${element.parameterList.parameters[0].name} the input arguments\n
+<#if element.throwsList.referenceElements?has_content>
+ *\n
+</#if>
+<#list element.throwsList.referenceElements as exception>
+ * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
+</#list>
+ */
+
+
+ .+
+ /**\n
+ * ${name}<#if isNotVoid> ${return}</#if>.\n
+<#if element.typeParameters?has_content> * \n
+</#if>
+<#list element.typeParameters as typeParameter>
+ * @param <${typeParameter.name}> the type parameter\n
+</#list>
+<#if element.parameterList.parameters?has_content>
+ *\n
+</#if>
+<#list element.parameterList.parameters as parameter>
+ * @param ${parameter.name} the ${paramNames[parameter.name]}\n
+</#list>
+<#if isNotVoid>
+ *\n
+ * @return the ${return}\n
+</#if>
+<#if element.throwsList.referenceElements?has_content>
+ *\n
+</#if>
+<#list element.throwsList.referenceElements as exception>
+ * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
+</#list>
+ */
+
+
+
+
+ ^.*(public|protected|private)*.+static.*(\w\s\w)+.+
+ /**\n
+ * The constant ${element.getName()}.\n
+ */
+
+
+ ^.*(public|protected|private)*.*(\w\s\w)+.+
+ /**\n
+ <#if element.parent.isInterface()>
+ * The constant ${element.getName()}.\n
+<#else>
+ * The ${name}.\n
+</#if> */
+
+
+ .+
+ /**\n
+ <#if element.parent.isEnum()>
+ *${name} ${typeName}.\n
+<#else>
+ * The ${name}.\n
+</#if>*/
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
index f8467b4..031f228 100644
--- a/.idea/kotlinc.xml
+++ b/.idea/kotlinc.xml
@@ -1,6 +1,16 @@
+
+
+
+
+
+
+
+
+
+
-
+
\ 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 3d0bb47..c5c96e1 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,10 +1,17 @@
+
+
+
+
+
+
+
+
-
+
-
-
+
+
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..55adcb9
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/LICENSE.txt b/LICENSE.txt
index 194661d..e7f7d47 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,4 +1,4 @@
-Copyright 2021-2023 Erik C. Thauvin (erik@thauvin.net)
+Copyright 2021-2025 Erik C. Thauvin (erik@thauvin.net)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
diff --git a/README.md b/README.md
index ed92e08..d36883b 100644
--- a/README.md
+++ b/README.md
@@ -1,16 +1,17 @@
[](https://opensource.org/licenses/BSD-3-Clause)
-[](https://kotlinlang.org/)
-[](https://oss.sonatype.org/content/repositories/snapshots/net/thauvin/erik/cryptoprice/)
+[](https://kotlinlang.org/)
+[](https://rife2.com/bld)
[](https://github.com/ethauvin/cryptoprice/releases/latest)
[](https://central.sonatype.com/artifact/net.thauvin.erik/cryptoprice)
+[](https://oss.sonatype.org/content/repositories/snapshots/net/thauvin/erik/cryptoprice/)
[](https://sonarcloud.io/dashboard?id=ethauvin_cryptoprice)
-[](https://github.com/ethauvin/cryptoprice/actions/workflows/gradle.yml)
+[](https://github.com/ethauvin/cryptoprice/actions/workflows/bld.yml)
[](https://circleci.com/gh/ethauvin/cryptoprice/tree/master)
# Retrieve cryptocurrencies current (buy, sell or spot) prices
-A simple implementation of the prices [Coinbase Public API](https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-prices).
+A simple implementation of the prices [Coinbase Public API](https://docs.cdp.coinbase.com/coinbase-app/docs/api-prices).
## Examples (TL;DR)
@@ -29,11 +30,23 @@ val eth = buyPrice("LTC", "GBP") // Litecoin in Pound sterling
println(eth.amount)
```
- - View [Kotlin](https://github.com/ethauvin/cryptoprice/blob/master/examples/src/main/kotlin/com/example/CryptoPriceExample.kt) or [Java](https://github.com/ethauvin/cryptoprice/blob/master/examples/src/main/java/com/example/CryptoPriceSample.java) Examples.
+ - View [bld](https://github.com/ethauvin/cryptoprice/blob/master/examples/bld) or [Gradle](https://github.com/ethauvin/cryptoprice/blob/master/examples/gradle) Examples.
+
+### bld
+
+To use with [bld](https://rife2.com/bld), include the following dependency in your [build](https://github.com/ethauvin/cryptoprice/blob/master/examples/bld/src/bld/java/com/example/CryptoPriceExampleBuild.java) file:
+
+```java
+repositories = List.of(MAVEN_CENTRAL);
+
+scope(compile)
+ .include(dependency("net.thauvin.erik:cryptoprice:1.0.2"));
+```
+Be sure to use the [bld Kotlin extension](https://github.com/rife2/bld-kotlin) in your project.
### Gradle, Maven, etc.
-To use with [Gradle](https://gradle.org/), include the following dependency in your [build](https://github.com/ethauvin/cryptoprice/blob/master/examples/build.gradle.kts) file:
+To use with [Gradle](https://gradle.org/), include the following dependency in your [build](https://github.com/ethauvin/cryptoprice/blob/master/examples/gradle/build.gradle.kts) file:
```gradle
repositories {
@@ -42,7 +55,7 @@ repositories {
}
dependencies {
- implementation("net.thauvin.erik:cryptoprice:1.0.1")
+ implementation("net.thauvin.erik:cryptoprice:1.0.2")
}
```
@@ -81,7 +94,7 @@ A `CryptoPrice` object is returned defined as follows:
```kotlin
CryptoPrice(val base: String, val currency: String, val amount: BigDecimal)
```
-The parameter names match the [Coinbase API](https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-prices).
+The parameter names match the [Coinbase API](https://docs.cdp.coinbase.com/coinbase-app/docs/api-prices).
#### Format
@@ -110,7 +123,7 @@ println(price.toJson())
{"data":{"base":"BTC","currency":"USD","amount":"34567.89"}}
```
-The `data` object matches the [Coinbase API](https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-prices). To specify a different (or no) key, use:
+The `data` object matches the [Coinbase API](https://docs.cdp.coinbase.com/coinbase-app/docs/api-prices). To specify a different (or no) key, use:
```kotlin
println(price.toJson("bitcoin"))
@@ -133,7 +146,7 @@ val eth = """{"ether":{"base":"ETH","currency":"USD","amount":"2345.67"}}""".toP
### Extending
-A generic `apiCall()` function is available to access other [data API endpoints](https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-currencies). For example to retrieve the [exchange rates](https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates):
+A generic `apiCall()` function is available to access other [data API endpoints](https://docs.cdp.coinbase.com/coinbase-app/docs/api-currencies). For example to retrieve the [exchange rates](https://docs.cdp.coinbase.com/coinbase-app/docs/api-exchange-rates):
```kotlin
apiCall(listOf("exchange-rates"), mapOf("currency" to "usd"))
@@ -145,3 +158,22 @@ will return something like:
```
See the [examples](https://github.com/ethauvin/cryptoprice/blob/master/examples/) for more details.
+
+## 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/cryptoprice.git
+```
+
+Then use [bld](https://rife2.com/bld) to build:
+
+```console
+cd cryptoprice
+./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/baseline.xml b/baseline.xml
deleted file mode 100644
index c4d9ac8..0000000
--- a/baseline.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
- ThrowsCount:CryptoPrice.kt$CryptoPrice.Companion$ @JvmStatic @JvmOverloads @Throws(CryptoException::class, IOException::class) fun apiCall(paths: List<String>, params: Map<String, String> = emptyMap()): String
- ThrowsCount:CryptoPrice.kt$CryptoPrice.Companion$@JvmStatic @Throws(CryptoException::class) fun String.toPrice(): CryptoPrice
-
-
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..07e7ae2
--- /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.crypto.CryptoPriceBuild "$@"
\ No newline at end of file
diff --git a/bld.bat b/bld.bat
new file mode 100644
index 0000000..c55b623
--- /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.crypto.CryptoPriceBuild %*
\ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
deleted file mode 100644
index a4ae3cd..0000000
--- a/build.gradle.kts
+++ /dev/null
@@ -1,211 +0,0 @@
-import org.jetbrains.dokka.gradle.DokkaTask
-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("application")
- 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.3.1.3277"
- id("signing")
- kotlin("jvm") version "1.9.10"
-}
-
-defaultTasks(ApplicationPlugin.TASK_RUN_NAME)
-
-description = "Retrieve cryptocurrencies prices"
-group = "net.thauvin.erik"
-version = "1.0.1"
-
-val deployDir = "deploy"
-val gitHub = "ethauvin/$name"
-val mavenUrl = "https://github.com/$gitHub"
-val publicationName = "mavenJava"
-
-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("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
-
- implementation("com.squareup.okhttp3:okhttp:4.11.0")
- implementation("org.json:json:20230618")
-
- testImplementation(kotlin("test"))
- testImplementation("com.willowtreeapps.assertk:assertk-jvm:0.27.0")
-}
-
-application {
- mainClass.set("net.thauvin.erik.crypto.CryptoPrice")
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_11
- targetCompatibility = JavaVersion.VERSION_11
- withSourcesJar()
-}
-
-detekt {
- //toolVersion = "main-SNAPSHOT"
-}
-
-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")
-}
-
-tasks {
- named("run") {
- args = listOf("BTC","ETH","LTC")
- }
-
- withType {
- rejectVersionIf {
- isNonStable(candidate.version)
- }
- }
-
- withType().configureEach {
- kotlinOptions.jvmTarget = java.targetCompatibility.toString()
- }
-
- withType {
- testLogging {
- exceptionFormat = TestExceptionFormat.FULL
- events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
- }
- }
-
- withType().configureEach {
- this.jvmTarget = java.targetCompatibility.toString()
- }
-
- withType().configureEach {
- this.jvmTarget = java.targetCompatibility.toString()
- }
-
- withType {
- destination = file("$projectDir/pom.xml")
- }
-
- clean {
- doLast {
- project.delete(fileTree(deployDir))
- }
- }
-
- withType().configureEach {
- dokkaSourceSets {
- named("main") {
- moduleName.set("CryptoPrice")
- }
- }
- }
-
- val copyToDeploy by registering(Copy::class) {
- from(configurations.runtimeClasspath) {
- exclude("annotations-*.jar")
- }
- from(jar)
- into(deployDir)
- }
-
- register("deploy") {
- description = "Copies all needed files to the $deployDir directory."
- group = PublishingPlugin.PUBLISH_TASK_GROUP
- dependsOn(clean, wrapper, build, jar)
- outputs.dir(deployDir)
- inputs.files(copyToDeploy)
- mustRunAfter(clean)
- }
-}
-
-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/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..cb96006
--- /dev/null
+++ b/examples/bld/.idea/.name
@@ -0,0 +1 @@
+cryptoprice-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..c3d8915
--- /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..af4608e
--- /dev/null
+++ b/examples/bld/.idea/libraries/bld.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
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..d0c8b16
--- /dev/null
+++ b/examples/bld/.idea/misc.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
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..2b503e5
--- /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..30a8889
--- /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": "com.example.ExampleTest"
+ }
+ ]
+}
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..1475694
--- /dev/null
+++ b/examples/bld/README.md
@@ -0,0 +1,22 @@
+## Kotlin Example
+To compile & run the Kotlin example:
+
+```console
+./bld compile
+
+./bld run
+./bld run --args="btc"
+./bld run --args="eth eur"
+```
+
+## Java Example
+
+To compile & run the Java example:
+
+```console
+./bld compile
+
+./bld run-java
+./bld run-java --args="btc"
+./bld run-java --args="eth eur"
+```
diff --git a/examples/bld/bld b/examples/bld/bld
new file mode 100755
index 0000000..990ba40
--- /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 com.example.CryptoPriceExampleBuild "$@"
\ No newline at end of file
diff --git a/examples/bld/bld.bat b/examples/bld/bld.bat
new file mode 100644
index 0000000..1c1f800
--- /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 com.example.CryptoPriceExampleBuild %*
\ No newline at end of file
diff --git a/examples/bld/lib/bld/bld-wrapper.jar b/examples/bld/lib/bld/bld-wrapper.jar
new file mode 100644
index 0000000..ed508a4
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/com/example/CryptoPriceExampleBuild.java b/examples/bld/src/bld/java/com/example/CryptoPriceExampleBuild.java
new file mode 100644
index 0000000..ca79523
--- /dev/null
+++ b/examples/bld/src/bld/java/com/example/CryptoPriceExampleBuild.java
@@ -0,0 +1,53 @@
+package com.example;
+
+import rife.bld.BuildCommand;
+import rife.bld.extension.CompileKotlinOperation;
+import rife.bld.operations.RunOperation;
+import rife.bld.BaseProject;
+
+import java.util.List;
+
+import static rife.bld.dependencies.Repository.*;
+import static rife.bld.dependencies.Scope.compile;
+
+public class CryptoPriceExampleBuild extends BaseProject {
+ public CryptoPriceExampleBuild() {
+ pkg = "com.example";
+ name = "Example";
+ version = version(0, 1, 0);
+
+ mainClass = "com.example.CryptoPriceExampleKt";
+
+ javaRelease = 11;
+ downloadSources = true;
+
+ autoDownloadPurge = true;
+ repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, SONATYPE_SNAPSHOTS_LEGACY);
+
+ scope(compile)
+ .include(dependency("net.thauvin.erik", "cryptoprice", version(1, 0, 3, "SNAPSHOT")))
+ .include(dependency("org.json", "json", "20250107"));
+ }
+
+ public static void main(String[] args) {
+ new CryptoPriceExampleBuild().start(args);
+ }
+
+ @Override
+ public void compile() throws Exception {
+ new CompileKotlinOperation()
+ .fromProject(this)
+ .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("com.example.CryptoPriceSample")
+ .execute();
+ }
+}
diff --git a/examples/src/main/java/com/example/CryptoPriceSample.java b/examples/bld/src/main/java/com/example/CryptoPriceSample.java
similarity index 100%
rename from examples/src/main/java/com/example/CryptoPriceSample.java
rename to examples/bld/src/main/java/com/example/CryptoPriceSample.java
diff --git a/examples/src/main/kotlin/com/example/CryptoPriceExample.kt b/examples/bld/src/main/kotlin/com/example/CryptoPriceExample.kt
similarity index 97%
rename from examples/src/main/kotlin/com/example/CryptoPriceExample.kt
rename to examples/bld/src/main/kotlin/com/example/CryptoPriceExample.kt
index 4eb0a6c..6aa15fc 100644
--- a/examples/src/main/kotlin/com/example/CryptoPriceExample.kt
+++ b/examples/bld/src/main/kotlin/com/example/CryptoPriceExample.kt
@@ -41,7 +41,7 @@ fun main(args: Array) {
} catch (e: CryptoException) {
System.err.println("HTTP Status Code: ${e.statusCode}")
System.err.println("${e.message} (${e.id})")
- } catch (e: IllegalArgumentException) {
+ } catch (ignore: IllegalArgumentException) {
System.err.println("Could not display the specified currency: ${args[1]}")
} catch (e: IOException) {
System.err.println(e.message)
diff --git a/examples/.gitattributes b/examples/gradle/.gitattributes
similarity index 100%
rename from examples/.gitattributes
rename to examples/gradle/.gitattributes
diff --git a/examples/.gitignore b/examples/gradle/.gitignore
similarity index 95%
rename from examples/.gitignore
rename to examples/gradle/.gitignore
index 1b6985c..44369dd 100644
--- a/examples/.gitignore
+++ b/examples/gradle/.gitignore
@@ -3,3 +3,5 @@
# Ignore Gradle build output directory
build
+
+bin
diff --git a/examples/gradle/.idea/.gitignore b/examples/gradle/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/examples/gradle/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/examples/gradle/.idea/.name b/examples/gradle/.idea/.name
new file mode 100644
index 0000000..925a65b
--- /dev/null
+++ b/examples/gradle/.idea/.name
@@ -0,0 +1 @@
+cryptoprice-examples-gradle
\ No newline at end of file
diff --git a/examples/gradle/.idea/compiler.xml b/examples/gradle/.idea/compiler.xml
new file mode 100644
index 0000000..fb7f4a8
--- /dev/null
+++ b/examples/gradle/.idea/compiler.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/gradle/.idea/gradle.xml b/examples/gradle/.idea/gradle.xml
new file mode 100644
index 0000000..7d3b3e8
--- /dev/null
+++ b/examples/gradle/.idea/gradle.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/gradle/.idea/inspectionProfiles/Project_Default.xml b/examples/gradle/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..1e01b48
--- /dev/null
+++ b/examples/gradle/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/gradle/.idea/jarRepositories.xml b/examples/gradle/.idea/jarRepositories.xml
new file mode 100644
index 0000000..4e9cedf
--- /dev/null
+++ b/examples/gradle/.idea/jarRepositories.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/gradle/.idea/kotlinc.xml b/examples/gradle/.idea/kotlinc.xml
new file mode 100644
index 0000000..ae3f30a
--- /dev/null
+++ b/examples/gradle/.idea/kotlinc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/gradle/.idea/misc.xml b/examples/gradle/.idea/misc.xml
new file mode 100644
index 0000000..3ef1a84
--- /dev/null
+++ b/examples/gradle/.idea/misc.xml
@@ -0,0 +1,19 @@
+
+
+
+
+