Skip to content

Commit af890c7

Browse files
committed
Merge branch 'ricpelo-master'
2 parents 17527c9 + 24c19d2 commit af890c7

1 file changed

Lines changed: 33 additions & 15 deletions

File tree

bin/install.php

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,33 @@ public function __construct() {
2121
$this->tmp_dir = __DIR__ . '/tmp';
2222
@mkdir($this->tmp_dir);
2323

24-
$this->packages = [
24+
$this->packages = array(
2525
'translations' => array(
2626
'site' => 'github',
2727
'user' => 'bcit-ci',
2828
'repos' => 'codeigniter3-translations',
2929
'name' => 'Translations for CodeIgniter System Messages',
3030
'dir' => 'language',
31+
'example_branch' => '3.0.0',
3132
),
33+
'restserver' => array(
34+
'site' => 'github',
35+
'user' => 'chriskacerguis',
36+
'repos' => 'codeigniter-restserver',
37+
'name' => 'CodeIgniter REST Server',
38+
'dir' => array('config', 'controllers', 'language', 'libraries', 'views'),
39+
'pre' => 'application/',
40+
'msg' => 'See https://github.com/chriskacerguis/codeigniter-restserver',
41+
'example_branch' => '2.7.2',
42+
),
3243
'matches-cli' => array(
3344
'site' => 'github',
3445
'user' => 'avenirer',
3546
'repos' => 'codeigniter-matches-cli',
3647
'name' => 'Codeigniter Matches CLI',
3748
'dir' => array('config', 'controllers', 'views'),
3849
'msg' => 'See http://avenirer.github.io/codeigniter-matches-cli/',
50+
'example_branch' => 'master',
3951
),
4052
'hmvc-modules' => array(
4153
'site' => 'github',
@@ -44,6 +56,7 @@ public function __construct() {
4456
'name' => 'CodeIgniter HMVC Modules (jenssegers)',
4557
'dir' => array('core', 'third_party'),
4658
'msg' => 'See https://github.com/jenssegers/codeigniter-hmvc-modules#installation',
59+
'example_branch' => 'master',
4760
),
4861
'modular-extensions-hmvc' => array(
4962
'site' => 'bitbucket',
@@ -52,6 +65,7 @@ public function __construct() {
5265
'name' => 'Modular Extensions - HMVC (wiredesignz)',
5366
'dir' => array('core', 'third_party'),
5467
'msg' => 'See https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc',
68+
'example_branch' => 'codeigniter-3.x',
5569
),
5670
'ion-auth' => array(
5771
'site' => 'github',
@@ -63,6 +77,7 @@ public function __construct() {
6377
'migrations', 'models', 'sql', 'views'
6478
),
6579
'msg' => 'See http://benedmunds.com/ion_auth/',
80+
'example_branch' => '2',
6681
),
6782
'filename-checker' => array(
6883
'site' => 'github',
@@ -71,8 +86,9 @@ public function __construct() {
7186
'name' => 'CodeIgniter3 Filename Checker',
7287
'dir' => 'controllers',
7388
'msg' => 'See https://github.com/kenjis/codeigniter3-filename-checker',
89+
'example_branch' => 'master',
7490
),
75-
];
91+
);
7692
}
7793

7894
public function usage($self)
@@ -88,13 +104,10 @@ public function usage($self)
88104
$msg .= ' php install.php <package> <version/branch>' . PHP_EOL;
89105
$msg .= PHP_EOL;
90106
$msg .= 'Examples:' . PHP_EOL;
91-
$msg .= " php $self translations 3.0.0" . PHP_EOL;
92-
$msg .= " php $self translations develop" . PHP_EOL;
93-
$msg .= " php $self matches-cli master" . PHP_EOL;
94-
$msg .= " php $self hmvc-modules master" . PHP_EOL;
95-
$msg .= " php $self modular-extensions-hmvc codeigniter-3.x" . PHP_EOL;
96-
$msg .= " php $self ion-auth 2" . PHP_EOL;
97-
$msg .= " php $self filename-checker master" . PHP_EOL;
107+
108+
foreach ($this->packages as $key => $value) {
109+
$msg .= " php $self $key " . $value['example_branch'] . PHP_EOL;
110+
}
98111

99112
return $msg;
100113
}
@@ -138,19 +151,20 @@ private function downloadFromGithub($package, $version)
138151
$this->unzip($filepath);
139152

140153
$dir = $this->packages[$package]['dir'];
154+
$pre = isset($this->packages[$package]['pre']) ? $this->packages[$package]['pre'] : '';
141155

142156
if (is_string($dir)) {
143-
$src = realpath(dirname($filepath) . "/$repos-$version/$dir");
157+
$src = realpath(dirname($filepath) . "/$repos-$version/$pre$dir");
144158
$dst = realpath(__DIR__ . "/../application/$dir");
145-
return [$src, $dst];
159+
return array($src, $dst);
146160
}
147161

148162
foreach ($dir as $directory) {
149-
$src[] = realpath(dirname($filepath) . "/$repos-$version/$directory");
163+
$src[] = realpath(dirname($filepath) . "/$repos-$version/$pre$directory");
150164
@mkdir(__DIR__ . "/../application/$directory");
151165
$dst[] = realpath(__DIR__ . "/../application/$directory");
152166
}
153-
return [$src, $dst];
167+
return array($src, $dst);
154168
}
155169

156170
private function downloadFromBitbucket($package, $version)
@@ -167,15 +181,15 @@ private function downloadFromBitbucket($package, $version)
167181
if (is_string($dir)) {
168182
$src = realpath(dirname($filepath) . "/$dirname/$dir");
169183
$dst = realpath(__DIR__ . "/../application/$dir");
170-
return [$src, $dst];
184+
return array($src, $dst);
171185
}
172186

173187
foreach ($dir as $directory) {
174188
$src[] = realpath(dirname($filepath) . "/$dirname/$directory");
175189
@mkdir(__DIR__ . "/../application/$directory");
176190
$dst[] = realpath(__DIR__ . "/../application/$directory");
177191
}
178-
return [$src, $dst];
192+
return array($src, $dst);
179193
}
180194

181195
private function download($url)
@@ -216,6 +230,10 @@ private function unzip($filepath)
216230
*/
217231
private function recursiveCopy($src, $dst)
218232
{
233+
if ($src === false) {
234+
return;
235+
}
236+
219237
if (is_array($src)) {
220238
foreach ($src as $key => $source) {
221239
$this->recursiveCopy($source, $dst[$key]);

0 commit comments

Comments
 (0)