-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdeploy
executable file
·82 lines (65 loc) · 1.57 KB
/
deploy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env php
<?php
$phpversion = substr(phpversion(), 0, 3);
$brewphp = str_replace('.', '', $phpversion);
$hasChanged = false;
$error = '';
function _p($s = '') {
$args = func_get_args();
if (count($args) > 1) {
$s = $args;
}
if (is_array($s)) {
echo implode(' ', $s);
return;
}
echo $s . PHP_EOL;
}
if ($phpversion !== '5.4') {
_p("You need to use php 5.4 to deploy this extension.");
if (PHP_OS !== 'Darwin') {
_p("You are using PHP " . $phpversion);
exit(1);
}
_p("Since you're using macOS this script will try to change your PHP version from $phpversion to 5.4.");
_p();
if (!system("brew unlink php$brewphp && brew link php54")) {
_p();
system("brew link php$brewphp");
_p();
_p("This script couldn't change your PHP version using brew. Make sure you have php54 installed.");
exit(1);
}
$hasChanged = true;
_p();
system("php -v");
_p();
}
_p("Removing old vendor...");
system("rm -rf lib/Ebanx/vendor");
_p("Downloading dependencies...");
system("composer install --no-dev");
system("rm -f magento-gateway-ebanx.zip");
_p("Creating files...");
$tagData = explode(' ', system("git tag -n1 | grep `git describe`"), 2);
$tag = $tagData[0];
$message = trim($tagData[1]);
system("scripts/pack $tag \"$message\"");
if ($hasChanged) {
_p("Returning you PHP version to $phpversion...");
_p();
system("brew unlink php54 && brew link php$brewphp");
_p();
system("php -v");
_p();
}
if (!empty($error)) {
_p('ERROR DETAILS:');
_p($error);
_p();
exit(1);
} else {
_p("The zip file magento-gateway-ebanx.zip was created.");
_p();
}
exit(0);