Mercurial > hg > icedrobot > ika
changeset 6:2bd34951aadf
add new plugin.
author | Mario Torre <neugens.limasoftware@gmail.com> |
---|---|
date | Wed, 09 Mar 2011 00:40:02 +0100 |
parents | 24bc15b8e27b |
children | 4e841dd81d28 |
files | resources/core_plugins.properties src/org/icedrobot/ika/plugins/git/IkaGitWrapper.java |
diffstat | 2 files changed, 70 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/resources/core_plugins.properties Wed Mar 09 00:39:33 2011 +0100 +++ b/resources/core_plugins.properties Wed Mar 09 00:40:02 2011 +0100 @@ -1,3 +1,4 @@ # list of core plugins, the keys are the names and the values the class name version=org.icedrobot.ika.plugins.help.IkaVersion assimilate=org.icedrobot.ika.plugins.borg.IcedRobotCloner +git=org.icedrobot.ika.plugins.git.IkaGitWrapper
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/org/icedrobot/ika/plugins/git/IkaGitWrapper.java Wed Mar 09 00:40:02 2011 +0100 @@ -0,0 +1,69 @@ +/* + * IKA - IcedRobot Kiosk Application + * Copyright (C) 2011 IcedRobot team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package org.icedrobot.ika.plugins.git; + +import java.io.File; +import joptsimple.OptionParser; +import joptsimple.OptionSet; +import org.icedrobot.ika.plugins.IkaPlugin; +import org.icedrobot.ika.plugins.IkaPluginResult; +import org.icedrobot.ika.plugins.scm.GITRepository; +import org.icedrobot.ika.plugins.scm.Repository; + +/** + * @author Mario Torre <neugens.limasoftware@gmail.com> + */ +public class IkaGitWrapper implements IkaPlugin { + + @Override + public String getName() { + return "git"; + } + + @Override + public String getDescription() { + return "handles various git tasks for IcedRobot"; + } + + @Override + public IkaPluginResult execute(String[] args) { + + if (args != null) { + OptionParser parser = new OptionParser(); + parser.accepts("makerepo").withRequiredArg(); + + OptionSet options = parser.parse(args); + + if (options.has("makerepo")) { + String destinationDir = (String) options.valueOf("makerepo"); + + File base = new File(destinationDir); + if (!base.exists()) { + System.out.println("desitination directory doesn't exist"); + return IkaPluginResult.FAILURE; + } + + System.err.println("base.getName(): " + base.getName()); + GITRepository repository = new GITRepository(base.getName(), base, + "", "", "icedrobot"); + repository.create(); + } + } + return IkaPluginResult.OK; + } +}