From 471a675df368253c0397958bcbd19f379c6bc11d Mon Sep 17 00:00:00 2001 From: Julius Date: Sat, 16 Sep 2017 03:21:20 +0700 Subject: [PATCH 1/2] Install Kenji's Twig Library --- bin/install.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/bin/install.php b/bin/install.php index f53f312..1264feb 100755 --- a/bin/install.php +++ b/bin/install.php @@ -88,6 +88,16 @@ public function __construct() { 'msg' => 'See https://github.com/kenjis/codeigniter3-filename-checker', 'example_branch' => 'master', ), + 'twig' => array( + 'site' => 'github', + 'user' => 'kenjis', + 'repos' => 'codeigniter-ss-twig', + 'name' => 'CodeIgniter3 Simple and Secure Twig Integration', + 'dir' => 'libraries', + 'msg' => 'See https://github.com/kenjis/codeigniter-ss-twig', + 'require' => array("twig/twig", "~1.22"), + 'example_branch' => 'master', + ), ); } @@ -135,6 +145,21 @@ public function install($package, $version) $this->recursiveCopy($src, $dst); $this->recursiveUnlink($this->tmp_dir); + // install package needed by this library (if any) + if (array_key_exists('require',$this->packages[$package])) { + $input = file_get_contents( __DIR__."/../composer.json"); + $composer = json_decode($input); + + $require = $this->packages[$package]['require'][0]; + $composer->require->$require = $this->packages[$package]['require'][1]; + + $output = json_encode($composer, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); + copy(__DIR__."/../composer.json", __DIR__."/../composer.json.save"); + file_put_contents(__DIR__."/../composer.json", $output); + echo 'Installing package: ' . $this->packages[$package]['name'] . PHP_EOL; + passthru('composer update'); + } + $msg = 'Installed: ' . $package .PHP_EOL; if (isset($this->packages[$package]['msg'])) { $msg .= $this->packages[$package]['msg'] . PHP_EOL; From 50cab6a642a372666127dfbf1d611940b8025b6c Mon Sep 17 00:00:00 2001 From: Julius Date: Tue, 19 Sep 2017 00:10:01 +0700 Subject: [PATCH 2/2] Correction to array, after conflict merge --- bin/install.php | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/install.php b/bin/install.php index 771fd3f..ff82b96 100755 --- a/bin/install.php +++ b/bin/install.php @@ -97,6 +97,7 @@ public function __construct() { 'dir' => 'libraries', 'msg' => 'See https://github.com/kenjis/codeigniter-ss-twig', 'require' => array("twig/twig", "~1.22"), + ), 'codeigniter-develbar' => array( 'site' => 'github',