Skip to content

Commit

Permalink
Merge branch 'release/0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Potherca committed Jul 17, 2015
2 parents 4d66b05 + 58c8bc9 commit 443e03a
Show file tree
Hide file tree
Showing 10 changed files with 949 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build
vendor

composer.lock
phpunit.xml
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Change Log
All notable changes to the `flysystem-github` project will be documented in this
file. This project adheres to [Semantic Versioning](http://semver.org/).

## 0.1.0 - 2015-07-18 - Read functionality
### Added
Read functionality and Github API authentication have been implemented.

## 0.0.0 - 2015-05-11 - Project Setup
### Added
Set up project basics like .gitignore file, PHPUnit Configuration file,
Contributing guidelines, Composer file stating dependencies, MIT License, README
file and this CHANGELOG file.

[unreleased]: https://github.com/potherca/flystystem-github/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/potherca/flystystem-github/compare/v0.0.0...v0.1.0
32 changes: 32 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Contributing

Contributions are **welcome** and will be fully **credited**.

We accept contributions via Pull Requests on [Github](https://github.com/potherca/flysystem-github).


## Pull Requests

- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).

- **Add tests!** - Your patch won't be accepted if it doesn't have tests.

- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.

- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.

- **Create feature branches** - Don't ask us to pull from your master branch.

- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.

- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.


## Running Tests

``` bash
$ composer test
```


**Happy coding**!
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# The MIT License (MIT)

Copyright (c) 2015 Potherca <[email protected]>

> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
111 changes: 111 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Flysystem Adapter for Github

[![Latest Version](https://img.shields.io/github/release/potherca/flysystem-github.svg?style=flat-square)](https://github.com/potherca/flysystem-github/releases)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Build Status](https://img.shields.io/travis/potherca/flysystem-github/master.svg?style=flat-square)](https://travis-ci.org/potherca/flysystem-github)
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/potherca/flysystem-github.svg?style=flat-square)](https://scrutinizer-ci.com/g/potherca/flysystem-github/code-structure)
[![Quality Score](https://img.shields.io/scrutinizer/g/potherca/flysystem-github.svg?style=flat-square)](https://scrutinizer-ci.com/g/potherca/flysystem-github)
[![Total Downloads](https://img.shields.io/packagist/dt/potherca/flysystem-github.svg?style=flat-square)](https://packagist.org/packages/potherca/flysystem-github)


## Install

Via Composer

``` bash
$ composer require potherca/flysystem-github
```

## Usage

The Github adapter can be used *without* credentials to do read-only actions on
public repositories. To avoid reaching the Github API limit, to save changes, or
to read from private repositories, credentials are required.

Caching can be utilized to save traffic or to postpone reaching the Github API
limit.

### Basic Usage

```php
use Github\Client as GithubClient;
use League\Flysystem\Filesystem;
use Potherca\Flysystem\Github\Client;
use Potherca\Flysystem\Github\GithubAdapter;
use Potherca\Flysystem\Github\Settings;

$project = 'thephpleague/flysystem';

$settings = new Settings($project);

$client = new Client(new GithubClient(), $settings);
$adapter = new GithubAdapter($client);
$filesystem = new Filesystem($adapter);
```

### Authentication

```php
use Github\Client as GithubClient;
use League\Flysystem\Filesystem;
use Potherca\Flysystem\Github\Client;
use Potherca\Flysystem\Github\GithubAdapter;
use Potherca\Flysystem\Github\Settings;

$project = 'thephpleague/flysystem';
$credentials = [Settings::AUTHENTICATE_USING_TOKEN, '83347e315b8bb4790a48ed6953a5ad9e825b4e10'];
// or $authentications = [Settings::AUTHENTICATE_USING_PASSWORD, $username, $password];

$settings = new Settings($project, $credentials);

$client = new Client(new GithubClient(), $settings);
$adapter = new GithubAdapter($client);
$filesystem = new Filesystem($adapter);
```

### Cache Usage

```php
use Github\Client as GithubClient;
use Github\HttpClient\CachedHttpClient as CachedClient;
use Github\HttpClient\Cache\FilesystemCache as Cache;
use League\Flysystem\Filesystem;
use Potherca\Flysystem\Github\Client;
use Potherca\Flysystem\Github\GithubAdapter;
use Potherca\Flysystem\Github\Settings;

$project = 'thephpleague/flysystem';

$settings = new Settings($project);

$cache = new Cache('/tmp/github-api-cache')
$cacheClient = new CachedClient();
$cacheClient->setCache($cache);

$client = new Client($cacheClient, $settings);
$adapter = new GithubAdapter($client);
$filesystem = new Filesystem($adapter);

```

## Testing

``` bash
$ composer test
```

## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

## Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

## Credits

- [Potherca](https://github.com/potherca)

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
49 changes: 49 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "potherca/flysystem-github",
"description": "Flysystem adapter for Github",
"keywords": [
"potherca",
"flysystem-github",
"flysystem-adapter",
"flysystem",
"github",
"adapter"
],
"homepage": "https://github.com/potherca/flysystem-github",
"license": "MIT",
"authors": [
{
"name": "Potherca",
"email": "[email protected]",
"homepage": "http://pother.ca/",
"role": "Developer"
}
],
"require": {
"php" : ">=5.3.0",
"knplabs/github-api": "^1.4",
"league/flysystem": "^1.0"
},
"require-dev": {
"phpunit/phpunit" : "4.*",
"scrutinizer/ocular": "~1.1"
},
"autoload": {
"psr-4": {
"Potherca\\Flysystem\\Github\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Potherca\\Flysystem\\Github\\": "tests"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"scripts": {
"test" : "phpunit"
}
}
29 changes: 29 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Potherca Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit>
Loading

0 comments on commit 443e03a

Please sign in to comment.