Completed
Push — develop ( c63e73...ef3c21 )
by Steven
02:27
created
src/Magestead/Installers/Magento2Project.php 2 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     protected function composerInstall($projectPath, OutputInterface $output)
38 38
     {
39 39
         $output->writeln('<info>Installing Magento 2 with Composer</info>');
40
-        $command = 'composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition public';
40
+        $command='composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition public';
41 41
         new ProcessCommand($command, $projectPath, $output);
42 42
 
43 43
         $this->copyAuthFile($projectPath);
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
      */
53 53
     protected function copyAuthFile($destination)
54 54
     {
55
-        $authFile = $_SERVER['HOME'] . "/.composer/auth.json";
56
-        return copy($authFile, $destination . '/public/auth.json');
55
+        $authFile=$_SERVER['HOME']."/.composer/auth.json";
56
+        return copy($authFile, $destination.'/public/auth.json');
57 57
     }
58 58
 
59 59
     /**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     protected function addPhpSpecPackage($projectPath, OutputInterface $output)
64 64
     {
65 65
         $output->writeln('<comment>Installing PHPSpec</comment>');
66
-        $command = 'cd '.$projectPath.'/public; composer require phpspec/phpspec --dev;';
66
+        $command='cd '.$projectPath.'/public; composer require phpspec/phpspec --dev;';
67 67
         new ProcessCommand($command, $projectPath, $output);
68 68
 
69 69
         $this->setPhpSpecPermissions($projectPath, $output);
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     protected function addBehatPackage($projectPath, OutputInterface $output)
77 77
     {
78 78
         $output->writeln('<comment>Installing Behat</comment>');
79
-        $command = 'cd '.$projectPath.'/public; composer require behat/behat --dev;';
79
+        $command='cd '.$projectPath.'/public; composer require behat/behat --dev;';
80 80
         new ProcessCommand($command, $projectPath, $output);
81 81
 
82 82
         $this->setBehatPermissions($projectPath, $output);
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
         $this->installSampleData($options, $projectPath, $output);
96 96
 
97 97
         $output->writeln('<info>Installing Magento 2 Software</info>');
98
-        $locale           = $config['magestead']['apps']['mba_12345']['locale'];
99
-        $db_name          = $config['magestead']['apps']['mba_12345']['db_name'];
100
-        $base_url         = $config['magestead']['apps']['mba_12345']['base_url'];
101
-        $default_currency = $config['magestead']['apps']['mba_12345']['default_currency'];
98
+        $locale=$config['magestead']['apps']['mba_12345']['locale'];
99
+        $db_name=$config['magestead']['apps']['mba_12345']['db_name'];
100
+        $base_url=$config['magestead']['apps']['mba_12345']['base_url'];
101
+        $default_currency=$config['magestead']['apps']['mba_12345']['default_currency'];
102 102
 
103
-        $install = 'vagrant ssh -c \'cd /var/www/public; bin/magento setup:install --base-url=http://'.$base_url.'/ \
103
+        $install='vagrant ssh -c \'cd /var/www/public; bin/magento setup:install --base-url=http://'.$base_url.'/ \
104 104
 --db-host=localhost \
105 105
 --db-name='.$db_name.' \
106 106
 --db-user=magestead \
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     {
130 130
         if (true === $options['installSampleData']) {
131 131
             $output->writeln('<info>Installing Magento 2 Sample Data</info>');
132
-            $deployCommand = 'vagrant ssh -c \'cd /var/www/public; bin/magento sampledata:deploy \'';
132
+            $deployCommand='vagrant ssh -c \'cd /var/www/public; bin/magento sampledata:deploy \'';
133 133
             new ProcessCommand($deployCommand, $projectPath, $output);
134 134
         }
135 135
     }
@@ -141,15 +141,15 @@  discard block
 block discarded – undo
141 141
     protected function setPermissions($projectPath, OutputInterface $output)
142 142
     {
143 143
         $output->writeln('<info>Setting Permissions</info>');
144
-        $command = 'vagrant ssh -c \'cd /var/www/public; sudo find . -type d -exec chmod 700 {} \;\'';
144
+        $command='vagrant ssh -c \'cd /var/www/public; sudo find . -type d -exec chmod 700 {} \;\'';
145 145
         new ProcessCommand($command, $projectPath, $output);
146 146
         $output->writeln('<comment>Folder Permissions Set</comment>');
147 147
 
148
-        $command = 'vagrant ssh -c \'cd /var/www/public; sudo find . -type f -exec chmod 600 {} \;\'';
148
+        $command='vagrant ssh -c \'cd /var/www/public; sudo find . -type f -exec chmod 600 {} \;\'';
149 149
         new ProcessCommand($command, $projectPath, $output);
150 150
         $output->writeln('<comment>File Permissions Set</comment>');
151 151
 
152
-        $command = 'vagrant ssh -c \'cd /var/www/public; sudo chmod +x bin/magento; sudo chmod 755 bin/phpspec; sudo chmod 755 bin/behat;\'';
152
+        $command='vagrant ssh -c \'cd /var/www/public; sudo chmod +x bin/magento; sudo chmod 755 bin/phpspec; sudo chmod 755 bin/behat;\'';
153 153
         new ProcessCommand($command, $projectPath, $output);
154 154
         $output->writeln('<comment>bin/magento Permissions Set</comment>');
155 155
     }
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
     protected function configureRedis($projectPath, OutputInterface $output)
162 162
     {
163 163
         $output->writeln('<comment>Configuring Redis Cache</comment>');
164
-        $file = "$projectPath/public/app/etc/env.php";
165
-        $env  = include $file;
164
+        $file="$projectPath/public/app/etc/env.php";
165
+        $env=include $file;
166 166
 
167
-        $env['cache'] = [
167
+        $env['cache']=[
168 168
             'frontend' => [
169 169
                 'default' => [
170 170
                     'backend' => 'Cm_Cache_Backend_Redis',
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
             ],
204 204
         ];
205 205
 
206
-        file_put_contents($file, "<?php \n \n return ".var_export($env,true).";");
206
+        file_put_contents($file, "<?php \n \n return ".var_export($env, true).";");
207 207
     }
208 208
 
209 209
     /**
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
      */
214 214
     protected function finaliseSetup(array $options, $projectPath, OutputInterface $output)
215 215
     {
216
-        $command = 'vagrant ssh -c \'cd /var/www/public; bin/magento indexer:reindex; \'';
216
+        $command='vagrant ssh -c \'cd /var/www/public; bin/magento indexer:reindex; \'';
217 217
         $output->writeln('<comment>Reindexing Tables</comment>');
218 218
         new ProcessCommand($command, $projectPath, $output);
219 219
 
220
-        $command = 'vagrant ssh -c \'cd /var/www/public; bin/magento cache:flush;\'';
220
+        $command='vagrant ssh -c \'cd /var/www/public; bin/magento cache:flush;\'';
221 221
         $output->writeln('<comment>Flushing All Cache</comment>');
222 222
         new ProcessCommand($command, $projectPath, $output);
223 223
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
     protected function showCredentials(array $options, OutputInterface $output)
233 233
     {
234 234
         $output->writeln('<info>SUCCESS: Magestead has finished installing Magento 2!</info>');
235
-        $table = new Table($output);
235
+        $table=new Table($output);
236 236
         $table
237 237
             ->setHeaders(['Username', 'Password', 'Base URL', 'Admin URI'])
238 238
             ->setRows([
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
     protected function processVcs(array $options, $projectPath, OutputInterface $output)
253 253
     {
254 254
         if (!empty($options['repo_url'])) {
255
-            copy($projectPath . "/puphpet/magestead/magento2/stubs/gitignore.tmp", $projectPath . "/.gitignore");
255
+            copy($projectPath."/puphpet/magestead/magento2/stubs/gitignore.tmp", $projectPath."/.gitignore");
256 256
             return new VersionControl($options['repo_url'], $projectPath, $output);
257 257
         }
258 258
     }
@@ -262,10 +262,10 @@  discard block
 block discarded – undo
262 262
      */
263 263
     protected function setComposerBinDir($projectPath)
264 264
     {
265
-        $file     = "$projectPath/public/composer.json";
266
-        $composer = json_decode(file_get_contents($file), true);
265
+        $file="$projectPath/public/composer.json";
266
+        $composer=json_decode(file_get_contents($file), true);
267 267
 
268
-        $composer['config']['bin-dir'] = 'bin';
268
+        $composer['config']['bin-dir']='bin';
269 269
         file_put_contents($file, json_encode($composer));
270 270
     }
271 271
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
      */
276 276
     protected function setPhpSpecPermissions($projectPath, OutputInterface $output)
277 277
     {
278
-        $command = 'vagrant ssh -c \'cd /var/www/public; sudo chmod 755 bin/phpspec; bin/phpspec run\'';
278
+        $command='vagrant ssh -c \'cd /var/www/public; sudo chmod 755 bin/phpspec; bin/phpspec run\'';
279 279
         new ProcessCommand($command, $projectPath, $output);
280 280
     }
281 281
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      */
286 286
     protected function setBehatPermissions($projectPath, OutputInterface $output)
287 287
     {
288
-        $command = 'vagrant ssh -c \'cd /var/www/public; sudo chmod 755 bin/behat; bin/behat --init\'';
288
+        $command='vagrant ssh -c \'cd /var/www/public; sudo chmod 755 bin/behat; bin/behat --init\'';
289 289
         new ProcessCommand($command, $projectPath, $output);
290 290
     }
291 291
 }
292 292
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +15 added lines, -30 removed lines patch added patch discarded remove patch
@@ -20,8 +20,7 @@  discard block
 block discarded – undo
20 20
      * @param $projectPath
21 21
      * @param OutputInterface $output
22 22
      */
23
-    public function __construct(array $options, array $config, $projectPath, OutputInterface $output)
24
-    {
23
+    public function __construct(array $options, array $config, $projectPath, OutputInterface $output) {
25 24
         $this->composerInstall($projectPath, $output);
26 25
         $this->installMagento($config, $options, $projectPath, $output);
27 26
         $this->finaliseSetup($options, $projectPath, $output);
@@ -34,8 +33,7 @@  discard block
 block discarded – undo
34 33
      * @param $projectPath
35 34
      * @param OutputInterface $output
36 35
      */
37
-    protected function composerInstall($projectPath, OutputInterface $output)
38
-    {
36
+    protected function composerInstall($projectPath, OutputInterface $output) {
39 37
         $output->writeln('<info>Installing Magento 2 with Composer</info>');
40 38
         $command = 'composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition public';
41 39
         new ProcessCommand($command, $projectPath, $output);
@@ -50,8 +48,7 @@  discard block
 block discarded – undo
50 48
      * @param $destination
51 49
      * @return bool
52 50
      */
53
-    protected function copyAuthFile($destination)
54
-    {
51
+    protected function copyAuthFile($destination) {
55 52
         $authFile = $_SERVER['HOME'] . "/.composer/auth.json";
56 53
         return copy($authFile, $destination . '/public/auth.json');
57 54
     }
@@ -60,8 +57,7 @@  discard block
 block discarded – undo
60 57
      * @param $projectPath
61 58
      * @param OutputInterface $output
62 59
      */
63
-    protected function addPhpSpecPackage($projectPath, OutputInterface $output)
64
-    {
60
+    protected function addPhpSpecPackage($projectPath, OutputInterface $output) {
65 61
         $output->writeln('<comment>Installing PHPSpec</comment>');
66 62
         $command = 'cd '.$projectPath.'/public; composer require phpspec/phpspec --dev;';
67 63
         new ProcessCommand($command, $projectPath, $output);
@@ -73,8 +69,7 @@  discard block
 block discarded – undo
73 69
      * @param $projectPath
74 70
      * @param OutputInterface $output
75 71
      */
76
-    protected function addBehatPackage($projectPath, OutputInterface $output)
77
-    {
72
+    protected function addBehatPackage($projectPath, OutputInterface $output) {
78 73
         $output->writeln('<comment>Installing Behat</comment>');
79 74
         $command = 'cd '.$projectPath.'/public; composer require behat/behat --dev;';
80 75
         new ProcessCommand($command, $projectPath, $output);
@@ -88,8 +83,7 @@  discard block
 block discarded – undo
88 83
      * @param $projectPath
89 84
      * @param OutputInterface $output
90 85
      */
91
-    protected function installMagento(array $config, array $options, $projectPath, OutputInterface $output)
92
-    {
86
+    protected function installMagento(array $config, array $options, $projectPath, OutputInterface $output) {
93 87
         $this->setPermissions($projectPath, $output);
94 88
 
95 89
         $this->installSampleData($options, $projectPath, $output);
@@ -125,8 +119,7 @@  discard block
 block discarded – undo
125 119
      * @param $projectPath
126 120
      * @param OutputInterface $output
127 121
      */
128
-    protected function installSampleData($options, $projectPath, OutputInterface $output)
129
-    {
122
+    protected function installSampleData($options, $projectPath, OutputInterface $output) {
130 123
         if (true === $options['installSampleData']) {
131 124
             $output->writeln('<info>Installing Magento 2 Sample Data</info>');
132 125
             $deployCommand = 'vagrant ssh -c \'cd /var/www/public; bin/magento sampledata:deploy \'';
@@ -138,8 +131,7 @@  discard block
 block discarded – undo
138 131
      * @param $projectPath
139 132
      * @param OutputInterface $output
140 133
      */
141
-    protected function setPermissions($projectPath, OutputInterface $output)
142
-    {
134
+    protected function setPermissions($projectPath, OutputInterface $output) {
143 135
         $output->writeln('<info>Setting Permissions</info>');
144 136
         $command = 'vagrant ssh -c \'cd /var/www/public; sudo find . -type d -exec chmod 700 {} \;\'';
145 137
         new ProcessCommand($command, $projectPath, $output);
@@ -158,8 +150,7 @@  discard block
 block discarded – undo
158 150
      * @param $projectPath
159 151
      * @param OutputInterface $output
160 152
      */
161
-    protected function configureRedis($projectPath, OutputInterface $output)
162
-    {
153
+    protected function configureRedis($projectPath, OutputInterface $output) {
163 154
         $output->writeln('<comment>Configuring Redis Cache</comment>');
164 155
         $file = "$projectPath/public/app/etc/env.php";
165 156
         $env  = include $file;
@@ -211,8 +202,7 @@  discard block
 block discarded – undo
211 202
      * @param $projectPath
212 203
      * @param OutputInterface $output
213 204
      */
214
-    protected function finaliseSetup(array $options, $projectPath, OutputInterface $output)
215
-    {
205
+    protected function finaliseSetup(array $options, $projectPath, OutputInterface $output) {
216 206
         $command = 'vagrant ssh -c \'cd /var/www/public; bin/magento indexer:reindex; \'';
217 207
         $output->writeln('<comment>Reindexing Tables</comment>');
218 208
         new ProcessCommand($command, $projectPath, $output);
@@ -229,8 +219,7 @@  discard block
 block discarded – undo
229 219
      * @param array $options
230 220
      * @param OutputInterface $output
231 221
      */
232
-    protected function showCredentials(array $options, OutputInterface $output)
233
-    {
222
+    protected function showCredentials(array $options, OutputInterface $output) {
234 223
         $output->writeln('<info>SUCCESS: Magestead has finished installing Magento 2!</info>');
235 224
         $table = new Table($output);
236 225
         $table
@@ -249,8 +238,7 @@  discard block
 block discarded – undo
249 238
      * @param OutputInterface $output
250 239
      * @return VersionControl|null
251 240
      */
252
-    protected function processVcs(array $options, $projectPath, OutputInterface $output)
253
-    {
241
+    protected function processVcs(array $options, $projectPath, OutputInterface $output) {
254 242
         if (!empty($options['repo_url'])) {
255 243
             copy($projectPath . "/puphpet/magestead/magento2/stubs/gitignore.tmp", $projectPath . "/.gitignore");
256 244
             return new VersionControl($options['repo_url'], $projectPath, $output);
@@ -260,8 +248,7 @@  discard block
 block discarded – undo
260 248
     /**
261 249
      * @param $projectPath
262 250
      */
263
-    protected function setComposerBinDir($projectPath)
264
-    {
251
+    protected function setComposerBinDir($projectPath) {
265 252
         $file     = "$projectPath/public/composer.json";
266 253
         $composer = json_decode(file_get_contents($file), true);
267 254
 
@@ -273,8 +260,7 @@  discard block
 block discarded – undo
273 260
      * @param $projectPath
274 261
      * @param OutputInterface $output
275 262
      */
276
-    protected function setPhpSpecPermissions($projectPath, OutputInterface $output)
277
-    {
263
+    protected function setPhpSpecPermissions($projectPath, OutputInterface $output) {
278 264
         $command = 'vagrant ssh -c \'cd /var/www/public; sudo chmod 755 bin/phpspec; bin/phpspec run\'';
279 265
         new ProcessCommand($command, $projectPath, $output);
280 266
     }
@@ -283,8 +269,7 @@  discard block
 block discarded – undo
283 269
      * @param $projectPath
284 270
      * @param OutputInterface $output
285 271
      */
286
-    protected function setBehatPermissions($projectPath, OutputInterface $output)
287
-    {
272
+    protected function setBehatPermissions($projectPath, OutputInterface $output) {
288 273
         $command = 'vagrant ssh -c \'cd /var/www/public; sudo chmod 755 bin/behat; bin/behat --init\'';
289 274
         new ProcessCommand($command, $projectPath, $output);
290 275
     }
Please login to merge, or discard this patch.