Completed
Push — master ( 743f2a...743f2a )
by Steven
02:26
created
src/Magestead/Command/NewCommand.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 
25 25
     protected function configure()
26 26
     {
27
-        $this->_basePath    = dirname( __FILE__ ) . '/../../../';
28
-        $this->_projectPath = getcwd();
27
+        $this->_basePath=dirname(__FILE__).'/../../../';
28
+        $this->_projectPath=getcwd();
29 29
 
30 30
         $this->setName("new");
31 31
         $this->setDescription("Initialise new Magestead project into current working directory");
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
      */
42 42
     protected function execute(InputInterface $input, OutputInterface $output)
43 43
     {
44
-        $project = $this->setProject($input);
44
+        $project=$this->setProject($input);
45 45
 
46
-        $helper  = $this->getHelper('question');
47
-        $options = new Options($helper, $input, $output, $project);
46
+        $helper=$this->getHelper('question');
47
+        $options=new Options($helper, $input, $output, $project);
48 48
 
49 49
         $this->setupProject($output, $options);
50 50
 
@@ -62,17 +62,17 @@  discard block
 block discarded – undo
62 62
     protected function copyConfigFiles($source, $target, OutputInterface $output)
63 63
     {
64 64
         try {
65
-            $progress = new ProgressBar($output, 3720);
65
+            $progress=new ProgressBar($output, 3720);
66 66
             $progress->start();
67 67
             foreach (
68
-                $iterator = new \RecursiveIteratorIterator(
68
+                $iterator=new \RecursiveIteratorIterator(
69 69
                     new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS),
70 70
                     \RecursiveIteratorIterator::SELF_FIRST) as $item
71 71
             ) {
72 72
                 if ($item->isDir()) {
73
-                    mkdir($target . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
73
+                    mkdir($target.DIRECTORY_SEPARATOR.$iterator->getSubPathName());
74 74
                 } else {
75
-                    copy($item, $target . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
75
+                    copy($item, $target.DIRECTORY_SEPARATOR.$iterator->getSubPathName());
76 76
                 }
77 77
                 $progress->advance();
78 78
             }
@@ -89,24 +89,24 @@  discard block
 block discarded – undo
89 89
      */
90 90
     protected function configureProject(array $options, OutputInterface $output)
91 91
     {
92
-        $msConfig = $this->getConfigFile($output);
92
+        $msConfig=$this->getConfigFile($output);
93 93
 
94
-        $app = ($options['app'] == 'magento2') ? 'magento2' : 'magento';
95
-        $hostname = 'magestead-' . $options['base_url'];
94
+        $app=($options['app'] == 'magento2') ? 'magento2' : 'magento';
95
+        $hostname='magestead-'.$options['base_url'];
96 96
 
97
-        $msConfig['vagrantfile']['vm']['box']                           = $options['box'];
98
-        $msConfig['vagrantfile']['vm']['box_url']                       = $options['box'];
99
-        $msConfig['vagrantfile']['vm']['hostname']                      = $hostname;
100
-        $msConfig['vagrantfile']['vm']['memory']                        = $options['memory_limit'];
101
-        $msConfig['vagrantfile']['vm']['network']['private_network']    = $options['ip_address'];
102
-        $msConfig['magestead']['apps']['mba_12345']['type']             = $app;
103
-        $msConfig['magestead']['apps']['mba_12345']['locale']           = $options['locale'];
104
-        $msConfig['magestead']['apps']['mba_12345']['default_currency'] = $options['default_currency'];
105
-        $msConfig['magestead']['apps']['mba_12345']['base_url']         = $options['base_url'];
106
-        $msConfig['magestead']['os']                                    = $options['os'];
107
-        $msConfig['magestead']['server']                                = $options['server'];
97
+        $msConfig['vagrantfile']['vm']['box']=$options['box'];
98
+        $msConfig['vagrantfile']['vm']['box_url']=$options['box'];
99
+        $msConfig['vagrantfile']['vm']['hostname']=$hostname;
100
+        $msConfig['vagrantfile']['vm']['memory']=$options['memory_limit'];
101
+        $msConfig['vagrantfile']['vm']['network']['private_network']=$options['ip_address'];
102
+        $msConfig['magestead']['apps']['mba_12345']['type']=$app;
103
+        $msConfig['magestead']['apps']['mba_12345']['locale']=$options['locale'];
104
+        $msConfig['magestead']['apps']['mba_12345']['default_currency']=$options['default_currency'];
105
+        $msConfig['magestead']['apps']['mba_12345']['base_url']=$options['base_url'];
106
+        $msConfig['magestead']['os']=$options['os'];
107
+        $msConfig['magestead']['server']=$options['server'];
108 108
 
109
-        $this->_msConfig = $msConfig;
109
+        $this->_msConfig=$msConfig;
110 110
 
111 111
         $this->saveConfigFile($msConfig, $output);
112 112
 
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
      */
119 119
     protected function getConfigFile(OutputInterface $output)
120 120
     {
121
-        $yaml = new Parser();
121
+        $yaml=new Parser();
122 122
         try {
123
-            return $yaml->parse(file_get_contents($this->_projectPath . '/magestead.yaml'));
123
+            return $yaml->parse(file_get_contents($this->_projectPath.'/magestead.yaml'));
124 124
         } catch (ParseException $e) {
125 125
             $output->writeln('<error>Unable to parse the YAML string</error>');
126 126
             printf("Unable to parse the YAML string: %s", $e->getMessage());
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
      */
134 134
     protected function saveConfigFile(array $config, OutputInterface $output)
135 135
     {
136
-        $dumper = new Dumper();
137
-        $yaml   = $dumper->dump($config, 6);
136
+        $dumper=new Dumper();
137
+        $yaml=$dumper->dump($config, 6);
138 138
 
139 139
         try {
140
-            file_put_contents($this->_projectPath . '/magestead.yaml', $yaml);
140
+            file_put_contents($this->_projectPath.'/magestead.yaml', $yaml);
141 141
         } catch (\Exception $e) {
142 142
             $output->writeln('<error>Unable to write to the YAML file</error>');
143 143
         }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     protected function setupProject(OutputInterface $output, $options)
151 151
     {
152 152
         $output->writeln('<info>Setting up project structure</info>');
153
-        $provisionFolder = $this->_basePath . "provision";
153
+        $provisionFolder=$this->_basePath."provision";
154 154
         $this->copyConfigFiles($provisionFolder, $this->_projectPath, $output);
155 155
         $this->configureProject($options->getAllOptions(), $output);
156 156
     }
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
      */
163 163
     protected function setProject(InputInterface $input)
164 164
     {
165
-        $project = $input->getArgument('project');
166
-        $this->_projectPath = $this->_projectPath . '/' . $project;
165
+        $project=$input->getArgument('project');
166
+        $this->_projectPath=$this->_projectPath.'/'.$project;
167 167
 
168 168
 
169 169
         if (is_dir($this->_projectPath)) {
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.