Skip to content

Commit 976b402

Browse files
authored
Merge pull request #162 from adamint/dev
switch to teamcity
2 parents 7a37098 + c23c8db commit 976b402

File tree

9 files changed

+27
-168
lines changed

9 files changed

+27
-168
lines changed

.circleci/config.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,4 @@ gradle-app.setting
125125
**/build/
126126

127127
# End of https://www.gitignore.io/api/gradle,kotlin,intellij
128-
/.idea/
128+
/.idea/

build.gradle.kts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,6 @@ tasks.getByName<KotlinJsCompile>("compileKotlinJs") {
108108
}
109109
}
110110
tasks.named<Test>("jvmTest") {
111-
systemProperty("clientId", System.getProperty("clientId"))
112-
systemProperty("clientSecret", System.getProperty("clientSecret"))
113-
systemProperty("spotifyRedirectUri", System.getProperty("spotifyRedirectUri"))
114-
systemProperty("spotifyTokenString", System.getProperty("spotifyTokenString"))
115-
116111
useJUnitPlatform()
117112
}
118113

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#Sun Nov 17 20:55:43 EST 2019
2+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-all.zip
13
distributionBase=GRADLE_USER_HOME
24
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip
4-
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6+
zipStoreBase=GRADLE_USER_HOME

gradlew.bat

Lines changed: 0 additions & 100 deletions
This file was deleted.

src/commonMain/kotlin/com.adamratzman.spotify/Builder.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ class SpotifyClientApiBuilder(
306306
} catch (e: CancellationException) {
307307
throw e
308308
} catch (e: Exception) {
309-
throw SpotifyException.AuthenticationException("Invalid credentials provided in the login process", e)
309+
throw SpotifyException.AuthenticationException("Invalid credentials provided in the login process (clientId=$clientId, clientSecret=$clientSecret, authCode=${authorization.authorizationCode})", e)
310310
}
311311
authorization.token != null -> SpotifyClientApi(
312312
clientId,
@@ -424,7 +424,7 @@ class SpotifyAppApiBuilder(
424424
} catch (e: CancellationException) {
425425
throw e
426426
} catch (e: Exception) {
427-
throw SpotifyException.AuthenticationException("Invalid credentials provided in the login process", e)
427+
throw SpotifyException.AuthenticationException("Invalid credentials provided in the login process (clientId=$clientId, clientSecret=$clientSecret)", e)
428428
}
429429
}
430430
}

src/commonTest/kotlin/com.adamratzman/spotify/Common.kt

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,29 @@
22
package com.adamratzman.spotify
33

44
val api = when {
5-
getEnvironmentVariable("spotifyRedirectUri")?.isNotBlank() != true -> {
5+
getEnvironmentVariable("SPOTIFY_REDIRECT_URI")?.isNotBlank() != true -> {
6+
println("CLIENT ID: ${getEnvironmentVariable("SPOTIFY_CLIENT_ID")}")
7+
println("CLIENT SECRET: ${getEnvironmentVariable("SPOTIFY_CLIENT_SECRET")}")
68
spotifyAppApi {
79
credentials {
8-
clientId = getEnvironmentVariable("clientId")
9-
clientSecret = getEnvironmentVariable("clientSecret")
10+
clientId = getEnvironmentVariable("SPOTIFY_CLIENT_ID")
11+
clientSecret = getEnvironmentVariable("SPOTIFY_CLIENT_SECRET")
1012
}
1113
}.build()
1214
}
1315
else -> {
16+
println("CLIENT ID: ${getEnvironmentVariable("SPOTIFY_CLIENT_ID")}")
17+
println("CLIENT SECRET: ${getEnvironmentVariable("SPOTIFY_CLIENT_SECRET")}")
18+
println("REDIRECT URI: ${getEnvironmentVariable("SPOTIFY_REDIRECT_URI")}")
19+
println("TOKEN: ${getEnvironmentVariable("SPOTIFY_TOKEN_STRING")}")
1420
spotifyClientApi {
1521
credentials {
16-
clientId = getEnvironmentVariable("clientId")
17-
clientSecret = getEnvironmentVariable("clientSecret")
18-
redirectUri = getEnvironmentVariable("spotifyRedirectUri")
22+
clientId = getEnvironmentVariable("SPOTIFY_CLIENT_ID")
23+
clientSecret = getEnvironmentVariable("SPOTIFY_CLIENT_SECRET")
24+
redirectUri = getEnvironmentVariable("SPOTIFY_REDIRECT_URI")
1925
}
2026
authorization {
21-
tokenString = getEnvironmentVariable("spotifyTokenString")
27+
tokenString = getEnvironmentVariable("SPOTIFY_TOKEN_STRING")
2228
}
2329
}.build()
2430
}

src/commonTest/kotlin/com.adamratzman/spotify/utilities/UtilityTests.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class UtilityTests : Spek({
2222
assertFailsWith<IllegalArgumentException> {
2323
spotifyClientApi {
2424
credentials {
25-
clientId = getEnvironmentVariable("clientId")
25+
clientId = getEnvironmentVariable("SPOTIFY_CLIENT_ID")
2626
}
2727
}.build()
2828
}
@@ -34,8 +34,8 @@ class UtilityTests : Spek({
3434
assertFailsWith<IllegalArgumentException> {
3535
spotifyClientApi {
3636
credentials {
37-
clientId = getEnvironmentVariable("clientId")
38-
clientSecret = getEnvironmentVariable("clientSecret")
37+
clientId = getEnvironmentVariable("SPOTIFY_CLIENT_ID")
38+
clientSecret = getEnvironmentVariable("SPOTIFY_CLIENT_SECRET")
3939
}
4040
}.build()
4141
}
@@ -45,8 +45,8 @@ class UtilityTests : Spek({
4545
it("App API valid parameters") {
4646
val api = spotifyAppApi {
4747
credentials {
48-
clientId = getEnvironmentVariable("clientId")
49-
clientSecret = getEnvironmentVariable("clientSecret")
48+
clientId = getEnvironmentVariable("SPOTIFY_CLIENT_ID")
49+
clientSecret = getEnvironmentVariable("SPOTIFY_CLIENT_SECRET")
5050
}
5151
}
5252
api.build()
@@ -56,8 +56,8 @@ class UtilityTests : Spek({
5656
it("Refresh on invalid token") {
5757
val api = spotifyAppApi {
5858
credentials {
59-
clientId = getEnvironmentVariable("clientId")
60-
clientSecret = getEnvironmentVariable("clientSecret")
59+
clientId = getEnvironmentVariable("SPOTIFY_CLIENT_ID")
60+
clientSecret = getEnvironmentVariable("SPOTIFY_CLIENT_SECRET")
6161
}
6262
}.build()
6363
}

src/jvmTest/kotlin/com/adamratzman/spotify/CommonImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
package com.adamratzman.spotify
33

44
actual fun getEnvironmentVariable(name: String): String? {
5-
return System.getProperty(name) ?: System.getenv(name)
5+
return System.getenv(name) ?: System.getProperty(name)
66
}

0 commit comments

Comments
 (0)