Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactring #5

Merged
merged 1 commit into from
Jan 23, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions src/main/groovy/org/jenkinsci/plugins/yamlaxis/YamlAxis.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class YamlAxis extends Axis {
private List<String> computedValues = null

@DataBoundConstructor
public YamlAxis(String name, String valueString, List<String> computedValues) {
YamlAxis(String name, String valueString, List<String> computedValues) {
super(name, valueString)
this.computedValues = computedValues
}
Expand All @@ -45,7 +45,7 @@ class YamlAxis extends Axis {
}

@Override
public List<String> rebuild(MatrixBuild.MatrixBuildExecution context) {
List<String> rebuild(MatrixBuild.MatrixBuildExecution context) {
FilePath workspace = context.getBuild().getModuleRoot()
YamlLoader loader = new YamlLoader(yamlFile: yamlFile, workspace: workspace)

Expand All @@ -67,29 +67,22 @@ class YamlAxis extends Axis {
*/
@Extension
static class DescriptorImpl extends AxisDescriptor {
final String displayName = "Yaml Axis"

/**
* Overridden to create a new instance of our Axis extension from UI
* values.
* @see hudson.model.Descriptor#newInstance(org.kohsuke.stapler.StaplerRequest,
* net.sf.json.JSONObject )
*/
@Override
public Axis newInstance(StaplerRequest req, JSONObject formData) {
Axis newInstance(StaplerRequest req, JSONObject formData) {
String name = formData.getString("name")
String yamlFile = formData.getString("valueString")
new YamlAxis(name, yamlFile, null)
}

/**
* Overridden to provide our own display name.
* @see hudson.model.Descriptor#getDisplayName()
*/
@Override
public String getDisplayName() {
"Yaml Axis"
}

public FormValidation doCheckValueString(@QueryParameter String value) {
FormValidation doCheckValueString(@QueryParameter String value) {
if(Util.fixEmpty(value) == null) {
return FormValidation.error("Axis yaml file can not be empty")
}
Expand Down