Completed
Push — epic/2.0.0 ( 6a91e2...fdbf62 )
by Steven
04:49 queued 02:01
created
src/Magestead/Command/SetupCommand.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 
23 23
     protected function configure()
24 24
     {
25
-        $this->_basePath    = dirname( __FILE__ ) . '/../../../';
26
-        $this->_projectPath = getcwd();
25
+        $this->_basePath=dirname(__FILE__).'/../../../';
26
+        $this->_projectPath=getcwd();
27 27
 
28 28
         $this->setName("setup");
29 29
         $this->setDescription("Initialise Magestead project into current working directory");
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
      */
37 37
     protected function execute(InputInterface $input, OutputInterface $output)
38 38
     {
39
-        $helper  = $this->getHelper('question');
40
-        $options = new Options($helper, $input, $output);
39
+        $helper=$this->getHelper('question');
40
+        $options=new Options($helper, $input, $output);
41 41
 
42 42
         $this->setupProject($output, $options);
43 43
 
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
     protected function copyConfigFiles($source, $target, OutputInterface $output)
56 56
     {
57 57
         try {
58
-            $progress = new ProgressBar($output, 3720);
58
+            $progress=new ProgressBar($output, 3720);
59 59
             $progress->start();
60 60
             foreach (
61
-                $iterator = new \RecursiveIteratorIterator(
61
+                $iterator=new \RecursiveIteratorIterator(
62 62
                     new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS),
63 63
                     \RecursiveIteratorIterator::SELF_FIRST) as $item
64 64
             ) {
65 65
                 if ($item->isDir()) {
66
-                    mkdir($target . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
66
+                    mkdir($target.DIRECTORY_SEPARATOR.$iterator->getSubPathName());
67 67
                 } else {
68
-                    copy($item, $target . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
68
+                    copy($item, $target.DIRECTORY_SEPARATOR.$iterator->getSubPathName());
69 69
                 }
70 70
                 $progress->advance();
71 71
             }
@@ -82,24 +82,24 @@  discard block
 block discarded – undo
82 82
      */
83 83
     protected function configureProject(array $options, OutputInterface $output)
84 84
     {
85
-        $msConfig = $this->getConfigFile($output);
85
+        $msConfig=$this->getConfigFile($output);
86 86
 
87
-        $app = ($options['app'] == 'magento2') ? 'magento2' : 'magento';
88
-        $hostname = 'magestead-' . $options['base_url'];
87
+        $app=($options['app'] == 'magento2') ? 'magento2' : 'magento';
88
+        $hostname='magestead-'.$options['base_url'];
89 89
 
90
-        $msConfig['vagrantfile']['vm']['box']                           = $options['box'];
91
-        $msConfig['vagrantfile']['vm']['box_url']                       = $options['box'];
92
-        $msConfig['vagrantfile']['vm']['hostname']                      = $hostname;
93
-        $msConfig['vagrantfile']['vm']['memory']                        = $options['memory_limit'];
94
-        $msConfig['vagrantfile']['vm']['network']['private_network']    = $options['ip_address'];
95
-        $msConfig['magestead']['apps']['mba_12345']['type']             = $app;
96
-        $msConfig['magestead']['apps']['mba_12345']['locale']           = $options['locale'];
97
-        $msConfig['magestead']['apps']['mba_12345']['default_currency'] = $options['default_currency'];
98
-        $msConfig['magestead']['apps']['mba_12345']['base_url']         = $options['base_url'];
99
-        $msConfig['magestead']['os']                                    = $options['os'];
100
-        $msConfig['magestead']['server']                                = $options['server'];
90
+        $msConfig['vagrantfile']['vm']['box']=$options['box'];
91
+        $msConfig['vagrantfile']['vm']['box_url']=$options['box'];
92
+        $msConfig['vagrantfile']['vm']['hostname']=$hostname;
93
+        $msConfig['vagrantfile']['vm']['memory']=$options['memory_limit'];
94
+        $msConfig['vagrantfile']['vm']['network']['private_network']=$options['ip_address'];
95
+        $msConfig['magestead']['apps']['mba_12345']['type']=$app;
96
+        $msConfig['magestead']['apps']['mba_12345']['locale']=$options['locale'];
97
+        $msConfig['magestead']['apps']['mba_12345']['default_currency']=$options['default_currency'];
98
+        $msConfig['magestead']['apps']['mba_12345']['base_url']=$options['base_url'];
99
+        $msConfig['magestead']['os']=$options['os'];
100
+        $msConfig['magestead']['server']=$options['server'];
101 101
 
102
-        $this->_msConfig = $msConfig;
102
+        $this->_msConfig=$msConfig;
103 103
 
104 104
         $this->saveConfigFile($msConfig, $output);
105 105
 
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
      */
112 112
     protected function getConfigFile(OutputInterface $output)
113 113
     {
114
-        $yaml = new Parser();
114
+        $yaml=new Parser();
115 115
         try {
116
-            return $yaml->parse(file_get_contents($this->_projectPath . '/magestead.yaml'));
116
+            return $yaml->parse(file_get_contents($this->_projectPath.'/magestead.yaml'));
117 117
         } catch (ParseException $e) {
118 118
             $output->writeln('<error>Unable to parse the YAML string</error>');
119 119
             printf("Unable to parse the YAML string: %s", $e->getMessage());
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
      */
127 127
     protected function saveConfigFile(array $config, OutputInterface $output)
128 128
     {
129
-        $dumper = new Dumper();
130
-        $yaml   = $dumper->dump($config, 6);
129
+        $dumper=new Dumper();
130
+        $yaml=$dumper->dump($config, 6);
131 131
 
132 132
         try {
133
-            file_put_contents($this->_projectPath . '/magestead.yaml', $yaml);
133
+            file_put_contents($this->_projectPath.'/magestead.yaml', $yaml);
134 134
         } catch (\Exception $e) {
135 135
             $output->writeln('<error>Unable to write to the YAML file</error>');
136 136
         }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
     protected function setupProject(OutputInterface $output, $options)
144 144
     {
145 145
         $output->writeln('<info>Setting up project structure</info>');
146
-        $provisionFolder = $this->_basePath . "provision";
146
+        $provisionFolder=$this->_basePath."provision";
147 147
         $this->copyConfigFiles($provisionFolder, $this->_projectPath, $output);
148 148
         $this->configureProject($options->getAllOptions(), $output);
149 149
     }
Please login to merge, or discard this patch.
src/Magestead/Installers/Magento2Project.php 1 patch
Spacing   +24 added lines, -24 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->setComposerBinDir($projectPath);
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     protected function addPhpSpecPackage($projectPath, OutputInterface $output)
53 53
     {
54 54
         $output->writeln('<comment>Installing PHPSpec</comment>');
55
-        $command = 'cd '.$projectPath.'/public; composer require phpspec/phpspec --dev;';
55
+        $command='cd '.$projectPath.'/public; composer require phpspec/phpspec --dev;';
56 56
         new ProcessCommand($command, $projectPath, $output);
57 57
 
58 58
         $this->setPhpSpecPermissions($projectPath, $output);
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     protected function addBehatPackage($projectPath, OutputInterface $output)
66 66
     {
67 67
         $output->writeln('<comment>Installing Behat</comment>');
68
-        $command = 'cd '.$projectPath.'/public; composer require behat/behat --dev;';
68
+        $command='cd '.$projectPath.'/public; composer require behat/behat --dev;';
69 69
         new ProcessCommand($command, $projectPath, $output);
70 70
 
71 71
         $this->setBehatPermissions($projectPath, $output);
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
         $this->setPermissions($projectPath, $output);
82 82
 
83 83
         $output->writeln('<info>Installing Magento 2 Software</info>');
84
-        $locale           = $options['magestead']['apps']['mba_12345']['locale'];
85
-        $db_name          = $options['magestead']['apps']['mba_12345']['db_name'];
86
-        $base_url         = $options['magestead']['apps']['mba_12345']['base_url'];
87
-        $default_currency = $options['magestead']['apps']['mba_12345']['default_currency'];
84
+        $locale=$options['magestead']['apps']['mba_12345']['locale'];
85
+        $db_name=$options['magestead']['apps']['mba_12345']['db_name'];
86
+        $base_url=$options['magestead']['apps']['mba_12345']['base_url'];
87
+        $default_currency=$options['magestead']['apps']['mba_12345']['default_currency'];
88 88
 
89
-        $install = 'vagrant ssh -c \'cd /var/www/public; bin/magento setup:install --base-url=http://'.$base_url.'/ \
89
+        $install='vagrant ssh -c \'cd /var/www/public; bin/magento setup:install --base-url=http://'.$base_url.'/ \
90 90
 --db-host=localhost \
91 91
 --db-name='.$db_name.' \
92 92
 --db-user=magestead \
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
     protected function setPermissions($projectPath, OutputInterface $output)
114 114
     {
115 115
         $output->writeln('<info>Setting Permissions</info>');
116
-        $command = 'vagrant ssh -c \'cd /var/www/public; sudo find . -type d -exec chmod 700 {} \;\'';
116
+        $command='vagrant ssh -c \'cd /var/www/public; sudo find . -type d -exec chmod 700 {} \;\'';
117 117
         new ProcessCommand($command, $projectPath, $output);
118 118
         $output->writeln('<comment>Folder Permissions Set</comment>');
119 119
 
120
-        $command = 'vagrant ssh -c \'cd /var/www/public; sudo find . -type f -exec chmod 600 {} \;\'';
120
+        $command='vagrant ssh -c \'cd /var/www/public; sudo find . -type f -exec chmod 600 {} \;\'';
121 121
         new ProcessCommand($command, $projectPath, $output);
122 122
         $output->writeln('<comment>File Permissions Set</comment>');
123 123
 
124
-        $command = 'vagrant ssh -c \'cd /var/www/public; sudo chmod +x bin/magento; sudo chmod 755 bin/phpspec; sudo chmod 755 bin/behat;\'';
124
+        $command='vagrant ssh -c \'cd /var/www/public; sudo chmod +x bin/magento; sudo chmod 755 bin/phpspec; sudo chmod 755 bin/behat;\'';
125 125
         new ProcessCommand($command, $projectPath, $output);
126 126
         $output->writeln('<comment>bin/magento Permissions Set</comment>');
127 127
     }
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
     protected function configureRedis($projectPath, OutputInterface $output)
134 134
     {
135 135
         $output->writeln('<comment>Configuring Redis Cache</comment>');
136
-        $file = "$projectPath/public/app/etc/env.php";
137
-        $env  = include $file;
136
+        $file="$projectPath/public/app/etc/env.php";
137
+        $env=include $file;
138 138
 
139
-        $env['cache'] = [
139
+        $env['cache']=[
140 140
             'frontend' => [
141 141
                 'default' => [
142 142
                     'backend' => 'Cm_Cache_Backend_Redis',
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
             ],
176 176
         ];
177 177
 
178
-        file_put_contents($file, "<?php \n \n return ".var_export($env,true).";");
178
+        file_put_contents($file, "<?php \n \n return ".var_export($env, true).";");
179 179
     }
180 180
 
181 181
     /**
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
      */
186 186
     protected function finaliseSetup(array $options, $projectPath, OutputInterface $output)
187 187
     {
188
-        $command = 'vagrant ssh -c \'cd /var/www/public; bin/magento indexer:reindex; \'';
188
+        $command='vagrant ssh -c \'cd /var/www/public; bin/magento indexer:reindex; \'';
189 189
         $output->writeln('<comment>Reindexing Tables</comment>');
190 190
         new ProcessCommand($command, $projectPath, $output);
191 191
 
192
-        $command = 'vagrant ssh -c \'cd /var/www/public; bin/magento cache:flush;\'';
192
+        $command='vagrant ssh -c \'cd /var/www/public; bin/magento cache:flush;\'';
193 193
         $output->writeln('<comment>Flushing All Cache</comment>');
194 194
         new ProcessCommand($command, $projectPath, $output);
195 195
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
     protected function showCredentials(array $options, OutputInterface $output)
205 205
     {
206 206
         $output->writeln('<info>SUCCESS: Magestead has finished installing Magento 2!</info>');
207
-        $table = new Table($output);
207
+        $table=new Table($output);
208 208
         $table
209 209
             ->setHeaders(['Username', 'Password', 'Base URL', 'Admin URI'])
210 210
             ->setRows([
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
     protected function processVcs(array $options, $projectPath, OutputInterface $output)
225 225
     {
226 226
         if (!empty($options['repo_url'])) {
227
-            copy($projectPath . "/puphpet/magestead/magento2/stubs/gitignore.tmp", $projectPath . "/.gitignore");
227
+            copy($projectPath."/puphpet/magestead/magento2/stubs/gitignore.tmp", $projectPath."/.gitignore");
228 228
             return new VersionControl($options['repo_url'], $projectPath, $output);
229 229
         }
230 230
     }
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
      */
235 235
     protected function setComposerBinDir($projectPath)
236 236
     {
237
-        $file     = "$projectPath/public/composer.json";
238
-        $composer = json_decode(file_get_contents($file), true);
237
+        $file="$projectPath/public/composer.json";
238
+        $composer=json_decode(file_get_contents($file), true);
239 239
 
240
-        $composer['config']['bin-dir'] = 'bin';
240
+        $composer['config']['bin-dir']='bin';
241 241
         file_put_contents($file, json_encode($composer));
242 242
     }
243 243
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      */
248 248
     protected function setPhpSpecPermissions($projectPath, OutputInterface $output)
249 249
     {
250
-        $command = 'vagrant ssh -c \'cd /var/www/public; sudo chmod 755 bin/phpspec; bin/phpspec run\'';
250
+        $command='vagrant ssh -c \'cd /var/www/public; sudo chmod 755 bin/phpspec; bin/phpspec run\'';
251 251
         new ProcessCommand($command, $projectPath, $output);
252 252
     }
253 253
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
      */
258 258
     protected function setBehatPermissions($projectPath, OutputInterface $output)
259 259
     {
260
-        $command = 'vagrant ssh -c \'cd /var/www/public; sudo chmod 755 bin/behat; bin/behat --init\'';
260
+        $command='vagrant ssh -c \'cd /var/www/public; sudo chmod 755 bin/behat; bin/behat --init\'';
261 261
         new ProcessCommand($command, $projectPath, $output);
262 262
     }
263 263
 }
264 264
\ No newline at end of file
Please login to merge, or discard this patch.