Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gboissinot committed Feb 3, 2013
1 parent 33013c9 commit 0537bc3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
5 changes: 3 additions & 2 deletions pom.xml
@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -38,7 +39,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<envinject.lib.version>1.14</envinject.lib.version>
<envinject.lib.version>1.15</envinject.lib.version>
<ivy.plugin.version>1.21</ivy.plugin.version>
</properties>

Expand Down
Expand Up @@ -39,6 +39,9 @@ public void buildVariablesFor(AbstractBuild build, Map<String, String> variables
for (ParameterValue p : parameters) {
String key = p.getName();
Map<String, String> injectedEnvVars = envInjectAction.getEnvMap();
if (injectedEnvVars == null) {
return;
}

//---INPUTS
//GLOBAL envVars, parameters envVars, injectedEnvVars (with global)
Expand Down
Expand Up @@ -22,6 +22,9 @@ public Object getTarget() {

public void buildEnvVars(AbstractBuild<?, ?> build, EnvVars env) {
EnvInjectVarList varList = (EnvInjectVarList) getTarget();
env.putAll(varList.getEnvMap());
Map<String, String> envMap = varList.getEnvMap();
if (envMap != null) {
env.putAll(envMap);
}
}
}
Expand Up @@ -22,7 +22,9 @@ public class EnvInjectVarList implements Serializable {
private Map<String, String> envVars = new TreeMap<String, String>();

public EnvInjectVarList(Map<String, String> envMap) {
this.envVars.putAll(envMap);
if (envMap != null) {
this.envVars.putAll(envMap);
}
}

@SuppressWarnings("unused")
Expand Down Expand Up @@ -89,7 +91,6 @@ private void doExportHeaders(StaplerRequest request, StaplerResponse response) t
}

writeTextResponse(response);
return;
}


Expand All @@ -116,7 +117,7 @@ private void writeJsonResponse(StaplerResponse response) throws IOException {
response.setContentType("application/json");
ServletOutputStream outputStream = response.getOutputStream();
outputStream.write("{\"envVars\": { \"envVar\":[".getBytes());
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, String> entry : envVars.entrySet()) {
sb.append(String.format(", {\"name\":\"%s\", \"value\":\"%s\"}", entry.getKey(), entry.getValue()));
}
Expand Down

0 comments on commit 0537bc3

Please sign in to comment.