use of com.thoughtworks.go.domain.builder.CommandBuilder in project gocd by gocd.
the class RakeTaskBuilderTest method rakeTaskShouldNormalizeWorkingDirectory.
@Test
@RunIf(value = EnhancedOSChecker.class, arguments = { DO_NOT_RUN_ON, WINDOWS })
public void rakeTaskShouldNormalizeWorkingDirectory() throws Exception {
RakeTask task = new RakeTask();
task.setWorkingDirectory("folder1\\folder2");
CommandBuilder commandBuilder = (CommandBuilder) rakeTaskBuilder.createBuilder(builderFactory, task, TasksTest.pipelineStub("label", "/var/cruise-agent/pipelines/cruise"), resolver);
assertThat(commandBuilder.getWorkingDir().getPath(), is("/var/cruise-agent/pipelines/cruise/folder1/folder2"));
}
use of com.thoughtworks.go.domain.builder.CommandBuilder in project gocd by gocd.
the class BuildWorkEnvironmentVariablesTest method createAssignment.
private BuildAssignment createAssignment() {
JobPlan plan = new DefaultJobPlan(new Resources(), new ArtifactPlans(), new ArtifactPropertiesGenerators(), -1, new JobIdentifier(PIPELINE_NAME, 1, "1", STAGE_NAME, "1", JOB_NAME, 123L), null, new EnvironmentVariablesConfig(), new EnvironmentVariablesConfig(), null);
MaterialRevisions materialRevisions = materialRevisions();
BuildCause buildCause = BuildCause.createWithModifications(materialRevisions, TRIGGERED_BY_USER);
List<Builder> builders = new ArrayList<>();
builders.add(new CommandBuilder("ant", "", dir, new RunIfConfigs(), new NullBuilder(), ""));
return BuildAssignment.create(plan, buildCause, builders, dir);
}
use of com.thoughtworks.go.domain.builder.CommandBuilder in project gocd by gocd.
the class NantTaskBuilder method createBuilder.
@Override
public Builder createBuilder(BuilderFactory builderFactory, NantTask task, Pipeline pipeline, UpstreamPipelineResolver resolver) {
File taskWorkingDirectory = new File(FileUtil.join(pipeline.defaultWorkingFolder(), task.workingDirectory()));
String command = task.command();
String argument = task.arguments();
Builder cancelBuilder = builderFactory.builderFor(task.cancelTask(), pipeline, resolver);
return new CommandBuilder(command, argument, taskWorkingDirectory, task.getConditions(), cancelBuilder, task.describe(), "BUILD FAILED");
}
use of com.thoughtworks.go.domain.builder.CommandBuilder in project gocd by gocd.
the class RakeTaskBuilder method createBuilder.
@Override
public Builder createBuilder(BuilderFactory builderFactory, RakeTask task, Pipeline pipeline, UpstreamPipelineResolver resolver) {
String newWorkingDir = FileUtil.join(pipeline.defaultWorkingFolder(), task.workingDirectory());
String argument = task.arguments();
Builder builder = builderFactory.builderFor(task.cancelTask(), pipeline, resolver);
return new CommandBuilder("rake", argument, new File(newWorkingDir), task.getConditions(), builder, task.describe());
}
use of com.thoughtworks.go.domain.builder.CommandBuilder in project gocd by gocd.
the class NantTaskBuilderTest method shouldSetTargetWhenTargetIsSpecified.
@Test
public void shouldSetTargetWhenTargetIsSpecified() throws Exception {
NantTask nantTask = new NantTask();
nantTask.setTarget("unit-test");
CommandBuilder commandBuilder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, pipeline, resolver);
assertThat(commandBuilder.getArgs(), is(" unit-test"));
}
Aggregations