提交 63069527 编写于 作者: D Daniel Beck

Merge pull request #1887 from daspilker/with-plugin

allow @WithPlugin to install multiple plugins
......@@ -38,7 +38,7 @@ import java.lang.annotation.Target;
import java.net.URL;
/**
* Installs the specified plugin before launching Hudson.
* Installs the specified plugins before launching Jenkins.
*
* @author Kohsuke Kawaguchi
*/
......@@ -49,14 +49,14 @@ import java.net.URL;
@Retention(RUNTIME)
public @interface WithPlugin {
/**
* Name of the plugin.
* Name of the plugins.
*
* For now, this has to be one of the plugins statically available in resources
* For now, this has to be one or more of the plugins statically available in resources
* "/plugins/NAME". TODO: support retrieval through Maven repository.
* TODO: load the HPI file from $M2_REPO or $USER_HOME/.m2 by naming e.g. org.jvnet.hudson.plugins:monitoring:hpi:1.34.0
* (used in conjunction with the depepdency in POM to ensure it's available)
*/
String value();
String[] value();
class RunnerImpl extends Recipe.Runner<WithPlugin> {
private WithPlugin a;
......@@ -69,8 +69,10 @@ public @interface WithPlugin {
@Override
public void decorateHome(HudsonTestCase testCase, File home) throws Exception {
URL res = getClass().getClassLoader().getResource("plugins/" + a.value());
FileUtils.copyURLToFile(res,new File(home,"plugins/"+a.value()));
for (String plugin : a.value()) {
URL res = getClass().getClassLoader().getResource("plugins/" + plugin);
FileUtils.copyURLToFile(res, new File(home, "plugins/" + plugin));
}
}
}
......@@ -85,8 +87,10 @@ public @interface WithPlugin {
@Override
public void decorateHome(JenkinsRule jenkinsRule, File home) throws Exception {
URL res = getClass().getClassLoader().getResource("plugins/" + a.value());
FileUtils.copyURLToFile(res,new File(home,"plugins/"+a.value()));
for (String plugin : a.value()) {
URL res = getClass().getClassLoader().getResource("plugins/" + plugin);
FileUtils.copyURLToFile(res, new File(home, "plugins/" + plugin));
}
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册