Browse Source

Working on it.

tags/v1.0
Ad5001 3 years ago
parent
commit
76d4e60d53
3 changed files with 76 additions and 18 deletions
  1. 7
    11
      src/Ad5001/Gitable/GitClient.php
  2. 3
    3
      src/Ad5001/Gitable/Main.php
  3. 66
    4
      src/Ad5001/Gitable/Windows.php

+ 7
- 11
src/Ad5001/Gitable/GitClient.php View File

@@ -33,6 +33,8 @@ abstract class GitClient {

$this->dir = $dir;

$this->cd($dir);


}

@@ -43,13 +45,13 @@ abstract class GitClient {
public abstract function push(string $to = "github", string $from = "master") : string;


public abstract function undoCommit() : string;
public abstract function checkout($branch = null) : string;


public abstract function checkout($message) : string;
public abstract function getBranch() : string;


public abstract function branch($message) : string;
public abstract function branch($branch = '') : string;


public abstract function start() : string;
@@ -68,16 +70,13 @@ abstract class GitClient {
public abstract function clone($from) : string;


public abstract function logs() : string;
public abstract function log() : string;


public abstract function remove($path) : string;


public abstract function move($path) : string;


public abstract function headreset() : string;
public abstract function move($path, $newpath) : string;


public abstract function add($path) : string;
@@ -95,7 +94,4 @@ abstract class GitClient {
public abstract function pull($to = "github", $from = "master") : string;


public abstract function status($path) : string;


}

+ 3
- 3
src/Ad5001/Gitable/Main.php View File

@@ -38,11 +38,11 @@ class Main extends PluginBase implements Listener {
$this->getServer()->getPluginManager()->registerEvents($this, $this);

if(Utils::getOS() == "win") {
$this->git = new Windows($this);
$this->git = new Windows($this, $this->getDataFolder());
} elseif(Utils::getOS() == "linux") {
$this->git = new Linux($this);
$this->git = new Linux($this, $this->getDataFolder());
} elseif(Utils::getOS() == "mac") {
$this->git = new Mac($this);
$this->git = new Mac($this, $this->getDataFolder());
}

}

+ 66
- 4
src/Ad5001/Gitable/Windows.php View File

@@ -20,23 +20,85 @@ use Ad5001\Gitable\Main;



class Windows {
class Windows extends GitClient {




public function __construct(Main $main) {
public function commit(string $message) : string {
return shell_exec("git commit -m \"$message\"");
}


public function push(string $to = "github", string $from = "master") : string {
return shell_exec("git push $to $from");
}


public function checkout($branch = null) : string {
return shell_exec("git checkout " . (!is_null($branch) ? $this->getBranch() : $branch));
}


public function getBranch() : string {
$handle = popen('git branch', 'r');
$read = fread($handle, 2096);
return explode(" ", $read)[1];
}


$this->main = $main;
public function branch($branch = '') : string {
return shell_exec("git branch " . $branch);
}


$this->server = $main->getServer();
public function start() : string {
return shell_exec("git init");
}


public function init() : string {
return shell_exec("git init");
}

public function getDir() {
return $this->dir;
}


public function cd($path) : string {
return shell_exec("cd " . $path);
}


public function clone($from) : string {}


public function log() : string {}


public function remove($path) : string {}


public function move($path, $newpath) : string {}


public function add($path) : string {}


public function diff($path) : string {}


public function status($path) : string {}


public function remote($name, $url) : string {}


public function pull($to = "github", $from = "master") : string {}




}

Loading…
Cancel
Save