Skip to content

Commit

Permalink
Merge pull request #348 from jsight/fix_for_overwrite_prompt
Browse files Browse the repository at this point in the history
WINDUP-379: Overwrite prompt is ignored in non-interactive mode, and res...
  • Loading branch information
lincolnthree committed Nov 10, 2014
2 parents 1413592 + 492a076 commit bd10e53
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions ui/src/main/java/org/jboss/windup/ui/WindupCommand.java
Expand Up @@ -158,7 +158,8 @@ private Object getValueForInput(InputComponent<?, ?> input)
return value;
}

private Resource<?> getResourceResolved(Resource<?> value) {
private Resource<?> getResourceResolved(Resource<?> value)
{
Resource<?> resource = (Resource<?>) value;
File file = (File) resource.getUnderlyingResourceObject();
return new ResourcePathResolver(resourceFactory, resource, file.getPath()).resolve().get(0);
Expand Down Expand Up @@ -195,9 +196,10 @@ public Result execute(UIExecutionContext context) throws Exception
{
String promptMsg = "Overwrite all contents of \"" + windupConfiguration.getOutputDirectory().toString()
+ "\" (anything already in the directory will be deleted)?";
if (!context.getPrompt().promptBoolean(promptMsg))
if (!context.getPrompt().promptBoolean(promptMsg, false))
{
return Results.fail("Windup execution aborted!");
String outputPath = windupConfiguration.getOutputDirectory().toString();
return Results.fail("Files exist in " + outputPath + ", but --overwrite not specified. Aborting!");
}
}

Expand Down
Expand Up @@ -122,7 +122,7 @@ public void testOverwriteConfirmation() throws Exception

// make sure that it failed to run (since the user's response to the overwrite question is false)
Assert.assertTrue(result instanceof Failed);
Assert.assertTrue(result.getMessage().contains("Windup execution aborted"));
Assert.assertTrue(result.getMessage().contains("overwrite not specified"));
}
finally
{
Expand Down

0 comments on commit bd10e53

Please sign in to comment.