Skip to content

Commit 376d296

Browse files
authored
Release 0.0.4.3 (#22)
* introduce JacocoCoverageRule (#6) * introduce JacocoCoverageRule * add JacocoCoverageRuleTest * support all nested objects * improve test coverage * add more tests * make issue levels take text (#8) * config bintray * convert the Rule to abstract class (#7) * convert the Rule to abstract class * fix push.gradle * auto release (#9) * auto release * add release task to circle ci * add ci and pullRequest to Rule (#10) * add ci and pullRequest to Rule * fix test * exclude some authors from protected files rule (#11) * jacoco total coverage (#12) * introduce Github-enterprise (#15) * Unify dependencies versions by applying buildSrc (#14) * Making unify dependencies versions feature by applying buildSrc mechanism and Gradle DSL then change all the build.gradle.kts files of all the modules we have to be use the new kotlin class that I made. Since four classes are made : 1. Dependencies : that contains all the dependencies we will use. 2. MainApp : that contains the common things of the whole app. 3. MainClass : that contains the main classes of each module. 4. Projects : that contains the name of projects/modules we have tell now. 5. Versions : that contains the versions that we will use in Dependencies class. * Modify Naming of buildSrc files - Projects file renamed to Modules to be more meaningful. - MainApp file renamed to Project to be more specific. * fix file url for enterprise (#18) * fix file url for enterprise * fix file path by using filePath instead of class path * add UTs * update comment (#19) * update comment * fix parsing * make use of another github token * release 0.0.4 * support teamcity (#21)
1 parent e070d70 commit 376d296

File tree

6 files changed

+33
-19
lines changed

6 files changed

+33
-19
lines changed

ci-detector/src/main/java/io/github/tarek360/ci/Ci.kt

+1-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@ package io.github.tarek360.ci
33
abstract class Ci {
44

55
open val gitHostToken: String? by lazy {
6-
val token = Environment.getVariable("KOSHRY_GIT_HOST_TOKEN")
7-
if (token.isNullOrBlank()) {
8-
Environment.getVariable("DANGER_GITHUB_API_TOKEN")
9-
} else {
10-
token
11-
}
6+
Environment.getVariable("KOSHRY_GIT_HOST_TOKEN")
127
}
138

149
abstract val buildId: Int?
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package io.github.tarek360.ci
2+
3+
class TeamCityCi : Ci() {
4+
5+
override val buildId: Int? by lazy {
6+
val buildId: String? = Environment.getVariable("TEAMCITY_BUILD_ID")
7+
buildId?.toInt()
8+
}
9+
10+
override val projectOwnerNameRepoName: String? by lazy {
11+
Environment.getVariable("GITHUB_REPO_SLUG")
12+
}
13+
14+
override val pullRequestId: Int? by lazy {
15+
val teamcityBuildBranch =
16+
Environment.getVariable("TEAMCITY_BUILD_BRANCH")?.split("/")
17+
val id = teamcityBuildBranch?.get(0)
18+
id?.toInt()
19+
}
20+
}

githost/src/main/java/io/github/tarek360/githost/github/GitHub.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class GitHub(private val gitHostInfo: GitHostInfo, isEnterprise: Boolean = false
1818
// if it's not mocked web server
1919
if (baseUrl.isEmpty()) {
2020
baseUrl = if (isEnterprise) {
21-
"https://${gitHostInfo.domain}/api/v3"
21+
"https://${gitHostInfo.domain}/api/v3/"
2222
} else {
2323
"https://api.github.com/"
2424
}

githost/src/test/kotlin/io/github/tarek360/githost/github/GitHubTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class GitHubTest {
3535
val gitHostInfo = GitHostInfo("github.enterprise-company.com", "tarek360/RichPath", 1, "abcd1234")
3636
GitHub(gitHostInfo, true)
3737

38-
baseUrl mustEqual "https://github.enterprise-company.com/api/v3"
38+
baseUrl mustEqual "https://github.enterprise-company.com/api/v3/"
3939
}
4040

4141
@After

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ org.gradle.jvmargs=-Xmx1536m
1212
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1313
# org.gradle.parallel=true
1414
GROUP_ID=io.github.tarek360.koshry
15-
VERSION=0.0.4
15+
VERSION=0.0.4.3
1616
BUILD_NUMBER=0
1717
DESCRIPTION=Koshry for CI
1818
BINTRAY_REPO=Koshry

koshry/src/main/java/io/github/tarek360/koshry/CiProvider.kt

+9-10
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@ package io.github.tarek360.koshry
33
import io.github.tarek360.ci.Ci
44
import io.github.tarek360.ci.CircleCi
55
import io.github.tarek360.ci.Environment
6+
import io.github.tarek360.ci.TeamCityCi
67
import io.github.tarek360.ci.TravisCi
78

89
class CiProvider {
910

10-
fun provide(): Ci? {
11-
return when {
12-
Environment.getVariable("TRAVIS") == "true" -> TravisCi()
13-
Environment.getVariable("CIRCLECI") == "true" -> CircleCi()
14-
else -> null
11+
fun provide(): Ci? {
12+
return when {
13+
Environment.getVariable("TRAVIS") == "true" -> TravisCi()
14+
Environment.getVariable("CIRCLECI") == "true" -> CircleCi()
15+
Environment.getVariable("TEAMCITY_BUILD_ID")?.isNotBlank() == true -> TeamCityCi()
16+
else -> null
17+
}
1518
}
16-
17-
}
18-
19-
20-
}
19+
}

0 commit comments

Comments
 (0)