From 03c5fb5558b7817e89f615b0d47129c491306238 Mon Sep 17 00:00:00 2001 From: "a.cianfarani" Date: Wed, 28 Aug 2013 10:43:29 +0200 Subject: [PATCH 1/4] Added %buildurl% var for message option --- PHPCI/Plugin/Campfire.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PHPCI/Plugin/Campfire.php b/PHPCI/Plugin/Campfire.php index 78269520..18e23a06 100644 --- a/PHPCI/Plugin/Campfire.php +++ b/PHPCI/Plugin/Campfire.php @@ -43,8 +43,11 @@ class Campfire implements \PHPCI\Plugin public function execute() { + + $url = ""; + $message = str_replace("%buildurl%", $url, $this->message); $this->joinRoom($this->roomId); - $status = $this->speak($this->message,$this->roomId); + $status = $this->speak($message,$this->roomId); $this->leaveRoom($this->roomId); return $status; From 17852f8aa83f5900b92b817e959117ec2e1e7033 Mon Sep 17 00:00:00 2001 From: "a.cianfarani" Date: Wed, 28 Aug 2013 10:47:00 +0200 Subject: [PATCH 2/4] Clean %buildurl% var for message option: just url given now, not the html link --- PHPCI/Plugin/Campfire.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PHPCI/Plugin/Campfire.php b/PHPCI/Plugin/Campfire.php index 18e23a06..7a9e7708 100644 --- a/PHPCI/Plugin/Campfire.php +++ b/PHPCI/Plugin/Campfire.php @@ -44,7 +44,7 @@ class Campfire implements \PHPCI\Plugin public function execute() { - $url = ""; + $url = PHPCI_URL."build/view/".$this->phpci->getBuild()->getId(); $message = str_replace("%buildurl%", $url, $this->message); $this->joinRoom($this->roomId); $status = $this->speak($message,$this->roomId); From 7c06aa4273ba97e4ca8990ed08b777d886a5ef0f Mon Sep 17 00:00:00 2001 From: "a.cianfarani" Date: Wed, 28 Aug 2013 10:49:10 +0200 Subject: [PATCH 3/4] Coding style... --- PHPCI/Plugin/Campfire.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/PHPCI/Plugin/Campfire.php b/PHPCI/Plugin/Campfire.php index 7a9e7708..f3dfced2 100644 --- a/PHPCI/Plugin/Campfire.php +++ b/PHPCI/Plugin/Campfire.php @@ -43,12 +43,12 @@ class Campfire implements \PHPCI\Plugin public function execute() { - $url = PHPCI_URL."build/view/".$this->phpci->getBuild()->getId(); $message = str_replace("%buildurl%", $url, $this->message); $this->joinRoom($this->roomId); - $status = $this->speak($message,$this->roomId); + $status = $this->speak($message, $this->roomId); $this->leaveRoom($this->roomId); + return $status; } @@ -75,6 +75,7 @@ class Campfire implements \PHPCI\Plugin } else { $type = 'TextMessage'; } + return $this->_getPageByPost($page, array('message' => array('type' => $type, 'body' => $message))); @@ -91,7 +92,7 @@ class Campfire implements \PHPCI\Plugin $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_POST,1); + curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent); curl_setopt($ch, CURLOPT_VERBOSE, $this->verbose); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); @@ -99,7 +100,7 @@ class Campfire implements \PHPCI\Plugin curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/json")); curl_setopt($ch, CURLOPT_COOKIEFILE, $this->cookie); - curl_setopt($ch, CURLOPT_POSTFIELDS,$json); + curl_setopt($ch, CURLOPT_POSTFIELDS, $json); $output = curl_exec($ch); curl_close($ch); From 620e19fcc193e6932449c0472c88b4d7f7401471 Mon Sep 17 00:00:00 2001 From: "a.cianfarani" Date: Wed, 28 Aug 2013 10:59:50 +0200 Subject: [PATCH 4/4] Update readme to show %buildurl% in use --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index add3ddb9..390c022d 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ Similar to Travis CI, to support PHPCI in your project, you simply need to add a - "DROP DATABASE IF EXISTS test;" failure: campfire: - message: "Phpci : build failed." + message: "Phpci : build %buildurl% failed." As mentioned earlier, PHPCI is powered by plugins, there are several phases in which plugins can be run: