Kaynağa Gözat

Starting it...

master
Ad5001 5 yıl önce
işleme
996d1791e6
  1. 9
      plugin.yml
  2. 1
      resources/Windows/bin
  3. 101
      src/Ad5001/Gitable/GitClient.php
  4. 42
      src/Ad5001/Gitable/Linux.php
  5. 42
      src/Ad5001/Gitable/Mac.php
  6. 98
      src/Ad5001/Gitable/Main.php
  7. 42
      src/Ad5001/Gitable/Windows.php

9
plugin.yml

@ -0,0 +1,9 @@
---
name: Gitable
author: Ad5001
version: 1.0
api: [2.0.0]
main: Ad5001\Gitable\Main
commands: []
permissions: []
...

1
resources/Windows/bin

@ -0,0 +1 @@
Subproject commit 2209df713ae0598aca431eecad48e8ec8ddf7aec

101
src/Ad5001/Gitable/GitClient.php

@ -0,0 +1,101 @@
<?php
namespace Ad5001\Gitable;
use pocketmine\Server;
use pocketmine\Player;
abstract class GitClient {
protected $main;
private $server;
protected $dir;
public function __construct(Main $main, string $dir) {
$this->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;
}

42
src/Ad5001/Gitable/Linux.php

@ -0,0 +1,42 @@
<?php
namespace Ad5001\Gitable;
use pocketmine\Server;
use pocketmine\Player;
use Ad5001\Gitable\Main;
class Dummy {
public function __construct(Main $main) {
$this->main = $main;
$this->server = $main->getServer()
}
}

42
src/Ad5001/Gitable/Mac.php

@ -0,0 +1,42 @@
<?php
namespace Ad5001\Gitable;
use pocketmine\Server;
use pocketmine\Player;
use Ad5001\Gitable\Main;
class Dummy {
public function __construct(Main $main) {
$this->main = $main;
$this->server = $main->getServer()
}
}

98
src/Ad5001/Gitable/Main.php

@ -0,0 +1,98 @@
<?php
namespace Ad5001\Gitable;
use pocketmine\command\CommandSender;
use pocketmine\command\Command;
use pocketmine\event\Listener;
use pocketmine\plugin\PluginBase;
use pocketmine\Server;
use pocketmine\utils\Utils;
use pocketmine\Player;
class Main extends PluginBase implements Listener {
protected $git;
public function onEnable() {
$this->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;
}
}

42
src/Ad5001/Gitable/Windows.php

@ -0,0 +1,42 @@
<?php
namespace Ad5001\Gitable;
use pocketmine\Server;
use pocketmine\Player;
use Ad5001\Gitable\Main;
class Windows {
public function __construct(Main $main) {
$this->main = $main;
$this->server = $main->getServer();
}
}
Yükleniyor…
İptal
Kaydet