Skip to content

Commit

Permalink
Began moving from Maven to Gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-McFarlin committed Oct 11, 2018
1 parent f9d4dbc commit ac6e25e
Show file tree
Hide file tree
Showing 17 changed files with 498 additions and 167 deletions.
104 changes: 77 additions & 27 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,66 @@
# Created by https://www.gitignore.io/api/java,maven,intellij
# Created by https://www.gitignore.io/api/git,java,gradle,intellij

### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig

# Created by git when using merge tools for conflicts
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.REMOTE.*
*_BACKUP_*.txt
*_BASE_*.txt
*_LOCAL_*.txt
*_REMOTE_*.txt

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

.idea/
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# 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
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules

# CMake
cmake-build-debug/
cmake-build-*/

# Mongo Explorer plugin:
# Mongo Explorer plugin
.idea/**/mongoSettings.xml

## File-based project format:
# File-based project format
*.iws

## Plugin-specific files:

# IntelliJ
/out/
out/

# mpeltonen/sbt-idea plugin
.idea_modules/
Expand All @@ -29,15 +71,18 @@ atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml

# Ruby plugin and RubyMine
/.rakeTasks

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

Expand Down Expand Up @@ -65,6 +110,7 @@ fabric.properties
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
Expand All @@ -73,18 +119,22 @@ fabric.properties
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

### Maven ###
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties

# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
!/.mvn/wrapper/maven-wrapper.jar

# End of https://www.gitignore.io/api/java,maven,intellij
### Gradle ###
.gradle
/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Cache of project
.gradletasknamecache

# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties


# End of https://www.gitignore.io/api/git,java,gradle,intellij
/target/
9 changes: 9 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/modules/CryptoCompareAPI_main.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions .idea/modules/CryptoCompareAPI_test.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 6 additions & 18 deletions CryptoCompareAPI.iml
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Python" name="Python">
<configuration sdkName="Python 3.5.4 (~/anaconda3/envs/IDEAPy/bin/python)" />
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<module external.linked.project.id="CryptoCompareAPI" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="me.joshmcfarlin" external.system.module.version="1.1" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/out" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Python 3.5.4 (~/anaconda3/envs/IDEAPy/bin/python) interpreter library" level="application" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.0.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.0.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.0.2" level="project" />
</component>
</module>
32 changes: 18 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# CryptoCompareAPI
Java implementation of CryptoCompare API service
A Java implementation of the [CryptoCompare API service.](https://min-api.cryptocompare.com/)

## Installation
Maven:
Expand All @@ -13,24 +13,28 @@ Maven:

## Usage
```java
double dayAverage = Market.getDayAverage("BTC", "USD");
System.out.println("Bitcoin day average:");
System.out.println(dayAverage);

Market.ExchangeAverage exchangeAverage = Market.getExchangeAverage("BTC", "USD", "Coinbase", "Kraken", "Bitstamp");
System.out.println("Bitcoin average from Coinbase, Kraken, and Bitstamp:");
System.out.println(exchangeAverage.high24Hour);

Map<String, Double> btcPrice = Market.getPrice("BTC", "USD", "EUR");
System.out.println("Bitcoin price in USD and EUR:");
System.out.println(btcPrice);
public class Test {
public static void main(String[] args) {
double dayAverage = Market.getDayAverage("BTC", "USD");
System.out.println("Bitcoin day average:");
System.out.println(dayAverage);

Market.ExchangeAverage exchangeAverage = Market.getExchangeAverage("BTC", "USD", "Coinbase", "Kraken", "Bitstamp");
System.out.println("Bitcoin average from Coinbase, Kraken, and Bitstamp:");
System.out.println(exchangeAverage.high24Hour);

Map<String, Double> btcPrice = Market.getPrice("BTC", "USD", "EUR");
System.out.println("Bitcoin price in USD and EUR:");
System.out.println(btcPrice);
}
}
```

An example is provided in the Maven test sources.

## Documentation

Documentation is provided at [http://joshmcfarlin.me/CryptoCompareAPI/](http://joshmcfarlin.me/CryptoCompareAPI/)
Documentation is provided at [https://joshmcfarlin.me/CryptoCompareAPI/](https://joshmcfarlin.me/CryptoCompareAPI/)

## License
This project is developed under the MIT license. This license can be found at [LICENSE](LICENSE).
This project is developed under the MIT license. This can be found at [LICENSE](LICENSE).
30 changes: 30 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apply plugin: 'java'

group = 'me.joshmcfarlin'
version = '1.1'

description = """A Java implementation of the CryptoCompare API service."""

sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

configurations.all {
}

repositories {
mavenCentral()
}

dependencies {
implementation 'com.google.code.gson:gson:2.8.5'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.1.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.1.0'
}

test {
useJUnit()
maxHeapSize = '1G'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
def format_collection(collection):
for line in collection.splitlines():
if len(line) != 0:
var_type, var_name = line.rsplit(' ', 1)
var_name = var_name.replace(';', '')
print("/**\n *\n */")
print("@SerializedName(\"" + var_name + "\")")
print(var_type + ' ' + var_name[0].lower() + var_name[1:] + ';')
else:
print()


coll = """
public String Description;
public String Features;
public String Technology;
public Double TotalCoinSupply;
public String Algorithm;
public String ProofType;
public String StartDate;
public String Twitter;
public String AffiliateUrl;
public String Website;
public Sponsor sponsor;
public int LastBlockExplorerUpdateTS;
public String DifficultyAdjustment;
public String BlockRewardReduction;
public int BlockNumber;
public double BlockTime;
public double NetHashesPerSecond;
public double TotalCoinsMined;
public double PreviousTotalCoinsMined;
public double BlockReward;
public String TextTop;
public String Link;
public String ImageUrl;
"""

format_collection(coll)
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit ac6e25e

Please sign in to comment.