2016-09-23 14:24:04 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace Ad5001\Gitable;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use pocketmine\Server;
|
|
|
|
|
|
|
|
|
|
|
|
use pocketmine\Player;
|
|
|
|
|
2016-11-18 17:32:03 +00:00
|
|
|
define("DEFAULT_GIT_DIR", \pocketmine\Server::getInstance()->getFilePath(), true);
|
2016-09-23 14:24:04 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2016-09-23 16:30:14 +00:00
|
|
|
$this->cd($dir);
|
|
|
|
|
2016-11-18 17:32:03 +00:00
|
|
|
$this->initcheck();
|
2016-09-23 14:24:04 +00:00
|
|
|
|
|
|
|
|
2016-11-18 17:32:03 +00:00
|
|
|
}
|
2016-09-23 14:24:04 +00:00
|
|
|
|
|
|
|
|
2016-11-18 17:32:03 +00:00
|
|
|
public abstract function gitExec(string $args) : string;
|
2016-09-23 14:24:04 +00:00
|
|
|
|
2016-11-18 17:32:03 +00:00
|
|
|
public function pwd() : string {
|
2016-09-23 14:24:04 +00:00
|
|
|
return $this->dir;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-11-18 17:32:03 +00:00
|
|
|
public abstract function cd(string $path) : string;
|
2016-09-23 14:24:04 +00:00
|
|
|
|
2016-11-18 17:32:03 +00:00
|
|
|
/*
|
|
|
|
Return the list of files in directory.
|
|
|
|
*/
|
|
|
|
public abstract function ls() : string;
|
2016-09-23 14:24:04 +00:00
|
|
|
|
2016-11-18 17:32:03 +00:00
|
|
|
public abstract function initcheck();
|
2016-09-23 14:24:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
}
|