# HG changeset patch # User Mario Torre # Date 1299627602 -3600 # Node ID 2bd34951aadfb97df13f9d676bf0141858b28a9d # Parent 24bc15b8e27bf3e6632f5479eddd3aae53174b9a add new plugin. diff -r 24bc15b8e27b -r 2bd34951aadf resources/core_plugins.properties --- 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 diff -r 24bc15b8e27b -r 2bd34951aadf src/org/icedrobot/ika/plugins/git/IkaGitWrapper.java --- /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 . + */ +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 + */ +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; + } +}