-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathOptions.php
200 lines (179 loc) · 7.83 KB
/
Options.php
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?php
namespace AydinHassan\MagentoCoreComposerInstaller;
class Options
{
/**
* Any path which start with any of these
* entries should be ignored
*/
private array $deployExcludes = [
".git",
"composer.lock",
"composer.json",
];
/**
* Directories to ignore
* to reduce the size of the git ignore
*/
private array $ignoreDirectories = [
'/app/code/core/Mage',
'/app/code/core/Zend',
'/app/code/core/Enterprise',
'/dev',
'/lib/Zend',
'/lib/Varien',
'/lib/Magento',
'/lib/PEAR',
'/lib/Mage',
'/lib/phpseclib',
'/lib/flex',
'/lib/LinLibertineFont',
'/downloader',
'/js/extjs',
'/js/prototype',
'/js/calendar',
'/js/mage',
'/js/varien',
'/js/tiny_mce',
'/lib/Apache',
'/app/code/community/Phoenix/Moneybookers',
'/app/design/adminhtml/default/default/template/bundle',
'/app/design/adminhtml/default/default/template/catalog',
'/app/design/adminhtml/default/default/template/customer',
'/app/design/adminhtml/default/default/template/downloadable',
'/app/design/adminhtml/default/default/template/newsletter',
'/app/design/adminhtml/default/default/template/payment',
'/app/design/adminhtml/default/default/template/sales',
'/app/design/adminhtml/default/default/template/system',
'/app/design/adminhtml/default/default/template/widget',
'/app/design/adminhtml/default/default/template/xmlconnect',
'/app/design/frontend/base/default/template/bundle',
'/app/design/frontend/base/default/template/catalog',
'/app/design/frontend/base/default/template/checkout',
'/app/design/frontend/base/default/template/customer',
'/app/design/frontend/base/default/template/downloadable',
'/app/design/frontend/base/default/template/page',
'/app/design/frontend/base/default/template/payment',
'/app/design/frontend/base/default/template/paypal',
'/app/design/frontend/base/default/template/reports',
'/app/design/frontend/base/default/template/sales',
'/app/design/frontend/base/default/template/wishlist',
'/app/design/frontend/default/iphone/template/catalog',
'/app/design/frontend/default/iphone/template/checkout',
'/app/design/frontend/default/iphone/template/page',
'/app/design/frontend/default/iphone/template/sales',
'/app/design/frontend/default/iphone/template/wishlist',
'/app/design/frontend/rwd/default/template/bundle',
'/app/design/frontend/rwd/default/template/catalog',
'/app/design/frontend/rwd/default/template/checkout',
'/app/design/frontend/rwd/default/template/customer',
'/app/design/frontend/rwd/default/template/downloadable',
'/app/design/frontend/base/default/template/cataloginventory',
'/app/design/frontend/base/default/template/catalogsearch',
'/app/design/frontend/base/default/template/pagecache',
'/app/design/frontend/default/iphone/template/catalogsearch',
'/app/design/frontend/rwd/default/template/cataloginventory',
'/app/design/frontend/rwd/default/template/catalogsearch',
'/app/design/frontend/rwd/default/template/configurableswatches',
'/app/design/frontend/rwd/default/template/email',
'/app/design/frontend/rwd/default/template/page',
'/app/design/frontend/rwd/default/template/paypal',
'/app/design/frontend/rwd/default/template/persistent',
'/app/design/frontend/rwd/default/template/reports',
'/app/design/frontend/rwd/default/template/sales',
'/app/design/frontend/rwd/default/template/wishlist',
'/app/design/install/default/default/template/install',
'/skin/adminhtml/default/default/images/xmlconnect',
'/skin/frontend/base/default/images/moneybookers',
'/skin/frontend/rwd/default/scss',
'/app/design/adminhtml/default/default/template/paypal',
'/app/design/adminhtml/default/default/template/permissions',
'/app/design/adminhtml/default/default/template/report',
'/app/design/adminhtml/default/default/template/tax',
'/app/design/frontend/base/default/template/cms',
'/app/design/frontend/base/default/template/email',
'/app/design/frontend/base/default/template/moneybookers',
'/app/design/frontend/base/default/template/oauth',
'/app/design/frontend/base/default/template/review',
'/app/design/frontend/default/modern/template/catalog',
'/skin/adminhtml/default/default/xmlconnect',
'/skin/frontend/base/default/images/cookies',
'/skin/frontend/base/default/images/xmlconnect',
'/app/design/frontend/default/modern/template/catalogsearch'
];
/**
* Whether to append to the existing git ignore or remove it
* and start fresh
*/
private bool $appendToGitIgnore = true;
/**
* Whether the git ignore functionality is enabled
*/
private bool $gitIgnoreFunctionalityEnabled = true;
/**
* Magento Root Directory
*/
private string $magentoRootDir;
/**
* Name of Magento Core Package
*/
private string $magentoCorePackageType = 'magento-core';
public function __construct(array $packageExtra)
{
$coreInstallerOptions = [];
if (isset($packageExtra['magento-core-deploy']) && is_array($packageExtra['magento-core-deploy'])) {
$coreInstallerOptions = $packageExtra['magento-core-deploy'];
}
//merge excludes from root package composer.json file with default excludes
if (isset($coreInstallerOptions['excludes'])) {
if (!is_array($coreInstallerOptions['excludes'])) {
throw new \InvalidArgumentException("excludes must be an array of files/directories to ignore");
}
$this->deployExcludes = array_merge($this->deployExcludes, $coreInstallerOptions['excludes']);
}
//overwrite default ignore directories if some are specified in root package composer.json
if (isset($coreInstallerOptions['ignore-directories'])) {
if (!is_array($coreInstallerOptions['ignore-directories'])) {
throw new \InvalidArgumentException("ignore-directories must be an array of files/directories");
}
$this->ignoreDirectories = $coreInstallerOptions['ignore-directories'];
}
if (isset($coreInstallerOptions['git-ignore-enable'])) {
$this->gitIgnoreFunctionalityEnabled = (bool) $coreInstallerOptions['git-ignore-enable'];
}
if (isset($coreInstallerOptions['git-ignore-append'])) {
$this->appendToGitIgnore = (bool) $coreInstallerOptions['git-ignore-append'];
}
if (!isset($packageExtra['magento-root-dir'])) {
throw new \InvalidArgumentException("magento-root-dir must be specified in root package");
}
if (isset($packageExtra['magento-core-package-type'])) {
$this->magentoCorePackageType = $packageExtra['magento-core-package-type'];
}
$this->magentoRootDir = rtrim($packageExtra['magento-root-dir'], "/");
}
public function getDeployExcludes(): array
{
return $this->deployExcludes;
}
public function getIgnoreDirectories(): array
{
return $this->ignoreDirectories;
}
public function gitIgnoreFunctionalityEnabled(): bool
{
return $this->gitIgnoreFunctionalityEnabled;
}
public function appendToGitIgnore(): bool
{
return $this->appendToGitIgnore;
}
public function getMagentoRootDir(): string
{
return $this->magentoRootDir;
}
public function getMagentoCorePackageType(): string
{
return $this->magentoCorePackageType;
}
}