Skip to content

Commit 383577c

Browse files
author
Rob Frawley 2nd
committed
first steps to get this inline with knps gitlab bundle
1 parent dd56bbe commit 383577c

File tree

114 files changed

+9445
-1992
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+9445
-1992
lines changed

.coveralls.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
service_name: travis-ci
2+
src_dir: lib

.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/doc export-ignore
2+
/test export-ignore
3+
/.gitattributes export-ignore
4+
/.gitignore export-ignore
5+
/.travis.yml export-ignore
6+
/.coveralls.yml export-ignore
7+
/phpunit.xml.dist export-ignore

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
phpunit.xml
2+
composer.lock
3+
composer.phar
4+
vendor/*
5+
build/*
6+
*.DS_STORE*

.travis.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
language: php
2+
3+
branches:
4+
except:
5+
- gh-pages
6+
7+
php:
8+
- 5.5
9+
- 5.6
10+
- hhvm
11+
12+
before_script:
13+
- travis_retry composer self-update
14+
- travis_retry composer install --no-interaction --prefer-source --dev
15+
16+
script:
17+
- vendor/bin/phpunit --verbose
18+
19+
after_script:
20+
- php vendor/bin/coveralls -v
21+
- php vendor/bin/test-reporter

LICENSE.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# The MIT License (MIT)
2+
3+
**Copyright (c) 2014 Scribe Inc. <[[email protected]](mailto:[email protected])>**
4+
**Copyright (c) 2014 Matt Humphrey <[m4tt.io](http://m4tt.io)>**
5+
**Copyright (c) 2012 KnpLabs <[knplabs.com](http://knplabs.com/)>**
6+
**Copyright (c) 2010 Thibault Duplessis <[[email protected]](mailto:[email protected])>**
7+
8+
Permission is hereby granted, free of charge, to any person obtaining a copy of
9+
this software and associated documentation files (the "Software"), to deal in
10+
the Software without restriction, including without limitation the rights to
11+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
12+
the Software, and to permit persons to whom the Software is furnished to do so,
13+
subject to the following conditions:
14+
15+
The above copyright notice and this permission notice shall be included in all
16+
copies or substantial portions of the Software.
17+
18+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
20+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
21+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
22+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 43 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,67 @@
1-
A PHP Wrapper for use with the [Gitlab API](https://github.com/gitlabhq/gitlabhq/tree/master/doc/api).
2-
==============
1+
# GitLab API Bundle
32

4-
Based on [php-github-api](https://github.com/m4tthumphrey/php-github-api) and code from [KnpLabs](https://github.com/KnpLabs/php-github-api).
3+
[![Build Status](https://img.shields.io/travis/scribenet/ScribeGitLabApiLibrary/master.svg?style=flat-square)](https://travis-ci.org/scribenet/ScribeGitLabApiLibrary)
4+
[![Quality Score](http://img.shields.io/codeclimate/github/scribenet/ScribeGitLabApiLibrary.svg?style=flat-square)](https://codeclimate.com/github/scribenet/ScribeGitLabApiLibrary)
5+
[![Coverage Status](http://img.shields.io/coveralls/scribenet/ScribeGitLabApiLibrary.svg?style=flat-square)](https://codeclimate.com/github/scribenet/ScribeGitLabApiLibrary)
6+
[![Dependency Status](http://img.shields.io/gemnasium/scribenet/ScribeGitLabApiLibrary.svg?style=flat-square)](https://gemnasium.com/scribenet/ScribeGitLabApiLibrary)
7+
[![Latest Version](http://img.shields.io/packagist/v/scribe/gitlab-api-library.svg?style=flat-square)](https://packagist.org/packages/scribe/gitlab-api-library)
8+
[![Software License](http://img.shields.io/packagist/l/scribe/gitlab-api-library.svg?style=flat-square)](LICENSE.md)
59

6-
Installation
7-
------------
8-
Install Composer
10+
This is a simple, object oriented PHP5 client for [GitLab's API](https://github.com/gitlabhq/gitlabhq/tree/master/doc/api), implemented with an intentionally similar API to GitLab's native RESTful API.
911

10-
```
11-
$ curl -sS https://getcomposer.org/installer | php
12-
$ sudo mv composer.phar /usr/local/bin/composer
13-
```
12+
## Features
1413

15-
Add the following to your require block in composer.json config. Note: be careful when using the `dev-master` tag as this may have unexpected results depending on your version of Gitlab. See the Versioning section below for more information.
14+
* **Code Standards**: Implements [PSR-0](http://www.php-fig.org/psr/psr-0/) code and structure standards to accommodate auto-loading using [Composer](https://getcomposer.org/) or another class auto-loading solution.
15+
* **Speed and Familiarity**: Lightweight, fast, and friendly object model utilizing lazy loading with an intentional similarly to GitLab's own RESTful API.
16+
* **Tests and Continuous Integration**: Extensive [PHPUnit](https://phpunit.de/) tests utilizing [Travis CI](https://travis-ci.org/scribenet/ScribeGitLabApiLibrary) as our continuous integration service.
17+
* **Quality, Coverage and Dependencies**: Code quality reports with [Code Climate](https://codeclimate.com/github/scribenet/ScribeGitLabApiLibrary), coverage reports with [Coveralls](https://coveralls.io/r/scribenet/ScribeGitLabApiLibrary), and dependency version monitoring using [Gemnasium](https://gemnasium.com/scribenet/ScribeGitLabApiLibrary).
18+
* **Documentation and Examples**: Comprehensive [examples](doc/) written in markdown and automatically generated [API documentationn](https://scribenet.github.io/ScribeGitLabApiLibrary/).
1619

17-
```
18-
"m4tthumphrey/php-gitlab-api": "dev-master"
19-
```
20+
## Requirements
2021

21-
Include Composer's autoloader:
22+
This library requires a short list of dependencies for both a production installation or a development build.
2223

24+
### Production
2325

24-
```php
25-
require_once dirname(__DIR__).'/vendor/autoload.php';
26-
```
26+
* PHP >= [5.5](http://php.net/manual/en/migration55.changes.php) or [HHVM](http://hhvm.com/)
27+
* The [Curl](http://php.net/manual/en/book.curl.php) extension
28+
* The [Guzzle](https://github.com/guzzle/guzzle) [HTTP request framework](http://docs.guzzlephp.org/en/latest/)
29+
* The [Buzz](https://github.com/kriswallsmith/Buzz) HTTP request framework until the conversion to Gizzle is complete.
2730

28-
Versioning
29-
----------
31+
### Development
3032

31-
From the 6.0 stable release of Gitlab, I shall now be matching the client version with the Gitlab version. For example when Gitlab 6.1 is released I will release version 6.1.0 of the API client. If I need to make future updates to the client before the next API version is released. I will simply use a 3th build version. For example `6.1.1`, `6.1.2` etc. It is recommended that you keep your composer file up to date depending on what version of Gitlab you are currently running. So if you are using 6.0, you should required `6.0.*`; 6.1 should be `6.1.*` etc etc.
33+
* [PHPUnit](https://phpunit.de/) >= 4.0
34+
* [Coveralls Reporter](https://github.com/satooshi/php-coveralls) >= 0.6.1
35+
* [Code Climate Reporter](https://github.com/codeclimate/php-test-reporter) >= 0.1.2
36+
* [Sami](https://github.com/fabpot/sami) >= 2.0
3237

33-
General API Usage
34-
-----------------
38+
## Installation
3539

36-
```php
37-
$client = new \Gitlab\Client('http://git.yourdomain.com/api/v3/'); // change here
38-
$client->authenticate('your_gitlab_token_here', \Gitlab\Client::AUTH_URL_TOKEN); // change here
39-
40-
$project = $client->api('projects')->create('My Project', array(
41-
'description' => 'This is a project',
42-
'issues_enabled' => false
43-
));
40+
This library can be included into your project easily using [Composer](http://getcomposer.org) by adding the dependency to the `require` section of your `composer.json` project file.
4441

42+
```json
43+
{
44+
"require": {
45+
"scribe/gitlab-api-library": "dev-master"
46+
}
47+
}
4548
```
4649

47-
Model Usage
48-
-----------
49-
50-
You can also use the library in an object oriented manner.
50+
## Usage
5151

5252
```php
53-
$client = new \Gitlab\Client('http://git.yourdomain.com/api/v3/'); // change here
54-
$client->authenticate('your_gitlab_token_here', \Gitlab\Client::AUTH_URL_TOKEN); // change here
55-
```
53+
<?php
5654

57-
Creating a new project
55+
require_once 'vendor/autoload.php';
5856

59-
```php
60-
$project = \Gitlab\Model\Project::create($client, 'My Project', array(
61-
'description' => 'This is my project',
62-
'issues_enabled' => false
63-
));
64-
65-
$project->addHook('http://mydomain.com/hook/push/1');
66-
```
67-
68-
Creating a new issue
69-
70-
```php
71-
$project = new \Gitlab\Model\Project(1, $client);
72-
$issue = $project->createIssue('This does not work..', array(
73-
'description' => 'This doesnt work properly. Please fix',
74-
'assignee_id' => 2
75-
));
57+
$client = new \Gitlab\Client('http://git.yourdomain.com/api/v3/');
58+
$client->authenticate('your_gitlab_token_here', \Gitlab\Client::AUTH_URL_TOKEN);
7659
```
7760

78-
Closing that issue
79-
80-
```php
81-
$issue->close();
82-
```
83-
84-
You get the idea! Take a look around and please feel free to report any bugs.
85-
86-
Integration
87-
------------
61+
## Documentation
8862

89-
- [GitLabApiBundle](https://github.com/Zeichen32/GitLabApiBundle) Symfony2 Bundle
63+
For general usage and examples, you can check the [doc](doc/) directory. For a comprehensive API reference, check this project's [github.io webpage](https://scribenet.github.io/ScribeGitLabApiLibrary/).
9064

91-
Contributing
92-
------------
65+
## Contributors
9366

94-
There are many parts of Gitlab that I have not added to this as it was originally created for personal use, hence the lack of tests. Feel free to fork and add new functionality and tests, I'll gladly accept decent pull requests.
67+
This project has code contributed from an [array of individuals](https://github.com/scribenet/ScribeGitLabApiLibrary/graphs/contributors).

composer.json

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,41 @@
11
{
2-
"name": "m4tthumphrey/php-gitlab-api",
3-
"type": "library",
4-
"description": "GitLab API client",
5-
"homepage": "https://github.com/m4tthumphrey/php-gitlab-api",
6-
"keywords": ["gitlab", "api"],
7-
"license": "MIT",
2+
"name": "scribe/github-api-library",
3+
"type": "library",
4+
"description": "GitHub API client for PHP5",
5+
"homepage": "https://github.com/scribenet/ScribeGitLabApiLibrary",
6+
"keywords": [ "gitlab", "gl", "api", "v3", "git", "scribe" ],
7+
"license": "MIT",
88
"authors": [
99
{
10-
"name": "Matt Humphrey",
10+
"name": "Rob Frawley 2nd",
11+
"email": "[email protected]",
12+
"homepage": "http://scribenet.com"
13+
},
14+
{
15+
"name": "Matt Humphrey",
1116
"homepage": "http://m4tt.io"
1217
},
1318
{
14-
"name": "KnpLabs Team",
19+
"name": "KnpLabs Team",
1520
"homepage": "http://knplabs.com"
1621
},
1722
{
18-
"name": "Thibault Duplessis",
19-
"email": "[email protected]",
23+
"name": "Thibault Duplessis",
24+
"email": "[email protected]",
2025
"homepage": "http://ornicar.github.com"
2126
}
2227
],
2328
"require": {
24-
"php": ">=5.3.2",
25-
"ext-curl": "*",
26-
"kriswallsmith/buzz": ">=0.7"
29+
"php": ">=5.5",
30+
"ext-curl": "*",
31+
"guzzle/guzzle": "~3.7",
2732
},
33+
"require-dev": {
34+
"phpunit/phpunit": "~4.0",
35+
"satooshi/php-coveralls": "~0.6",
36+
"codeclimate/php-test-reporter": "~0.1",
37+
"sami/sami": "~2.0"
38+
},
2839
"autoload": {
2940
"psr-0": { "Gitlab\\": "lib/" }
3041
}

config/sami.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
/*
3+
* This file is part of the ScribeGitLabApiLibrary.
4+
*
5+
* For the full copyright and license information, please view the LICENSE
6+
* file that was distributed with this source code.
7+
*/
8+
9+
use Sami\Sami;
10+
use Symfony\Component\Finder\Finder;
11+
12+
$projectRootPath = realpath(__DIR__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
13+
14+
$iterator = Finder::create()
15+
->files()
16+
->name('*.php')
17+
->in($projectRootPath . DIRECTORY_SEPARATOR . 'lib')
18+
;
19+
20+
return new Sami($iterator, [
21+
'theme' => 'enhanced',
22+
'title' => 'Scribe GitLab Library API',
23+
'build_dir' => $projectRootPath.'/doc/api',
24+
'cache_dir' => '/tmp/sami/github-api-library',
25+
'default_opened_level' => 2,
26+
]);

lib/Gitlab/Api/Repositories.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function compare($project_id, $fromShaOrMaster, $toShaOrMaster)
3939
return $this->get('projects/'.urlencode($project_id).'/repository/compare?from='.
4040
urlencode($fromShaOrMaster).'&to='.urlencode($toShaOrMaster));
4141
}
42-
42+
4343
public function diff($project_id, $sha)
4444
{
4545
return $this->get('projects/'.urlencode($project_id).'/repository/commits/'.urlencode($sha).'/diff');

0 commit comments

Comments
 (0)