From 996d1791e61913b3d9d1cd0f27375d8adbabc791 Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Fri, 23 Sep 2016 17:24:04 +0300 Subject: [PATCH] Starting it... --- plugin.yml | 9 +++ resources/Windows/bin | 1 + src/Ad5001/Gitable/GitClient.php | 101 +++++++++++++++++++++++++++++++ src/Ad5001/Gitable/Linux.php | 42 +++++++++++++ src/Ad5001/Gitable/Mac.php | 42 +++++++++++++ src/Ad5001/Gitable/Main.php | 98 ++++++++++++++++++++++++++++++ src/Ad5001/Gitable/Windows.php | 42 +++++++++++++ 7 files changed, 335 insertions(+) create mode 100644 plugin.yml create mode 160000 resources/Windows/bin create mode 100644 src/Ad5001/Gitable/GitClient.php create mode 100644 src/Ad5001/Gitable/Linux.php create mode 100644 src/Ad5001/Gitable/Mac.php create mode 100644 src/Ad5001/Gitable/Main.php create mode 100644 src/Ad5001/Gitable/Windows.php diff --git a/plugin.yml b/plugin.yml new file mode 100644 index 0000000..cfa77e0 --- /dev/null +++ b/plugin.yml @@ -0,0 +1,9 @@ +--- +name: Gitable +author: Ad5001 +version: 1.0 +api: [2.0.0] +main: Ad5001\Gitable\Main +commands: [] +permissions: [] +... \ No newline at end of file diff --git a/resources/Windows/bin b/resources/Windows/bin new file mode 160000 index 0000000..2209df7 --- /dev/null +++ b/resources/Windows/bin @@ -0,0 +1 @@ +Subproject commit 2209df713ae0598aca431eecad48e8ec8ddf7aec diff --git a/src/Ad5001/Gitable/GitClient.php b/src/Ad5001/Gitable/GitClient.php new file mode 100644 index 0000000..1cebb54 --- /dev/null +++ b/src/Ad5001/Gitable/GitClient.php @@ -0,0 +1,101 @@ +main = $main; + + $this->server = $main->getServer(); + + $this->dir = $dir; + + + } + + + public abstract function commit(string $message) : string; + + + public abstract function push(string $to = "github", string $from = "master") : string; + + + public abstract function undoCommit() : string; + + + public abstract function checkout($message) : string; + + + public abstract function branch($message) : string; + + + public abstract function start() : string; + + + public abstract function init() : string; + + public function getDir() { + return $this->dir; + } + + + public abstract function cd($path) : string; + + + public abstract function clone($from) : string; + + + public abstract function logs() : string; + + + public abstract function remove($path) : string; + + + public abstract function move($path) : string; + + + public abstract function headreset() : string; + + + public abstract function add($path) : string; + + + public abstract function diff($path) : string; + + + public abstract function status($path) : string; + + + public abstract function remote($name, $url) : string; + + + public abstract function pull($to = "github", $from = "master") : string; + + + public abstract function status($path) : string; + + +} \ No newline at end of file diff --git a/src/Ad5001/Gitable/Linux.php b/src/Ad5001/Gitable/Linux.php new file mode 100644 index 0000000..f34b316 --- /dev/null +++ b/src/Ad5001/Gitable/Linux.php @@ -0,0 +1,42 @@ +main = $main; + + + $this->server = $main->getServer() + + + } + + + + +} \ No newline at end of file diff --git a/src/Ad5001/Gitable/Mac.php b/src/Ad5001/Gitable/Mac.php new file mode 100644 index 0000000..f34b316 --- /dev/null +++ b/src/Ad5001/Gitable/Mac.php @@ -0,0 +1,42 @@ +main = $main; + + + $this->server = $main->getServer() + + + } + + + + +} \ No newline at end of file diff --git a/src/Ad5001/Gitable/Main.php b/src/Ad5001/Gitable/Main.php new file mode 100644 index 0000000..041d950 --- /dev/null +++ b/src/Ad5001/Gitable/Main.php @@ -0,0 +1,98 @@ +getServer()->getPluginManager()->registerEvents($this, $this); + + if(Utils::getOS() == "win") { + $this->git = new Windows($this); + } elseif(Utils::getOS() == "linux") { + $this->git = new Linux($this); + } elseif(Utils::getOS() == "mac") { + $this->git = new Mac($this); + } + + } + + + + + public function onCommand(CommandSender $sender, Command $cmd, $label, array $args){ + + + switch($cmd->getName()){ + + + case 'git': + + if(count($args) >= 1) { + + if(isset(self::COMMANDS[$args[0]])) { + + $cmd = $args[0]; + + unset($args[0]); + + $sender->sendMessage($this->git->{self::COMMANDS[$cmd][0]}(implode(" ", $args))); + + } + } + + + break; + + + } + + + return false; + + + } + + + public function getGitClient() { + return $this->git; + } + + + public function setGitClient(GitClient $client) { + $this->git = $client; + return $this->git == $client; + } + + +} \ No newline at end of file diff --git a/src/Ad5001/Gitable/Windows.php b/src/Ad5001/Gitable/Windows.php new file mode 100644 index 0000000..26f7856 --- /dev/null +++ b/src/Ad5001/Gitable/Windows.php @@ -0,0 +1,42 @@ +main = $main; + + + $this->server = $main->getServer(); + + + } + + + + +} \ No newline at end of file