2021-12-08 23:58:28 +00:00
|
|
|
<?php // "name":"Git plugin for SparkPlug", "author":"Noccy"
|
|
|
|
|
|
|
|
namespace SparkPlug\Com\Noccy\Git;
|
|
|
|
|
|
|
|
use Spark\Commands\Command;
|
|
|
|
use SparkPlug;
|
|
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
|
|
|
|
class GitPlug extends SparkPlug
|
|
|
|
{
|
|
|
|
public function load()
|
|
|
|
{
|
|
|
|
$root = $this->getProjectDirectory();
|
|
|
|
if (!file_exists($root."/.git")) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
register_command(new GitIgnoreCommand());
|
|
|
|
}
|
2021-12-14 22:01:25 +00:00
|
|
|
|
|
|
|
public function getIgnoreList(bool $local=false)
|
|
|
|
{
|
|
|
|
$root = get_environment()->getProjectDirectory();
|
|
|
|
$file = $root . (!$local ? "/.gitignore" : "/.git/info/exclude");
|
|
|
|
return new IgnoreList($file);
|
|
|
|
}
|
2021-12-08 23:58:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//if (file_exists(get_environment()->getConfigDirectory()."/maker.json")) {
|
|
|
|
register_plugin("com.noccy.git", new GitPlug());
|
2021-12-14 22:01:25 +00:00
|
|
|
require_once(__DIR__."/helpers.php");
|
2021-12-08 23:58:28 +00:00
|
|
|
//}
|