Completed
Push — feature/log-command ( 102328 )
by Steven
02:47
created
src/Magestead/Command/Log/StreamCommand.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     protected function configure()
23 23
     {
24
-        $this->_projectPath = getcwd();
24
+        $this->_projectPath=getcwd();
25 25
         $this->setName("log:stream");
26 26
         $this->setDescription("Stream a specific server log");
27 27
         $this->addArgument('log', InputArgument::REQUIRED, 'access or error');
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
      */
35 35
     protected function execute(InputInterface $input, OutputInterface $output)
36 36
     {
37
-        $log = $input->getArgument('log');
37
+        $log=$input->getArgument('log');
38 38
 
39
-        $output->writeln('<info>Streaming '. ucwords($log) . ' Log</info>');
40
-        $command = $this->getCommand(new Config($output), $log);
39
+        $output->writeln('<info>Streaming '.ucwords($log).' Log</info>');
40
+        $command=$this->getCommand(new Config($output), $log);
41 41
         if (!$command) {
42 42
             return $output->writeln('<error>Command not available for this application</error>');
43 43
         }
44 44
 
45
-        $pCommand = "vagrant ssh -c '". $command ."'";
45
+        $pCommand="vagrant ssh -c '".$command."'";
46 46
         return new ProcessCommand($pCommand, $this->_projectPath, $output);
47 47
     }
48 48
 
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
      */
54 54
     private function getCommand(Config $config, $log)
55 55
     {
56
-        $server = $config->_config['magestead']['server'];
57
-        $os = $config->_config['magestead']['os'];
56
+        $server=$config->_config['magestead']['server'];
57
+        $os=$config->_config['magestead']['os'];
58 58
 
59
-        $location = $this->getLogLocation($server, $os);
60
-        $command = 'tail -f /var/log/' . $location . '/' . $config->base_url . '-' . $log . '.log';
59
+        $location=$this->getLogLocation($server, $os);
60
+        $command='tail -f /var/log/'.$location.'/'.$config->base_url.'-'.$log.'.log';
61 61
 
62 62
         return $command;
63 63
     }
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
      */
70 70
     private function getLogLocation($server, $os)
71 71
     {
72
-        $location = 'nginx';
72
+        $location='nginx';
73 73
         if ($server != 'nginx') {
74
-            $location = ($os == 'ubuntu14') ? 'apache2' : 'httpd';
74
+            $location=($os == 'ubuntu14') ? 'apache2' : 'httpd';
75 75
         }
76 76
 
77 77
         return $location;
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@  discard block
 block discarded – undo
19 19
     /**
20 20
      * Configure the stream command
21 21
      */
22
-    protected function configure()
23
-    {
22
+    protected function configure() {
24 23
         $this->_projectPath = getcwd();
25 24
         $this->setName("log:stream");
26 25
         $this->setDescription("Stream a specific server log");
@@ -32,8 +31,7 @@  discard block
 block discarded – undo
32 31
      * @param OutputInterface $output
33 32
      * @return ProcessCommand
34 33
      */
35
-    protected function execute(InputInterface $input, OutputInterface $output)
36
-    {
34
+    protected function execute(InputInterface $input, OutputInterface $output) {
37 35
         $log = $input->getArgument('log');
38 36
 
39 37
         $output->writeln('<info>Streaming '. ucwords($log) . ' Log</info>');
@@ -51,8 +49,7 @@  discard block
 block discarded – undo
51 49
      * @param $log
52 50
      * @return string
53 51
      */
54
-    private function getCommand(Config $config, $log)
55
-    {
52
+    private function getCommand(Config $config, $log) {
56 53
         $server = $config->_config['magestead']['server'];
57 54
         $os = $config->_config['magestead']['os'];
58 55
 
@@ -67,8 +64,7 @@  discard block
 block discarded – undo
67 64
      * @param $os
68 65
      * @return string
69 66
      */
70
-    private function getLogLocation($server, $os)
71
-    {
67
+    private function getLogLocation($server, $os) {
72 68
         $location = 'nginx';
73 69
         if ($server != 'nginx') {
74 70
             $location = ($os == 'ubuntu14') ? 'apache2' : 'httpd';
Please login to merge, or discard this patch.
src/Magestead/Command/Log/ViewCommand.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     protected function configure()
23 23
     {
24
-        $this->_projectPath = getcwd();
24
+        $this->_projectPath=getcwd();
25 25
         $this->setName("log:view");
26 26
         $this->setDescription("View a specific server log");
27 27
         $this->addArgument('log', InputArgument::REQUIRED, 'access or error');
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
      */
35 35
     protected function execute(InputInterface $input, OutputInterface $output)
36 36
     {
37
-        $log = $input->getArgument('log');
37
+        $log=$input->getArgument('log');
38 38
 
39
-        $output->writeln('<info>Viewing '. ucwords($log) . ' Log</info>');
40
-        $command = $this->getCommand(new Config($output), $log);
39
+        $output->writeln('<info>Viewing '.ucwords($log).' Log</info>');
40
+        $command=$this->getCommand(new Config($output), $log);
41 41
         if (!$command) {
42 42
             return $output->writeln('<error>Command not available for this application</error>');
43 43
         }
44 44
 
45
-        $pCommand = "vagrant ssh -c '". $command ."'";
45
+        $pCommand="vagrant ssh -c '".$command."'";
46 46
         return new ProcessCommand($pCommand, $this->_projectPath, $output);
47 47
     }
48 48
 
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
      */
54 54
     private function getCommand(Config $config, $log)
55 55
     {
56
-        $server = $config->_config['magestead']['server'];
57
-        $os = $config->_config['magestead']['os'];
56
+        $server=$config->_config['magestead']['server'];
57
+        $os=$config->_config['magestead']['os'];
58 58
 
59
-        $location = $this->getLogLocation($server, $os);
60
-        $command = 'cat /var/log/' . $location . '/' . $config->base_url . '-' . $log . '.log';
59
+        $location=$this->getLogLocation($server, $os);
60
+        $command='cat /var/log/'.$location.'/'.$config->base_url.'-'.$log.'.log';
61 61
 
62 62
         return $command;
63 63
     }
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
      */
70 70
     private function getLogLocation($server, $os)
71 71
     {
72
-        $location = 'nginx';
72
+        $location='nginx';
73 73
         if ($server != 'nginx') {
74
-            $location = ($os == 'ubuntu14') ? 'apache2' : 'httpd';
74
+            $location=($os == 'ubuntu14') ? 'apache2' : 'httpd';
75 75
         }
76 76
 
77 77
         return $location;
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@  discard block
 block discarded – undo
19 19
     /**
20 20
      * Configure the view command
21 21
      */
22
-    protected function configure()
23
-    {
22
+    protected function configure() {
24 23
         $this->_projectPath = getcwd();
25 24
         $this->setName("log:view");
26 25
         $this->setDescription("View a specific server log");
@@ -32,8 +31,7 @@  discard block
 block discarded – undo
32 31
      * @param OutputInterface $output
33 32
      * @return ProcessCommand
34 33
      */
35
-    protected function execute(InputInterface $input, OutputInterface $output)
36
-    {
34
+    protected function execute(InputInterface $input, OutputInterface $output) {
37 35
         $log = $input->getArgument('log');
38 36
 
39 37
         $output->writeln('<info>Viewing '. ucwords($log) . ' Log</info>');
@@ -51,8 +49,7 @@  discard block
 block discarded – undo
51 49
      * @param $log
52 50
      * @return string
53 51
      */
54
-    private function getCommand(Config $config, $log)
55
-    {
52
+    private function getCommand(Config $config, $log) {
56 53
         $server = $config->_config['magestead']['server'];
57 54
         $os = $config->_config['magestead']['os'];
58 55
 
@@ -67,8 +64,7 @@  discard block
 block discarded – undo
67 64
      * @param $os
68 65
      * @return string
69 66
      */
70
-    private function getLogLocation($server, $os)
71
-    {
67
+    private function getLogLocation($server, $os) {
72 68
         $location = 'nginx';
73 69
         if ($server != 'nginx') {
74 70
             $location = ($os == 'ubuntu14') ? 'apache2' : 'httpd';
Please login to merge, or discard this patch.