Permalink
Browse files

Removing output from ServerOutputChanged and changing to make an AJAX…

… request to get the change if needed
  • Loading branch information...
REBELinBLUE committed Mar 6, 2017
1 parent 6ab2d74 commit 186a381bb3077463a0e699a4d6d0003c6629fd84
View
@@ -80,8 +80,16 @@ phpunit.xml.dist export-ignore
phpstan.dist.neon export-ignore
Makefile export-ignore
+#
+## Do not try and merge these files
+#
+
composer.lock -diff
yarn.lock -diff
+public/build/js/*.js -diff
+public/build/css/*.css -diff
+*.map -diff
+rev-manifest.json -diff
#
## Github config
@@ -18,11 +18,6 @@ class ServerOutputChanged implements ShouldBroadcast
*/
public $log_id;
- /**
- * @var string
- */
- public $output;
-
/**
* ServerOutputChanged constructor.
*
@@ -31,7 +26,6 @@ class ServerOutputChanged implements ShouldBroadcast
public function __construct(ServerLog $log)
{
$this->log_id = $log->id;
- $this->output = $log->output;
}
/**
@@ -16,7 +16,7 @@ class LogFormatter
*/
public function error($message)
{
- return '<error>' . $message . '</error>';
+ return $this->format($message, 'error');
}
/**
@@ -28,6 +28,31 @@ public function error($message)
*/
public function info($message)
{
- return '<info>' . $message . '</info>';
+ return $this->format($message, 'info');
+ }
+
+ /**
+ * Formats the string if it contains non-whitespace.
+ *
+ * @param string $message
+ * @param string $style
+ *
+ * @return string
+ */
+ private function format($message, $style)
+ {
+ $cleaned = trim($message);
+ if (!empty($cleaned)) {
+ if (rtrim($message, "\r\n") === $message) {
+ $message .= PHP_EOL;
+ }
+
+ $trimmed = rtrim($message);
+ $formatted = '<' . $style . '>' . $trimmed . '</' . $style . '>';
+
+ return str_replace($trimmed, $formatted, $message);
+ }
+
+ return $message;
}
}
@@ -185,11 +185,11 @@ private function runDeploymentStepOnServer(ServerLog $log)
if (!empty($process)) {
$cancelled = false;
$output = '';
- $process->run(function ($type, $output_line) use (&$output, &$log, $process, &$cancelled) {
+ $process->run(function ($type, $line) use (&$output, &$log, $process, &$cancelled) {
if ($type === Process::ERR) {
- $output .= $this->formatter->error($output_line);
+ $output .= $this->formatter->error($line);
} else {
- $output .= $this->formatter->info($output_line);
+ $output .= $this->formatter->info($line);
}
$log->output = $output;
View
@@ -110,5 +110,5 @@ Elixir(function(mix) {
'public/js/ie.js',
'public/js/vendor.js'
])
- .copy('public/fonts', 'public/build/fonts');;
+ .copy('public/fonts', 'public/build/fonts');
});

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 186a381

Please sign in to comment.