Search in sources :

Example 1 with RakeTask

use of com.thoughtworks.go.config.RakeTask 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"));
}
Also used : RakeTask(com.thoughtworks.go.config.RakeTask) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) RunIf(com.googlecode.junit.ext.RunIf) Test(org.junit.Test) TasksTest(com.thoughtworks.go.domain.TasksTest)

Example 2 with RakeTask

use of com.thoughtworks.go.config.RakeTask in project gocd by gocd.

the class RakeTaskTest method shouldDefaultToUsingAKillAllChildrenCancelTask.

@Test
public void shouldDefaultToUsingAKillAllChildrenCancelTask() throws Exception {
    RakeTask rakeTask = new MagicalGoConfigXmlLoader(new ConfigCache(), ConfigElementImplementationRegistryMother.withNoPlugins()).fromXmlPartial("<rake/>", RakeTask.class);
    assertThat(rakeTask.cancelTask(), is(instanceOf(KillAllChildProcessTask.class)));
}
Also used : ConfigCache(com.thoughtworks.go.config.ConfigCache) RakeTask(com.thoughtworks.go.config.RakeTask) MagicalGoConfigXmlLoader(com.thoughtworks.go.config.MagicalGoConfigXmlLoader) Test(org.junit.Test)

Example 3 with RakeTask

use of com.thoughtworks.go.config.RakeTask in project gocd by gocd.

the class RakeTaskTest method shouldNotKillAllChildrenWhenEmptyOnCancel.

@Test
public void shouldNotKillAllChildrenWhenEmptyOnCancel() throws Exception {
    RakeTask rakeTask = new MagicalGoConfigXmlLoader(new ConfigCache(), ConfigElementImplementationRegistryMother.withNoPlugins()).fromXmlPartial("<rake>" + "  <oncancel />" + "</rake>", RakeTask.class);
    assertThat(rakeTask.cancelTask(), is(instanceOf(NullTask.class)));
}
Also used : ConfigCache(com.thoughtworks.go.config.ConfigCache) RakeTask(com.thoughtworks.go.config.RakeTask) MagicalGoConfigXmlLoader(com.thoughtworks.go.config.MagicalGoConfigXmlLoader) Test(org.junit.Test)

Example 4 with RakeTask

use of com.thoughtworks.go.config.RakeTask in project gocd by gocd.

the class PipelineBean method getTasks.

public Tasks getTasks() {
    Tasks tasks = new Tasks();
    if ("ant".equals(builder)) {
        AntTask antTask = new AntTask();
        antTask.setTarget(this.target);
        antTask.setBuildFile(defaultString(StringUtils.isBlank(this.buildfile) ? "build.xml" : this.buildfile));
        tasks.add(antTask);
    } else if ("nant".equals(builder)) {
        NantTask nantTask = new NantTask();
        nantTask.setTarget(this.target);
        nantTask.setBuildFile(defaultString(StringUtils.isBlank(this.buildfile) ? "default.build" : this.buildfile));
        tasks.add(nantTask);
    } else if ("rake".equals(builder)) {
        RakeTask rakeTask = new RakeTask();
        rakeTask.setTarget(this.target);
        rakeTask.setBuildFile(StringUtils.isBlank(this.buildfile) ? null : this.buildfile);
        tasks.add(rakeTask);
    } else if ("exec".equals(builder)) {
        String trimmedCommand = StringUtils.defaultString(this.command).trim();
        String trimmedArguments = StringUtils.defaultString(this.arguments).trim();
        ExecTask execTask = new ExecTask(trimmedCommand, trimmedArguments, (String) null);
        tasks.add(execTask);
    }
    return tasks;
}
Also used : Tasks(com.thoughtworks.go.config.Tasks) RakeTask(com.thoughtworks.go.config.RakeTask) ExecTask(com.thoughtworks.go.config.ExecTask) AntTask(com.thoughtworks.go.config.AntTask) NantTask(com.thoughtworks.go.config.NantTask) StringUtils.defaultString(org.apache.commons.lang.StringUtils.defaultString) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Aggregations

RakeTask (com.thoughtworks.go.config.RakeTask)4 Test (org.junit.Test)3 ConfigCache (com.thoughtworks.go.config.ConfigCache)2 MagicalGoConfigXmlLoader (com.thoughtworks.go.config.MagicalGoConfigXmlLoader)2 RunIf (com.googlecode.junit.ext.RunIf)1 AntTask (com.thoughtworks.go.config.AntTask)1 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)1 ExecTask (com.thoughtworks.go.config.ExecTask)1 NantTask (com.thoughtworks.go.config.NantTask)1 Tasks (com.thoughtworks.go.config.Tasks)1 TasksTest (com.thoughtworks.go.domain.TasksTest)1 CommandBuilder (com.thoughtworks.go.domain.builder.CommandBuilder)1 StringUtils.defaultString (org.apache.commons.lang.StringUtils.defaultString)1