@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | /** |
| 11 | 11 | * @var string |
| 12 | 12 | */ |
| 13 | - protected $_apiUrl = 'http://api.magestead.com/v1/usage'; |
|
| 13 | + protected $_apiUrl='http://api.magestead.com/v1/usage'; |
|
| 14 | 14 | // protected $_apiUrl = "http://magestead-api.app/v1/usage"; |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * @var array |
| 18 | 18 | */ |
| 19 | - protected $_params = []; |
|
| 19 | + protected $_params=[]; |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * UsageApi constructor. |
@@ -25,30 +25,30 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function __construct($data) |
| 27 | 27 | { |
| 28 | - $this->_params['os_type'] = urlencode($data['os']); |
|
| 29 | - $this->_params['server_type'] = urlencode($data['server']); |
|
| 30 | - $this->_params['php_version'] = urlencode($data['phpver']); |
|
| 31 | - $this->_params['application_version'] = urlencode($data['app']); |
|
| 32 | - $this->_params['vm_memory_limit'] = urlencode($data['memory_limit']); |
|
| 33 | - $this->_params['vm_cpu_count'] = urlencode($data['cpus']); |
|
| 34 | - $this->_params['ip_address'] = urlencode($data['ip_address']); |
|
| 35 | - $this->_params['box'] = urlencode($data['box']); |
|
| 36 | - $this->_params['locale'] = urlencode($data['locale']); |
|
| 37 | - $this->_params['default_currency'] = urlencode($data['default_currency']); |
|
| 28 | + $this->_params['os_type']=urlencode($data['os']); |
|
| 29 | + $this->_params['server_type']=urlencode($data['server']); |
|
| 30 | + $this->_params['php_version']=urlencode($data['phpver']); |
|
| 31 | + $this->_params['application_version']=urlencode($data['app']); |
|
| 32 | + $this->_params['vm_memory_limit']=urlencode($data['memory_limit']); |
|
| 33 | + $this->_params['vm_cpu_count']=urlencode($data['cpus']); |
|
| 34 | + $this->_params['ip_address']=urlencode($data['ip_address']); |
|
| 35 | + $this->_params['box']=urlencode($data['box']); |
|
| 36 | + $this->_params['locale']=urlencode($data['locale']); |
|
| 37 | + $this->_params['default_currency']=urlencode($data['default_currency']); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function send() |
| 41 | 41 | { |
| 42 | - $fields_string = $this->getFieldsString(); |
|
| 42 | + $fields_string=$this->getFieldsString(); |
|
| 43 | 43 | |
| 44 | - $ch = curl_init(); |
|
| 44 | + $ch=curl_init(); |
|
| 45 | 45 | |
| 46 | 46 | curl_setopt($ch, CURLOPT_URL, $this->_apiUrl); |
| 47 | 47 | curl_setopt($ch, CURLOPT_POST, count($this->_params)); |
| 48 | 48 | curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); |
| 49 | 49 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 50 | 50 | |
| 51 | - $result = curl_exec($ch); |
|
| 51 | + $result=curl_exec($ch); |
|
| 52 | 52 | |
| 53 | 53 | curl_close($ch); |
| 54 | 54 | } |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | protected function getFieldsString() |
| 60 | 60 | { |
| 61 | - $fields_string = ''; |
|
| 61 | + $fields_string=''; |
|
| 62 | 62 | foreach ($this->_params as $key => $value) { |
| 63 | - $fields_string .= $key.'='.$value.'&'; |
|
| 63 | + $fields_string.=$key.'='.$value.'&'; |
|
| 64 | 64 | } |
| 65 | 65 | rtrim($fields_string, '&'); |
| 66 | 66 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | protected function configure() |
| 19 | 19 | { |
| 20 | - $this->_projectPath = getcwd(); |
|
| 20 | + $this->_projectPath=getcwd(); |
|
| 21 | 21 | $this->setName('redis:flush-all'); |
| 22 | 22 | $this->setDescription('Flush redis storage'); |
| 23 | 23 | } |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | $output->writeln('<info>Flushing Redis Storage</info>'); |
| 34 | 34 | |
| 35 | - $command = 'redis-cli flushall'; |
|
| 36 | - $pCommand = "vagrant ssh -c '".$command."'"; |
|
| 35 | + $command='redis-cli flushall'; |
|
| 36 | + $pCommand="vagrant ssh -c '".$command."'"; |
|
| 37 | 37 | |
| 38 | 38 | return new ProcessCommand($pCommand, $this->_projectPath, $output); |
| 39 | 39 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | protected function configure() |
| 19 | 19 | { |
| 20 | - $this->_projectPath = getcwd(); |
|
| 20 | + $this->_projectPath=getcwd(); |
|
| 21 | 21 | |
| 22 | 22 | $this->setName('vm:run'); |
| 23 | 23 | $this->setDescription('Run commands on your development machine via SSH'); |
@@ -32,10 +32,10 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | protected function execute(InputInterface $input, OutputInterface $output) |
| 34 | 34 | { |
| 35 | - $command = $input->getArgument('ssh-command'); |
|
| 35 | + $command=$input->getArgument('ssh-command'); |
|
| 36 | 36 | $output->writeln('<info>Running "'.$command.'" on Magestead</info>'); |
| 37 | 37 | |
| 38 | - $passedCommand = "vagrant ssh -c '".$command."'"; |
|
| 38 | + $passedCommand="vagrant ssh -c '".$command."'"; |
|
| 39 | 39 | |
| 40 | 40 | return new ProcessCommand($passedCommand, $this->_projectPath, $output); |
| 41 | 41 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | protected function configure() |
| 21 | 21 | { |
| 22 | - $this->_projectPath = getcwd(); |
|
| 22 | + $this->_projectPath=getcwd(); |
|
| 23 | 23 | $this->setName('index:mode:set'); |
| 24 | 24 | $this->setDescription('Set index mode type'); |
| 25 | 25 | $this->addArgument('mode', InputArgument::REQUIRED, '{realtime|schedule} [indexer]'); |
@@ -33,11 +33,11 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | protected function execute(InputInterface $input, OutputInterface $output) |
| 35 | 35 | { |
| 36 | - $indexMode = $input->getArgument('mode'); |
|
| 37 | - $command = $this->getCommand(new Config($output), $indexMode); |
|
| 36 | + $indexMode=$input->getArgument('mode'); |
|
| 37 | + $command=$this->getCommand(new Config($output), $indexMode); |
|
| 38 | 38 | if ($command) { |
| 39 | 39 | $output->writeln('<info>Setting index mode</info>'); |
| 40 | - $pCommand = "vagrant ssh -c '".$command."'"; |
|
| 40 | + $pCommand="vagrant ssh -c '".$command."'"; |
|
| 41 | 41 | |
| 42 | 42 | return new ProcessCommand($pCommand, $this->_projectPath, $output); |
| 43 | 43 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | protected function getCommand(Config $config, $mode) |
| 55 | 55 | { |
| 56 | - $type = $config->type; |
|
| 56 | + $type=$config->type; |
|
| 57 | 57 | switch ($type) { |
| 58 | 58 | case 'magento2': |
| 59 | 59 | return "cd /var/www/public;bin/magento indexer:set-mode $mode"; |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | protected function configure() |
| 21 | 21 | { |
| 22 | - $this->_projectPath = getcwd(); |
|
| 22 | + $this->_projectPath=getcwd(); |
|
| 23 | 23 | $this->setName('index:reindex'); |
| 24 | 24 | $this->setDescription('Reindex data'); |
| 25 | 25 | $this->addArgument('index', InputArgument::OPTIONAL, '[indexer]'); |
@@ -34,10 +34,10 @@ discard block |
||
| 34 | 34 | protected function execute(InputInterface $input, OutputInterface $output) |
| 35 | 35 | { |
| 36 | 36 | $output->writeln('<info>Reindexing data</info>'); |
| 37 | - $index = $input->getArgument('index'); |
|
| 37 | + $index=$input->getArgument('index'); |
|
| 38 | 38 | |
| 39 | - $command = $this->getCommand(new Config($output), $index); |
|
| 40 | - $pCommand = "vagrant ssh -c '".$command."'"; |
|
| 39 | + $command=$this->getCommand(new Config($output), $index); |
|
| 40 | + $pCommand="vagrant ssh -c '".$command."'"; |
|
| 41 | 41 | |
| 42 | 42 | return new ProcessCommand($pCommand, $this->_projectPath, $output); |
| 43 | 43 | } |
@@ -50,10 +50,10 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | protected function getCommand(Config $config, $index) |
| 52 | 52 | { |
| 53 | - $type = $config->type; |
|
| 53 | + $type=$config->type; |
|
| 54 | 54 | switch ($type) { |
| 55 | 55 | case 'magento': |
| 56 | - $index = (!is_null($index)) ? ' '.$index : ':all'; |
|
| 56 | + $index=(!is_null($index)) ? ' '.$index : ':all'; |
|
| 57 | 57 | |
| 58 | 58 | return "cd /var/www/public;../bin/n98-magerun.phar index:reindex$index"; |
| 59 | 59 | break; |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | protected function configure() |
| 21 | 21 | { |
| 22 | - $this->_projectPath = getcwd(); |
|
| 22 | + $this->_projectPath=getcwd(); |
|
| 23 | 23 | $this->setName('index:mode:show'); |
| 24 | 24 | $this->setDescription('Show index mode'); |
| 25 | 25 | $this->addArgument('index', InputArgument::OPTIONAL, '[indexer]'); |
@@ -33,12 +33,12 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | protected function execute(InputInterface $input, OutputInterface $output) |
| 35 | 35 | { |
| 36 | - $index = $input->getArgument('index'); |
|
| 36 | + $index=$input->getArgument('index'); |
|
| 37 | 37 | |
| 38 | - $command = $this->getCommand(new Config($output), $index); |
|
| 38 | + $command=$this->getCommand(new Config($output), $index); |
|
| 39 | 39 | if ($command) { |
| 40 | 40 | $output->writeln('<info>Getting index mode</info>'); |
| 41 | - $passedCommand = "vagrant ssh -c '".$command."'"; |
|
| 41 | + $passedCommand="vagrant ssh -c '".$command."'"; |
|
| 42 | 42 | |
| 43 | 43 | return new ProcessCommand($passedCommand, $this->_projectPath, $output); |
| 44 | 44 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | protected function getCommand(Config $config, $index) |
| 56 | 56 | { |
| 57 | - $type = $config->type; |
|
| 57 | + $type=$config->type; |
|
| 58 | 58 | switch ($type) { |
| 59 | 59 | case 'magento2': |
| 60 | 60 | return "cd /var/www/public;bin/magento indexer:show-mode $index"; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | protected function configure() |
| 20 | 20 | { |
| 21 | - $this->_projectPath = getcwd(); |
|
| 21 | + $this->_projectPath=getcwd(); |
|
| 22 | 22 | $this->setName('cache:enable'); |
| 23 | 23 | $this->setDescription('Enable cache types'); |
| 24 | 24 | } |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | { |
| 34 | 34 | $output->writeln('<info>Enabling all cache types</info>'); |
| 35 | 35 | |
| 36 | - $command = $this->getCommand(new Config($output)); |
|
| 37 | - $pCommand = "vagrant ssh -c '".$command."'"; |
|
| 36 | + $command=$this->getCommand(new Config($output)); |
|
| 37 | + $pCommand="vagrant ssh -c '".$command."'"; |
|
| 38 | 38 | |
| 39 | 39 | return new ProcessCommand($pCommand, $this->_projectPath, $output); |
| 40 | 40 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | protected function getCommand(Config $config) |
| 48 | 48 | { |
| 49 | - $type = $config->type; |
|
| 49 | + $type=$config->type; |
|
| 50 | 50 | switch ($type) { |
| 51 | 51 | case 'magento': |
| 52 | 52 | return 'cd /var/www/public;../bin/n98-magerun.phar cache:enable'; |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | protected function configure() |
| 19 | 19 | { |
| 20 | - $this->_projectPath = getcwd(); |
|
| 20 | + $this->_projectPath=getcwd(); |
|
| 21 | 21 | |
| 22 | 22 | $this->setName('behat'); |
| 23 | 23 | $this->setDescription('Run Behat against your project'); |
@@ -32,14 +32,14 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | protected function execute(InputInterface $input, OutputInterface $output) |
| 34 | 34 | { |
| 35 | - $option = $input->getArgument('option'); |
|
| 36 | - $command = $this->getCommand(new Config($output), $option); |
|
| 35 | + $option=$input->getArgument('option'); |
|
| 36 | + $command=$this->getCommand(new Config($output), $option); |
|
| 37 | 37 | if (!$command) { |
| 38 | 38 | return $output->writeln('<error>Command not available for this application</error>'); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $output->writeln('<info>Running Behat</info>'); |
| 42 | - $passedCommand = "vagrant ssh -c '".$command."'"; |
|
| 42 | + $passedCommand="vagrant ssh -c '".$command."'"; |
|
| 43 | 43 | passthru($passedCommand); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | protected function getCommand(Config $config, $option) |
| 53 | 53 | { |
| 54 | - $type = $config->type; |
|
| 54 | + $type=$config->type; |
|
| 55 | 55 | switch ($type) { |
| 56 | 56 | case 'magento': |
| 57 | 57 | return "cd /var/www;bin/behat $option"; |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | protected function configure() |
| 28 | 28 | { |
| 29 | - $this->_basePath = dirname(__FILE__).'/../../../'; |
|
| 30 | - $this->_projectPath = getcwd(); |
|
| 29 | + $this->_basePath=dirname(__FILE__).'/../../../'; |
|
| 30 | + $this->_projectPath=getcwd(); |
|
| 31 | 31 | |
| 32 | 32 | $this->setName('new'); |
| 33 | 33 | $this->setDescription('Initialise new Magestead project into current working directory'); |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected function execute(InputInterface $input, OutputInterface $output) |
| 46 | 46 | { |
| 47 | - $project = $this->setProject($input); |
|
| 47 | + $project=$this->setProject($input); |
|
| 48 | 48 | |
| 49 | - $helper = $this->getHelper('question'); |
|
| 50 | - $options = new Options($helper, $input, $output, $project); |
|
| 49 | + $helper=$this->getHelper('question'); |
|
| 50 | + $options=new Options($helper, $input, $output, $project); |
|
| 51 | 51 | |
| 52 | 52 | $this->setupProject($output, $options); |
| 53 | 53 | |
@@ -65,10 +65,10 @@ discard block |
||
| 65 | 65 | protected function copyConfigFiles($source, $target, OutputInterface $output) |
| 66 | 66 | { |
| 67 | 67 | try { |
| 68 | - $progress = new ProgressBar($output, 3720); |
|
| 68 | + $progress=new ProgressBar($output, 3720); |
|
| 69 | 69 | $progress->start(); |
| 70 | 70 | foreach ( |
| 71 | - $iterator = new \RecursiveIteratorIterator( |
|
| 71 | + $iterator=new \RecursiveIteratorIterator( |
|
| 72 | 72 | new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS), |
| 73 | 73 | \RecursiveIteratorIterator::SELF_FIRST) as $item |
| 74 | 74 | ) { |
@@ -92,24 +92,24 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | protected function configureProject(array $options, OutputInterface $output) |
| 94 | 94 | { |
| 95 | - $msConfig = $this->getConfigFile($output); |
|
| 95 | + $msConfig=$this->getConfigFile($output); |
|
| 96 | 96 | |
| 97 | - $app = ($options['app'] == 'magento2') ? 'magento2' : 'magento'; |
|
| 98 | - $hostname = 'magestead-'.$options['base_url']; |
|
| 97 | + $app=($options['app'] == 'magento2') ? 'magento2' : 'magento'; |
|
| 98 | + $hostname='magestead-'.$options['base_url']; |
|
| 99 | 99 | |
| 100 | - $msConfig['vagrantfile']['vm']['box'] = $options['box']; |
|
| 101 | - $msConfig['vagrantfile']['vm']['box_url'] = $options['box']; |
|
| 102 | - $msConfig['vagrantfile']['vm']['hostname'] = $hostname; |
|
| 103 | - $msConfig['vagrantfile']['vm']['memory'] = $options['memory_limit']; |
|
| 104 | - $msConfig['vagrantfile']['vm']['network']['private_network'] = $options['ip_address']; |
|
| 105 | - $msConfig['magestead']['apps']['mba_12345']['type'] = $app; |
|
| 106 | - $msConfig['magestead']['apps']['mba_12345']['locale'] = $options['locale']; |
|
| 107 | - $msConfig['magestead']['apps']['mba_12345']['default_currency'] = $options['default_currency']; |
|
| 108 | - $msConfig['magestead']['apps']['mba_12345']['base_url'] = $options['base_url']; |
|
| 109 | - $msConfig['magestead']['os'] = $options['os']; |
|
| 110 | - $msConfig['magestead']['server'] = $options['server']; |
|
| 100 | + $msConfig['vagrantfile']['vm']['box']=$options['box']; |
|
| 101 | + $msConfig['vagrantfile']['vm']['box_url']=$options['box']; |
|
| 102 | + $msConfig['vagrantfile']['vm']['hostname']=$hostname; |
|
| 103 | + $msConfig['vagrantfile']['vm']['memory']=$options['memory_limit']; |
|
| 104 | + $msConfig['vagrantfile']['vm']['network']['private_network']=$options['ip_address']; |
|
| 105 | + $msConfig['magestead']['apps']['mba_12345']['type']=$app; |
|
| 106 | + $msConfig['magestead']['apps']['mba_12345']['locale']=$options['locale']; |
|
| 107 | + $msConfig['magestead']['apps']['mba_12345']['default_currency']=$options['default_currency']; |
|
| 108 | + $msConfig['magestead']['apps']['mba_12345']['base_url']=$options['base_url']; |
|
| 109 | + $msConfig['magestead']['os']=$options['os']; |
|
| 110 | + $msConfig['magestead']['server']=$options['server']; |
|
| 111 | 111 | |
| 112 | - $this->_msConfig = $msConfig; |
|
| 112 | + $this->_msConfig=$msConfig; |
|
| 113 | 113 | |
| 114 | 114 | $this->saveConfigFile($msConfig, $output); |
| 115 | 115 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | protected function getConfigFile(OutputInterface $output) |
| 123 | 123 | { |
| 124 | - $yaml = new Parser(); |
|
| 124 | + $yaml=new Parser(); |
|
| 125 | 125 | try { |
| 126 | 126 | return $yaml->parse(file_get_contents($this->_projectPath.'/magestead.yaml')); |
| 127 | 127 | } catch (ParseException $e) { |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | protected function saveConfigFile(array $config, OutputInterface $output) |
| 138 | 138 | { |
| 139 | - $dumper = new Dumper(); |
|
| 140 | - $yaml = $dumper->dump($config, 6); |
|
| 139 | + $dumper=new Dumper(); |
|
| 140 | + $yaml=$dumper->dump($config, 6); |
|
| 141 | 141 | |
| 142 | 142 | try { |
| 143 | 143 | file_put_contents($this->_projectPath.'/magestead.yaml', $yaml); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | protected function setupProject(OutputInterface $output, $options) |
| 154 | 154 | { |
| 155 | 155 | $output->writeln('<info>Setting up project structure</info>'); |
| 156 | - $provisionFolder = $this->_basePath.'provision'; |
|
| 156 | + $provisionFolder=$this->_basePath.'provision'; |
|
| 157 | 157 | $this->copyConfigFiles($provisionFolder, $this->_projectPath, $output); |
| 158 | 158 | $this->configureProject($options->getAllOptions(), $output); |
| 159 | 159 | |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | protected function setProject(InputInterface $input) |
| 171 | 171 | { |
| 172 | - $project = $input->getArgument('project'); |
|
| 173 | - $this->_projectPath = $this->_projectPath.'/'.$project; |
|
| 172 | + $project=$input->getArgument('project'); |
|
| 173 | + $this->_projectPath=$this->_projectPath.'/'.$project; |
|
| 174 | 174 | |
| 175 | 175 | if (is_dir($this->_projectPath)) { |
| 176 | 176 | throw new ExistingProjectException('Target project directory already exists'); |