From 2d01a3736272ce3d952862c36481c5fcd2b65d8b Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 16 May 2014 17:14:14 +0300 Subject: [PATCH 1/7] Fix behat plugin --- PHPCI/Plugin/Behat.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PHPCI/Plugin/Behat.php b/PHPCI/Plugin/Behat.php index 014cff8a..679d9c28 100644 --- a/PHPCI/Plugin/Behat.php +++ b/PHPCI/Plugin/Behat.php @@ -26,14 +26,14 @@ class Behat implements \PHPCI\Plugin public function __construct(Builder $phpci, Build $build, array $options = array()) { - $this->phpci = $phpci; - $this->build = $build; + $this->phpci = $phpci; + $this->build = $build; $this->features = ''; if (isset($options['executable'])) { $this->executable = $options['executable']; } else { - $this->executable = $this->phpci->findBinary('atoum'); + $this->executable = $this->phpci->findBinary('behat'); } if (!empty($options['features'])) { From d8e1a9d364e8a7d664871e43544fc483ceac4439 Mon Sep 17 00:00:00 2001 From: devzorg Date: Fri, 16 May 2014 22:10:47 +0400 Subject: [PATCH 2/7] Adding / SVG support build status --- PHPCI/Controller/BuildStatusController.php | 57 +++++++++++++----- public/assets/img/build-error.svg | 1 + public/assets/img/build-failed.svg | 1 + .../img/{build-ok.png => build-passing.png} | Bin public/assets/img/build-passing.svg | 1 + 5 files changed, 44 insertions(+), 16 deletions(-) create mode 100644 public/assets/img/build-error.svg create mode 100644 public/assets/img/build-failed.svg rename public/assets/img/{build-ok.png => build-passing.png} (100%) create mode 100644 public/assets/img/build-passing.svg diff --git a/PHPCI/Controller/BuildStatusController.php b/PHPCI/Controller/BuildStatusController.php index 54132401..9c2db5ab 100644 --- a/PHPCI/Controller/BuildStatusController.php +++ b/PHPCI/Controller/BuildStatusController.php @@ -37,31 +37,56 @@ class BuildStatusController extends \PHPCI\Controller $this->projectStore = Store\Factory::getStore('Project'); } + /** + * Returns status of the last build + * @param $projectId + * @return string + */ + protected function _getStatus($projectId) + { + $branch = $this->getParam('branch', 'master'); + try { + $project = $this->projectStore->getById($projectId); + $status = 'passing'; + + if (!$project->getAllowPublicStatus()) { + die(); + } + + if (isset($project) && $project instanceof Project) { + $build = $project->getLatestBuild($branch, array(2,3)); + + if (isset($build) && $build instanceof Build && $build->getStatus() != 2) { + $status = 'failed'; + } + } + } catch (\Exception $e) { + $status = 'error'; + } + + return $status; + } + /** * Returns the appropriate build status image for a given project. */ public function image($projectId) { - $branch = $this->getParam('branch', 'master'); - $project = $this->projectStore->getById($projectId); - $status = 'ok'; - - if (!$project->getAllowPublicStatus()) { - die(); - } - - if (isset($project) && $project instanceof Project) { - $build = $project->getLatestBuild($branch, array(2,3)); - - if (isset($build) && $build instanceof Build && $build->getStatus() != 2) { - $status = 'failed'; - } - } - + $status = $this->_getStatus($projectId); header('Content-Type: image/png'); die(file_get_contents(APPLICATION_PATH . 'public/assets/img/build-' . $status . '.png')); } + /** + * Returns the appropriate build status image in SVG format for a given project. + */ + public function svg($projectId) + { + $status = $this->_getStatus($projectId); + header('Content-Type: image/svg+xml'); + die(file_get_contents(APPLICATION_PATH . 'public/assets/img/build-' . $status . '.svg')); + } + public function view($projectId) { $project = $this->projectStore->getById($projectId); diff --git a/public/assets/img/build-error.svg b/public/assets/img/build-error.svg new file mode 100644 index 00000000..a6567a32 --- /dev/null +++ b/public/assets/img/build-error.svg @@ -0,0 +1 @@ +buildbuilderrorerror \ No newline at end of file diff --git a/public/assets/img/build-failed.svg b/public/assets/img/build-failed.svg new file mode 100644 index 00000000..c7afed21 --- /dev/null +++ b/public/assets/img/build-failed.svg @@ -0,0 +1 @@ +buildbuildfailedfailed \ No newline at end of file diff --git a/public/assets/img/build-ok.png b/public/assets/img/build-passing.png similarity index 100% rename from public/assets/img/build-ok.png rename to public/assets/img/build-passing.png diff --git a/public/assets/img/build-passing.svg b/public/assets/img/build-passing.svg new file mode 100644 index 00000000..42f797eb --- /dev/null +++ b/public/assets/img/build-passing.svg @@ -0,0 +1 @@ +buildbuildpassingpassing \ No newline at end of file From 0700ab389f6046a056d8f672dfe2810f93120fbd Mon Sep 17 00:00:00 2001 From: devzorg Date: Fri, 16 May 2014 22:17:02 +0400 Subject: [PATCH 3/7] Fix / Collapse and word wrap fix for a block with the ssh-key. --- PHPCI/View/Project/view.phtml | 8 +++++--- public/assets/css/phpci.css | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/PHPCI/View/Project/view.phtml b/PHPCI/View/Project/view.phtml index 48866e5c..47e75b45 100644 --- a/PHPCI/View/Project/view.phtml +++ b/PHPCI/View/Project/view.phtml @@ -51,9 +51,11 @@ getSshPublicKey()): ?> -
-

Public Key

-
getSshPublicKey(); ?>
+
+ +
+
getPublicKey(); ?>
+
diff --git a/public/assets/css/phpci.css b/public/assets/css/phpci.css index ce98017a..7113ad1c 100644 --- a/public/assets/css/phpci.css +++ b/public/assets/css/phpci.css @@ -82,6 +82,6 @@ h1 { width: 200px; } -.panel-body { - overflow: auto; +.word-wrap { + word-wrap: break-word; } \ No newline at end of file From 251f08c6b8692ab41d8d3c92a1c7684aaed4733c Mon Sep 17 00:00:00 2001 From: devzorg Date: Fri, 16 May 2014 22:17:02 +0400 Subject: [PATCH 4/7] Fix / Collapse and word wrap fix for a block with the ssh-key. --- PHPCI/View/Project/view.phtml | 8 +++++--- public/assets/css/phpci.css | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/PHPCI/View/Project/view.phtml b/PHPCI/View/Project/view.phtml index 48866e5c..bc89e9d8 100644 --- a/PHPCI/View/Project/view.phtml +++ b/PHPCI/View/Project/view.phtml @@ -51,9 +51,11 @@ getSshPublicKey()): ?> -
-

Public Key

-
getSshPublicKey(); ?>
+
+ +
+
getSshPublicKey(); ?>
+
diff --git a/public/assets/css/phpci.css b/public/assets/css/phpci.css index ce98017a..7113ad1c 100644 --- a/public/assets/css/phpci.css +++ b/public/assets/css/phpci.css @@ -82,6 +82,6 @@ h1 { width: 200px; } -.panel-body { - overflow: auto; +.word-wrap { + word-wrap: break-word; } \ No newline at end of file From a0861a5775e7ccd7ea4518b81c5f28ef938a1f8e Mon Sep 17 00:00:00 2001 From: devzorg Date: Fri, 16 May 2014 22:10:47 +0400 Subject: [PATCH 5/7] Adding / SVG support build status --- PHPCI/Controller/BuildStatusController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PHPCI/Controller/BuildStatusController.php b/PHPCI/Controller/BuildStatusController.php index 9c2db5ab..f7304413 100644 --- a/PHPCI/Controller/BuildStatusController.php +++ b/PHPCI/Controller/BuildStatusController.php @@ -42,7 +42,7 @@ class BuildStatusController extends \PHPCI\Controller * @param $projectId * @return string */ - protected function _getStatus($projectId) + protected function getStatus($projectId) { $branch = $this->getParam('branch', 'master'); try { @@ -72,7 +72,7 @@ class BuildStatusController extends \PHPCI\Controller */ public function image($projectId) { - $status = $this->_getStatus($projectId); + $status = $this->getStatus($projectId); header('Content-Type: image/png'); die(file_get_contents(APPLICATION_PATH . 'public/assets/img/build-' . $status . '.png')); } @@ -82,7 +82,7 @@ class BuildStatusController extends \PHPCI\Controller */ public function svg($projectId) { - $status = $this->_getStatus($projectId); + $status = $this->getStatus($projectId); header('Content-Type: image/svg+xml'); die(file_get_contents(APPLICATION_PATH . 'public/assets/img/build-' . $status . '.svg')); } From 16b44220d5b1b1ad55520d64ac58016dbe30e4af Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Mon, 19 May 2014 10:46:23 +0100 Subject: [PATCH 6/7] Fixing installation migration, it needs to actually create tables. --- .../20140513143726_initial_migration.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/PHPCI/Migrations/20140513143726_initial_migration.php b/PHPCI/Migrations/20140513143726_initial_migration.php index 8aad60b6..5fca43bf 100644 --- a/PHPCI/Migrations/20140513143726_initial_migration.php +++ b/PHPCI/Migrations/20140513143726_initial_migration.php @@ -52,6 +52,10 @@ class InitialMigration extends AbstractMigration { $table = $this->table('build'); + if (!$this->hasTable('build')) { + $table->create(); + } + if (!$table->hasColumn('project_id')) { $table->addColumn('project_id', 'integer'); } @@ -115,6 +119,10 @@ class InitialMigration extends AbstractMigration { $table = $this->table('build_meta'); + if (!$this->hasTable('build_meta')) { + $table->create(); + } + if (!$table->hasColumn('project_id')) { $table->addColumn('project_id', 'integer'); } @@ -142,6 +150,10 @@ class InitialMigration extends AbstractMigration { $table = $this->table('project'); + if (!$this->hasTable('project')) { + $table->create(); + } + if (!$table->hasColumn('title')) { $table->addColumn('title', 'string', array('limit' => 250)); } @@ -193,6 +205,10 @@ class InitialMigration extends AbstractMigration { $table = $this->table('user'); + if (!$this->hasTable('user')) { + $table->create(); + } + if (!$table->hasColumn('email')) { $table->addColumn('email', 'string', array('limit' => 250)); } @@ -215,4 +231,4 @@ class InitialMigration extends AbstractMigration $table->save(); } -} \ No newline at end of file +} From 167ff06cc0a7ef7d7545236b1fb1f03b3c182479 Mon Sep 17 00:00:00 2001 From: Jarek Kostrz Date: Wed, 21 May 2014 16:56:16 +0200 Subject: [PATCH 7/7] Fixed MailerFactory Helper config email settings. --- PHPCI/Helper/MailerFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PHPCI/Helper/MailerFactory.php b/PHPCI/Helper/MailerFactory.php index 8c7b46e7..81d37831 100644 --- a/PHPCI/Helper/MailerFactory.php +++ b/PHPCI/Helper/MailerFactory.php @@ -19,7 +19,7 @@ class MailerFactory public function __construct($config = null) { - $this->emailConfig = isset($config['email_settings']) ?: array(); + $this->emailConfig = isset($config['email_settings']) ? $config['email_settings'] : array(); } /**