Skip to content

Commit f28a352

Browse files
committed
Release 0.8.1
DynamicEnvironment supports accepting a String Signed-off-by: Gopal S Akshintala <[email protected]>
1 parent 8465cb0 commit f28a352

File tree

12 files changed

+55
-44
lines changed

12 files changed

+55
-44
lines changed

.idea/kotlinc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CONTRIBUTING.adoc

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,17 @@ It may be slow for the first run, but subsequent runs should be faster.
7070

7171
== Manual publishing
7272

73+
=== Gradle Nexus Publish Plugin
74+
75+
We use link:https://github.com/gradle-nexus/publish-plugin#publishing-to-maven-central-via-sonatype-central[Gradle Nexus Publish Plugin]
76+
to publish to Maven Central. Follow the usage instructions to set up Sonatype credentials and add them to your `~/.gradle/gradle.properties`.
77+
78+
[source,bash]
79+
----
80+
sonatypeUsername=<your-username>
81+
sonatypePassword=<your-password>
82+
----
83+
7384
=== Versioning Strategy
7485

7586
====
@@ -80,10 +91,12 @@ It may be slow for the first run, but subsequent runs should be faster.
8091
* B = Profit (Feature / Improvement)
8192
* C = Broke something by accident (Bug)
8293

83-
Follow the Versioning Strategy to increment version link:buildSrc/{sourcedir}/Config.kt[here]
94+
Follow the Versioning Strategy to increment version link:buildSrc/{sourcedir}/Config.kt[here].
95+
For SNAPSHOT releases, add a `-SNAPSHOT` at the end of version number
96+
97+
=== Publish
8498

85-
* For SNAPSHOT releases, add a `-SNAPSHOT` at the end of version number
86-
* Run this command to publish it to Nexus:
99+
Run this command to publish it to Nexus:
87100

88101
[source,bash]
89102
----

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ endif::[]
1818
:pmtemplates: src/integrationTest/resources/pm-templates
1919
:imagesdir: docs/images
2020
:prewrap!:
21-
:revoman-version: 0.8.0
21+
:revoman-version: 0.8.1
2222

2323
'''
2424

build.gradle.kts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,12 @@ kover { reports { total { html { onCheck = true } } } }
7171

7272
moshi { enableSealed = true }
7373

74-
nexusPublishing { this.repositories { sonatype { stagingProfileId = STAGING_PROFILE_ID } } }
74+
nexusPublishing {
75+
this.repositories {
76+
sonatype {
77+
stagingProfileId = STAGING_PROFILE_ID
78+
nexusUrl = uri("https://ossrh-staging-api.central.sonatype.com/service/local/")
79+
snapshotRepositoryUrl = uri("https://central.sonatype.com/repository/maven-snapshots/")
80+
}
81+
}
82+
}

buildSrc/src/main/kotlin/Config.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
* ************************************************************************************************
77
*/
88
const val GROUP_ID = "com.salesforce.revoman"
9-
const val VERSION = "0.8.0"
9+
const val VERSION = "0.8.1"
1010
const val ARTIFACT_ID = "revoman"
1111
const val STAGING_PROFILE_ID = "1ea0a23e61ba7d"

src/main/kotlin/com/salesforce/revoman/ReVoman.kt

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,7 @@ object ReVoman {
6363
kicks
6464
.fold(dynamicEnvironment to listOf<Rundown>()) { (accumulatedMutableEnv, rundowns), kick ->
6565
val rundown =
66-
revUp(
67-
kick.overrideDynamicEnvironments(
68-
kick.dynamicEnvironmentsFlattened(),
69-
accumulatedMutableEnv,
70-
)
71-
)
66+
revUp(kick.overrideDynamicEnvironment(kick.dynamicEnvironment() + accumulatedMutableEnv))
7267
val accumulatedRundowns = rundowns + rundown
7368
postExeHook.accept(rundown, accumulatedRundowns)
7469
rundown.mutableEnv.mutableEnvCopyWithValuesOfType<String>() to accumulatedRundowns
@@ -107,11 +102,7 @@ object ReVoman {
107102
kick.globalSkipTypes(),
108103
)
109104
val environment =
110-
mergeEnvs(
111-
kick.environmentPaths(),
112-
kick.environmentInputStreams(),
113-
kick.dynamicEnvironmentsFlattened(),
114-
)
105+
mergeEnvs(kick.environmentPaths(), kick.environmentInputStreams(), kick.dynamicEnvironment())
115106
val pm =
116107
PostmanSDK(moshiReVoman, kick.nodeModulesPath(), regexReplacer, environment.toMutableMap())
117108
val stepNameToReport =

src/main/kotlin/com/salesforce/revoman/input/config/KickDef.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,10 @@ internal interface KickDef {
3535

3636
fun environmentInputStreams(): List<InputStream>
3737

38-
fun dynamicEnvironments(): List<Map<String, String>>
38+
fun dynamicEnvironment(): Map<String, Any?>
3939

4040
fun nodeModulesPath(): String?
4141

42-
@Value.Derived
43-
fun dynamicEnvironmentsFlattened(): Map<String, String> =
44-
if (dynamicEnvironments().isEmpty()) emptyMap()
45-
else dynamicEnvironments().reduce { acc, map -> acc + map }
46-
4742
fun customDynamicVariableGenerators(): Map<String, CustomDynamicVariableGenerator>
4843

4944
@Value.Default fun haltOnAnyFailure(): Boolean = false

src/main/kotlin/com/salesforce/revoman/internal/json/MoshiReVoman.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ open class MoshiReVoman(builder: Moshi.Builder) {
106106
fun jsonToObjToPrettyJson(input: String?, serializeNulls: Boolean = false): String? =
107107
input?.let { toPrettyJson(fromJson(it), serializeNulls) }
108108

109+
fun anyToString(value: Any?): String =
110+
when (value) {
111+
is String -> value
112+
// * NOTE 08 Mar 2025 gopala.akshintala: To be consistent with Postman app behavior
113+
null -> "null"
114+
else -> toJson(value)
115+
}
116+
109117
companion object {
110118
@Synchronized
111119
@JvmOverloads

src/main/kotlin/com/salesforce/revoman/internal/postman/PostmanSDK.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ class PostmanSDK(
5151
@Suppress("unused") fun xml2Json(xml: String): Any?
5252
}
5353

54+
internal fun getAsString(key: String): String = moshiReVoman.anyToString(environment[key])
55+
5456
inner class JSEvaluator(nodeModulesPath: String? = null) {
5557
private val jsContext: Context
5658
private var imports = ""

src/main/kotlin/com/salesforce/revoman/internal/postman/RegexReplacer.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ class RegexReplacer(
4444
value ->
4545
pm.environment[variableKey] = value
4646
}
47-
?: (if (pm.environment[variableKey] is String)
48-
replaceVariablesRecursively(pm.environment[variableKey] as String, pm)
49-
else pm.environment[variableKey].toString())
50-
?.also { value -> pm.environment[variableKey] = value }
47+
?: replaceVariablesRecursively(pm.getAsString(variableKey), pm)?.also { value ->
48+
pm.environment[variableKey] = value
49+
}
5150
?: matchResult.value
5251
}
5352
}

0 commit comments

Comments
 (0)