Completed
Push — feature/folder-permissions ( 9a085f...1cbeb1 )
by Steven
02:51
created
src/Magestead/Command/SetupCommand.php 1 patch
Spacing   +27 added lines, -27 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,22 +82,22 @@  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';
87
+        $app=($options['app'] == 'magento2') ? 'magento2' : 'magento';
88 88
 
89
-        $msConfig['vagrantfile']['vm']['box']                           = $options['box'];
90
-        $msConfig['vagrantfile']['vm']['box_url']                       = $options['box'];
91
-        $msConfig['vagrantfile']['vm']['memory']                        = $options['memory_limit'];
92
-        $msConfig['vagrantfile']['vm']['network']['private_network']    = $options['ip_address'];
93
-        $msConfig['magestead']['apps']['mba_12345']['type']             = $app;
94
-        $msConfig['magestead']['apps']['mba_12345']['locale']           = $options['locale'];
95
-        $msConfig['magestead']['apps']['mba_12345']['default_currency'] = $options['default_currency'];
96
-        $msConfig['magestead']['apps']['mba_12345']['base_url']         = $options['base_url'];
97
-        $msConfig['magestead']['os']                                    = $options['os'];
98
-        $msConfig['magestead']['server']                                = $options['server'];
89
+        $msConfig['vagrantfile']['vm']['box']=$options['box'];
90
+        $msConfig['vagrantfile']['vm']['box_url']=$options['box'];
91
+        $msConfig['vagrantfile']['vm']['memory']=$options['memory_limit'];
92
+        $msConfig['vagrantfile']['vm']['network']['private_network']=$options['ip_address'];
93
+        $msConfig['magestead']['apps']['mba_12345']['type']=$app;
94
+        $msConfig['magestead']['apps']['mba_12345']['locale']=$options['locale'];
95
+        $msConfig['magestead']['apps']['mba_12345']['default_currency']=$options['default_currency'];
96
+        $msConfig['magestead']['apps']['mba_12345']['base_url']=$options['base_url'];
97
+        $msConfig['magestead']['os']=$options['os'];
98
+        $msConfig['magestead']['server']=$options['server'];
99 99
 
100
-        $this->_msConfig = $msConfig;
100
+        $this->_msConfig=$msConfig;
101 101
 
102 102
         $this->saveConfigFile($msConfig, $output);
103 103
 
@@ -109,9 +109,9 @@  discard block
 block discarded – undo
109 109
      */
110 110
     protected function getConfigFile(OutputInterface $output)
111 111
     {
112
-        $yaml = new Parser();
112
+        $yaml=new Parser();
113 113
         try {
114
-            return $yaml->parse(file_get_contents($this->_projectPath . '/magestead.yaml'));
114
+            return $yaml->parse(file_get_contents($this->_projectPath.'/magestead.yaml'));
115 115
         } catch (ParseException $e) {
116 116
             $output->writeln('<error>Unable to parse the YAML string</error>');
117 117
             printf("Unable to parse the YAML string: %s", $e->getMessage());
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
      */
125 125
     protected function saveConfigFile(array $config, OutputInterface $output)
126 126
     {
127
-        $dumper = new Dumper();
128
-        $yaml   = $dumper->dump($config, 6);
127
+        $dumper=new Dumper();
128
+        $yaml=$dumper->dump($config, 6);
129 129
 
130 130
         try {
131
-            file_put_contents($this->_projectPath . '/magestead.yaml', $yaml);
131
+            file_put_contents($this->_projectPath.'/magestead.yaml', $yaml);
132 132
         } catch (\Exception $e) {
133 133
             $output->writeln('<error>Unable to write to the YAML file</error>');
134 134
         }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     protected function setupProject(OutputInterface $output, $options)
142 142
     {
143 143
         $output->writeln('<info>Setting up project structure</info>');
144
-        $provisionFolder = $this->_basePath . "provision";
144
+        $provisionFolder=$this->_basePath."provision";
145 145
         $this->copyConfigFiles($provisionFolder, $this->_projectPath, $output);
146 146
         $this->configureProject($options->getAllOptions(), $output);
147 147
     }
Please login to merge, or discard this patch.