Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ curl -sS https://getcomposer.org/installer | php
Then, run the Composer command to install the latest version:

```bash
composer.phar require jenkins-khan/jenkins-api
composer.phar require didungar/jenkins-api
```

On error "minimum-stability" declare repository :
```json
"repositories": [
{ "type": "vcs", "url": "https://github.com/didungar/jenkins-php-api" }
],
```

Basic Usage
-----------
Expand All @@ -28,7 +34,7 @@ Before anything, you need to instantiate the client :


```php
$jenkins = new \JenkinsKhan\Jenkins('http://host.org:8080');
$jenkins = new \DidUngar\Jenkins('http://host.org:8080');
```

If your Jenkins needs authentication, you need to pass a URL like this : `'http://user:[email protected]:8080'`.
Expand Down
15 changes: 9 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
{
"name": "jenkins-khan/jenkins-api",
"name": "didungar/jenkins-api",
"type": "library",
"description": "Jenkins PHP API",
"keywords": ["jenkins", "api"],
"homepage": "https://github.com/jenkins-khan/jenkins-php-api",
"keywords": [
"jenkins",
"api"
],
"homepage": "https://github.com/didungar/jenkins-php-api",
"license": "MIT",
"autoload": {
"psr-4": {
"JenkinsKhan\\": "src/"
"DidUngar\\": "src/"
}
},
"require-dev": {
Expand All @@ -18,8 +21,8 @@
},
"authors": [
{
"name": "jenkins-khan",
"homepage": "https://github.com/jenkins-khan/jenkins-php-api"
"name": "didungar",
"homepage": "https://github.com/didungar/jenkins-php-api"
}
]
}
24 changes: 15 additions & 9 deletions src/Jenkins.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace JenkinsKhan;
namespace DidUngar;

class Jenkins
{
Expand Down Expand Up @@ -217,7 +217,7 @@ public function getExecutors($computer = '(master)')

$this->validateCurl(
$curl,
sprintf( 'Error during getting information for executors[%s@%s] on %s', $i, $computer, $this->baseUrl)
sprintf('Error during getting information for executors[%s@%s] on %s', $i, $computer, $this->baseUrl)
);

$infos = json_decode($ret);
Expand Down Expand Up @@ -270,7 +270,7 @@ public function launchJob($jobName, $parameters = array())
/**
* @param string $jobName
*
* @return bool|\JenkinsKhan\Jenkins\Job
* @return bool|\DidUngar\Jenkins\Job
* @throws \RuntimeException
*/
public function getJob($jobName)
Expand Down Expand Up @@ -619,7 +619,10 @@ public function getJobConfig($jobname)
public function stopExecutor(Jenkins\Executor $executor)
{
$url = sprintf(
'%s/computer/%s/executors/%s/stop', $this->baseUrl, $executor->getComputer(), $executor->getNumber()
'%s/computer/%s/executors/%s/stop',
$this->baseUrl,
$executor->getComputer(),
$executor->getNumber()
);

$curl = curl_init($url);
Expand Down Expand Up @@ -666,7 +669,6 @@ public function cancelQueue(Jenkins\JobQueue $queue)
$curl,
sprintf('Error during stopping job queue #%s', $queue->getId())
);

}

/**
Expand Down Expand Up @@ -749,7 +751,10 @@ public function getTestReport($jobName, $buildId)
$ret = curl_exec($curl);

$errorMessage = sprintf(
'Error during getting information for build %s#%d on %s', $jobName, $buildId, $this->baseUrl
'Error during getting information for build %s#%d on %s',
$jobName,
$buildId,
$this->baseUrl
);

$this->validateCurl(
Expand Down Expand Up @@ -794,7 +799,8 @@ public function execute($uri, array $curlOptions)
public function getComputers()
{
$return = $this->execute(
'/computer/api/json', array(
'/computer/api/json',
array(
\CURLOPT_RETURNTRANSFER => 1,
)
);
Expand Down Expand Up @@ -826,8 +832,8 @@ public function getComputerConfiguration($computerName)
* @param $curl
* @param $errorMessage
*/
private function validateCurl($curl, $errorMessage) {

private function validateCurl($curl, $errorMessage)
{
if (curl_errno($curl)) {
throw new \RuntimeException($errorMessage);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Jenkins/Build.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace JenkinsKhan\Jenkins;
namespace DidUngar\Jenkins;

use JenkinsKhan\Jenkins;
use DidUngar\Jenkins;

class Build
{
Expand Down
4 changes: 2 additions & 2 deletions src/Jenkins/Computer.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace JenkinsKhan\Jenkins;
namespace DidUngar\Jenkins;

use JenkinsKhan\Jenkins;
use DidUngar\Jenkins;

class Computer
{
Expand Down
4 changes: 2 additions & 2 deletions src/Jenkins/Executor.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace JenkinsKhan\Jenkins;
namespace DidUngar\Jenkins;

use JenkinsKhan\Jenkins;
use DidUngar\Jenkins;

class Executor
{
Expand Down
4 changes: 2 additions & 2 deletions src/Jenkins/Factory.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace JenkinsKhan\Jenkins;
namespace DidUngar\Jenkins;

use JenkinsKhan\Jenkins;
use DidUngar\Jenkins;

class Factory
{
Expand Down
4 changes: 2 additions & 2 deletions src/Jenkins/Job.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace JenkinsKhan\Jenkins;
namespace DidUngar\Jenkins;

use JenkinsKhan\Jenkins;
use DidUngar\Jenkins;

class Job
{
Expand Down
4 changes: 2 additions & 2 deletions src/Jenkins/JobQueue.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace JenkinsKhan\Jenkins;
namespace DidUngar\Jenkins;

use JenkinsKhan\Jenkins;
use DidUngar\Jenkins;

class JobQueue
{
Expand Down
4 changes: 2 additions & 2 deletions src/Jenkins/Queue.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace JenkinsKhan\Jenkins;
namespace DidUngar\Jenkins;

use JenkinsKhan\Jenkins;
use DidUngar\Jenkins;

class Queue
{
Expand Down
5 changes: 2 additions & 3 deletions src/Jenkins/TestReport.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace JenkinsKhan\Jenkins;
namespace DidUngar\Jenkins;

use JenkinsKhan\Jenkins;
use DidUngar\Jenkins;

class TestReport
{
Expand Down Expand Up @@ -134,4 +134,3 @@ public function getSuiteStatus($id)
return $status;
}
}

4 changes: 2 additions & 2 deletions src/Jenkins/View.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace JenkinsKhan\Jenkins;
namespace DidUngar\Jenkins;

use JenkinsKhan\Jenkins;
use DidUngar\Jenkins;

class View
{
Expand Down
1 change: 0 additions & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?php

require_once __DIR__ . '/../vendor/autoload.php';

Loading