Skip to content

Commit

Permalink
Merge pull request #26 from neva-dev/props-array-access
Browse files Browse the repository at this point in the history
Props extension property access + alias
  • Loading branch information
Krystian Panek authored Nov 18, 2019
2 parents 15fdf55 + 48c1931 commit 40beac2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
5 changes: 4 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ tasks {
}

named("afterReleaseBuild") {
dependsOn("bintrayUpload", "publishPlugins", "githubRelease")
dependsOn("bintrayUpload", "publishPlugins")
}
named("release") {
finalizedBy("githubRelease")
}
named("updateVersion") {
enabled = false
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=4.0.0
version=4.0.1
kotlin.version=1.3.50
dokka.version=0.9.18
detekt.version=1.0.1
6 changes: 5 additions & 1 deletion src/main/kotlin/com/neva/gradle/fork/PropsExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ open class PropsExtension(private val project: Project) {

internal val encryptor = Encryption.of(project)

fun get(name: String): String? {
fun named(name: String): String? {
val value = project.findProperty(name)?.toString()
if (value.isNullOrBlank()) {
return value
Expand All @@ -16,8 +16,12 @@ open class PropsExtension(private val project: Project) {
return encryptor.decrypt(value)
}

operator fun get(name: String) = named(name)

companion object {

const val NAME = "props"

const val ALIAS = "forkProps"
}
}
5 changes: 4 additions & 1 deletion src/main/kotlin/com/neva/gradle/fork/PropsPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ open class PropsPlugin : Plugin<Project> {

override fun apply(project: Project) {
with(project) {
extensions.create(PropsExtension.NAME, PropsExtension::class.java, project)
PropsExtension(project).apply {
extensions.add(PropsExtension.NAME, this)
extensions.add(PropsExtension.ALIAS, this)
}
}
}
}

0 comments on commit 40beac2

Please sign in to comment.