@@ -22,8 +22,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |