Skip to content

Commit 0594ba3

Browse files
committed
Add initial project
1 parent 2500b69 commit 0594ba3

File tree

14 files changed

+785
-2
lines changed

14 files changed

+785
-2
lines changed

.github/workflows/build.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Set $VERSION variable
16+
id: version
17+
run: |
18+
echo ::set-output name=VERSION::$(echo $(GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} gh release list --repo $GITHUB_REPOSITORY | cut -f 1 | head -n 1))
19+
20+
- uses: actions/checkout@v2
21+
22+
- name: Set up JDK 1.8
23+
uses: actions/setup-java@v1
24+
with:
25+
java-version: 1.8
26+
27+
- name: Cache Gradle packages
28+
uses: actions/cache@v2
29+
with:
30+
path: ~/.gradle/caches
31+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
32+
restore-keys: ${{ runner.os }}-gradle
33+
34+
- name: Build with Gradle
35+
env:
36+
VERSION: ${{ steps.version.outputs.VERSION }}
37+
run: |
38+
chmod +x gradlew
39+
./gradlew -Pversion=$VERSION build
40+
41+
# - uses: actions/upload-artifact@v2
42+
# with:
43+
# name: Package
44+
# path: build/libs

.github/workflows/publish.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: publish
2+
on:
3+
release:
4+
types: [created]
5+
jobs:
6+
publish:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
11+
- name: Set up Java
12+
uses: actions/setup-java@v1
13+
with:
14+
java-version: 1.8
15+
16+
- name: Set $VERSION variable
17+
id: version
18+
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
19+
20+
- name: Publish to GitHub Packages
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
VERSION: ${{ steps.version.outputs.VERSION }}
24+
run: gradle -Pversion=$VERSION publish
25+
26+
- name: Publish to Bintray
27+
env:
28+
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
29+
BINTRAY_APIKEY: ${{ secrets.BINTRAY_APIKEY }}
30+
VERSION: ${{ steps.version.outputs.VERSION }}
31+
run: |
32+
chmod +x gradlew
33+
./gradlew bintrayUpload -Pversion=$VERSION

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Compiled class file
22
*.class
3+
.idea/
4+
build/
5+
.gradle/
6+
.gistrun/
37

48
# Log file
59
*.log
@@ -21,3 +25,5 @@
2125

2226
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
2327
hs_err_pid*
28+
29+
!gradle/wrapper/gradle-wrapper.jar

LICENSE

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Copyright (c) 2007-present, Demis Bellot, ServiceStack, Inc.
2+
https://servicestack.net
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above copyright
10+
notice, this list of conditions and the following disclaimer in the
11+
documentation and/or other materials provided with the distribution.
12+
* Neither the name of the ServiceStack nor the
13+
names of its contributors may be used to endorse or promote products
14+
derived from this software without specific prior written permission.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
20+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 86 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,86 @@
1-
# gistcafe-kotlin
2-
gist.cafe utils for Kotlin
1+
Useful utils for [gist.cafe](https://gist.cafe) Kotlin Apps.
2+
3+
## Usage
4+
5+
Simple usage example:
6+
7+
```kotlin
8+
import com.google.gson.Gson
9+
import com.google.gson.annotations.SerializedName
10+
import java.net.URL
11+
12+
data class GithubRepo(
13+
val name: String,
14+
val description: String = "",
15+
val homepage: String = "",
16+
@SerializedName("language") val lang: String = "",
17+
val watchers: Int,
18+
val forks: Int)
19+
20+
fun main(args: Array<String>) {
21+
val orgName = "Kotlin"
22+
23+
val json = URL("https://api.github.com/orgs/$orgName/repos").readText()
24+
val orgRepos = Gson().fromJson<List<GithubRepo>>(json)
25+
.sortedByDescending { it.watchers }
26+
27+
println("Top 3 $orgName GitHub Repos:")
28+
Inspect.printDump(orgRepos.take(3))
29+
30+
println("\nTop 10 $orgName GitHub Repos:")
31+
Inspect.printDumpTable(orgRepos.take(10), listOf("name","language","watchers","forks"))
32+
33+
Inspect.vars(mapOf("orgRepos" to orgRepos))
34+
}
35+
```
36+
37+
Which outputs:
38+
39+
```
40+
Top 3 Kotlin GitHub Repos:
41+
[
42+
{
43+
name: anko,
44+
description: Pleasant Android application development,
45+
homepage: ,
46+
language: Kotlin,
47+
watchers: 15892,
48+
forks: 1281
49+
},
50+
{
51+
name: kotlinx.coroutines,
52+
description: Library support for Kotlin coroutines ,
53+
homepage: ,
54+
language: Kotlin,
55+
watchers: 8684,
56+
forks: 1228
57+
},
58+
{
59+
name: kotlin-examples,
60+
description: Various examples for Kotlin,
61+
language: Kotlin,
62+
watchers: 2892,
63+
forks: 1056
64+
}
65+
]
66+
67+
Top 10 Kotlin GitHub Repos:
68+
+--------------------------------------------------------+
69+
| name | language | watchers | forks |
70+
|--------------------------------------------------------|
71+
| anko | Kotlin | 15892 | 1281 |
72+
| kotlinx.coroutines | Kotlin | 8684 | 1228 |
73+
| kotlin-examples | Kotlin | 2892 | 1056 |
74+
| kotlinx.serialization | Kotlin | 2697 | 287 |
75+
| kotlin-koans | Kotlin | 2559 | 1504 |
76+
| KEEP | | 1953 | 215 |
77+
| dokka | Kotlin | 1839 | 194 |
78+
| coroutines-examples | | 1259 | 149 |
79+
| kotlin-fullstack-sample | Kotlin | 1185 | 165 |
80+
| kotlinx.html | Kotlin | 1074 | 97 |
81+
+--------------------------------------------------------+
82+
```
83+
84+
## Features and bugs
85+
86+
Please file feature requests and bugs at the [issue tracker](https://github.com/ServiceStack/gistcafe-kotlin/issues).

build.gradle.kts

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
plugins {
2+
kotlin("jvm") version "1.4.21"
3+
java
4+
`maven-publish`
5+
id("com.jfrog.bintray") version "1.8.0"
6+
}
7+
8+
val artifactId = "gistcafe"
9+
val repoName = "ServiceStack/gistcafe-kotlin"
10+
val repoUrl = "https://github.com/$repoName"
11+
val orgName = "ServiceStack"
12+
val shortDesc = "gist.cafe utils for Kotlin"
13+
val artifactVersion = version.toString()
14+
15+
repositories {
16+
jcenter()
17+
}
18+
19+
val sourcesJar by tasks.creating(Jar::class) {
20+
archiveClassifier.set("sources")
21+
from(sourceSets.getByName("main").allSource)
22+
}
23+
24+
publishing {
25+
publications {
26+
register("gpr", MavenPublication::class) {
27+
from(components["java"])
28+
29+
artifact(sourcesJar)
30+
31+
pom {
32+
name.set(artifactId)
33+
description.set(shortDesc)
34+
url.set("https://github.com/$repoName")
35+
licenses {
36+
license {
37+
name.set("The 3-Clause BSD License")
38+
url.set("https://opensource.org/licenses/BSD-3-Clause")
39+
}
40+
}
41+
developers {
42+
developer {
43+
id.set(orgName)
44+
name.set("$orgName, Inc.")
45+
email.set("[email protected]")
46+
}
47+
}
48+
scm {
49+
connection.set("scm:git:git://github.com/$repoName.git")
50+
developerConnection.set("scm:git:ssh://github.com/$repoName.git")
51+
url.set(repoUrl)
52+
}
53+
}
54+
}
55+
}
56+
57+
repositories {
58+
maven {
59+
name = "GitHubPackages"
60+
url = uri("https://maven.pkg.github.com/servicestack/gistcafe-kotlin")
61+
credentials {
62+
username = System.getenv("GITHUB_ACTOR")
63+
password = System.getenv("GITHUB_TOKEN")
64+
}
65+
}
66+
}
67+
}
68+
69+
bintray {
70+
user = System.getenv("BINTRAY_USER")
71+
key = System.getenv("BINTRAY_APIKEY")
72+
publish = true
73+
setPublications(artifactId)
74+
pkg.apply {
75+
repo = "maven"
76+
name = artifactId
77+
userOrg = "mythz"
78+
websiteUrl = "https://gist.cafe"
79+
githubRepo = repoName
80+
vcsUrl = "https://github.com/$repoName"
81+
description = shortDesc
82+
setLabels("kotlin")
83+
setLicenses("BSD")
84+
desc = shortDesc
85+
86+
version.apply {
87+
name = artifactVersion
88+
desc = repoUrl
89+
vcsTag = artifactVersion
90+
}
91+
}
92+
}
93+
94+
tasks.test {
95+
useJUnitPlatform()
96+
}
97+
98+
dependencies {
99+
implementation(kotlin("stdlib"))
100+
implementation("com.google.code.gson:gson:2.8.6")
101+
testImplementation(platform("org.junit:junit-bom:5.7.0"))
102+
testImplementation("org.junit.jupiter:junit-jupiter")
103+
}

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
group=net.servicestack
2+
version=0.0.1-SNAPSHOT

gradle/wrapper/gradle-wrapper.jar

57.8 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)