| %line | %branch | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| nl.toolforge.karma.core.cmd.impl.CleanAll |
|
|
| 1 | /* |
|
| 2 | Karma core - Core of the Karma application |
|
| 3 | Copyright (C) 2004 Toolforge <www.toolforge.nl> |
|
| 4 | ||
| 5 | This library is free software; you can redistribute it and/or |
|
| 6 | modify it under the terms of the GNU Lesser General Public |
|
| 7 | License as published by the Free Software Foundation; either |
|
| 8 | version 2.1 of the License, or (at your option) any later version. |
|
| 9 | ||
| 10 | This library is distributed in the hope that it will be useful, |
|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
| 13 | Lesser General Public License for more details. |
|
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public |
|
| 16 | License along with this library; if not, write to the Free Software |
|
| 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 18 | */ |
|
| 19 | package nl.toolforge.karma.core.cmd.impl; |
|
| 20 | ||
| 21 | import nl.toolforge.karma.core.cmd.CommandDescriptor; |
|
| 22 | import nl.toolforge.karma.core.cmd.CommandException; |
|
| 23 | import nl.toolforge.karma.core.cmd.CommandResponse; |
|
| 24 | import nl.toolforge.karma.core.cmd.event.MessageEvent; |
|
| 25 | import nl.toolforge.karma.core.cmd.event.SimpleMessage; |
|
| 26 | import org.apache.commons.io.FileUtils; |
|
| 27 | ||
| 28 | import java.io.IOException; |
|
| 29 | ||
| 30 | /** |
|
| 31 | * Removes the build directory to create a totally clean environment. |
|
| 32 | * |
|
| 33 | * @author W.H. Schraal |
|
| 34 | * @author D.A. Smedes |
|
| 35 | * @version $Id: CleanAll.java,v 1.10 2004/11/02 23:57:06 asmedes Exp $ |
|
| 36 | */ |
|
| 37 | public class CleanAll extends AbstractBuildCommand { |
|
| 38 | ||
| 39 | 0 | private CommandResponse commandResponse = new CommandResponse(); |
| 40 | ||
| 41 | public CleanAll(CommandDescriptor descriptor) { |
|
| 42 | 0 | super(descriptor); |
| 43 | 0 | } |
| 44 | ||
| 45 | /** |
|
| 46 | * Removes the <code>build</code> directory. |
|
| 47 | * |
|
| 48 | * @throws CommandException |
|
| 49 | */ |
|
| 50 | public void execute() throws CommandException { |
|
| 51 | ||
| 52 | try { |
|
| 53 | ||
| 54 | // FileUtils.deleteDirectory(new File(getCurrentManifest().getBaseDirectory(), "build")); |
|
| 55 | 0 | FileUtils.deleteDirectory(getCurrentManifest().getBuildBaseDirectory()); |
| 56 | ||
| 57 | // todo internationalization |
|
| 58 | // |
|
| 59 | 0 | commandResponse.addEvent(new MessageEvent(this, class="keyword">new SimpleMessage("Manifest has been cleaned."))); |
| 60 | ||
| 61 | 0 | } catch (IOException e) { |
| 62 | 0 | throw new CommandException(CommandException.CLEAN_ALL_FAILED, class="keyword">new Object[]{e.getLocalizedMessage()}); |
| 63 | 0 | } |
| 64 | 0 | } |
| 65 | ||
| 66 | public CommandResponse getCommandResponse() { |
|
| 67 | 0 | return this.commandResponse; |
| 68 | } |
|
| 69 | } |
| This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |