yaml = $this->getList();
$mods = [];
foreach($this->yaml['mods'] as $modname => $mod) {
if($mod['mod_count'] > 0) $mods[$modname] = $mod;
}
$this->mods = $mods;
$this->validmods = array_keys($mods);
}
public function getList()
{
$yaml = file_get_contents($this->url);
if (function_exists('yaml_parse')) {
return yaml_parse($yaml);
} else {
require_once "./Spyc.php";
return Spyc::YAMLLoadString($yaml);
}
}
public function render($mod = null)
{
if ($mod === null) {
return $this->modList();
}
if($mod === 'create') {
return $this->create();
}
if(!in_array($mod, $this->validmods)) {
// return 'Invalid mod selected';
return $this->create();
}
return $this->displayMod($mod);
}
public function create()
{
echo 'Back to list';
echo '
Submitting a PR for a Mod to be added to the official LinuxServer.io repo
Ask the team to create a new branch named <baseimagename>-<modname> in this repo. Baseimage should be the name of the image the mod will be applied to. The new branch will be based on the [template branch](https://github.com/linuxserver/docker-mods/tree/template).
Fork the repo, checkout the template branch.
Edit the Dockerfile for the mod. Dockerfile.complex is only an example and included for reference; it should be deleted when done.
Inspect the root folder contents. Edit, add and remove as necessary.
Edit this readme with pertinent info, delete these instructions.
Finally edit the travis.yml. Customize the build branch, and the vars for BASEIMAGE and MODNAME.
Submit PR against the branch created by the team.
Make sure that the commits in the PR are squashed.
Also make sure that the commit and PR titles are in the format of <imagename>: <modname> <very brief description like "initial release" or "update">. Detailed description and further info should be provided in the body (ie. code-server: python2 add python-pip).
';
}
public function modList()
{
echo 'Add a mod';
foreach($this->mods as $modname => $mod) {
echo '