-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
1,810 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# archer start | ||
.gitattributes export-ignore | ||
.gitignore export-ignore | ||
.travis.* export-ignore | ||
.archer.* export-ignore | ||
test export-ignore | ||
# archer end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# archer start | ||
/artifacts/ | ||
/vendor/ | ||
# archer end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ej7vR8/Y0dA4EGu2k+kQSW4TPfg0OmRtnh0Dh9u2LeSzmxoATLL86qrgYRk9J8nEpdLEUN+VCaydzlLQrCxlyaVQd/ewLPv4lVU1gT2nprYzJX3nz8Os3/TaFUfLmsTXU7DHXI4WvFrmSvqCb4mN3ueYhplO/OZtLGjYRcGH1X4= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
/** | ||
* This script is executed before composer dependencies are installed, | ||
* and as such must be included in each project as part of the skeleton. | ||
*/ | ||
|
||
$config = array( | ||
'config' => array( | ||
'notify-on-install' => false | ||
) | ||
); | ||
|
||
if ($token = getenv('ARCHER_TOKEN')) { | ||
$config['config']['github-oauth'] = array( | ||
'github.com' => $token | ||
); | ||
$composerFlags = '--prefer-dist'; | ||
} else { | ||
$composerFlags = '--prefer-source'; | ||
} | ||
|
||
$file = '~/.composer/config.json'; | ||
$dir = dirname($file); | ||
if (!is_dir($dir)) { | ||
mkdir($dir, 0755, true); | ||
} | ||
file_put_contents($file, json_encode($config)); | ||
|
||
$exitCode = 0; | ||
passthru('composer install --dev --no-progress --no-interaction --ansi ' . $composerFlags, $exitCode); | ||
exit($exitCode); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-----BEGIN RSA PUBLIC KEY----- | ||
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCiuWHAKZjkCLPTwfhcItaP2f5b | ||
VYC7xKVtf8HDE34qPaLAXJ1HWffHfx/BGFJLGumpB2+QqwJzL2DWW53JKoYlCNGs | ||
K7kwABFdsxnqxzWwHly05UXGDx1MEH/+bG45orlZHoiyoENN9oKDEgJkHyWsBI1m | ||
60AC2BxKOKXfE/QpHQIDAQAB | ||
-----END RSA PUBLIC KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# | ||
# This is the default Travis CI configuration. | ||
# | ||
# It uses a GitHub OAuth token when fetching composer dependencies | ||
# to avoid IP-based API throttling. | ||
# | ||
# It also allows publication of artifacts via an additional build. | ||
# | ||
language: php | ||
|
||
php: | ||
- 5.3 | ||
- 5.4 | ||
- 5.5 | ||
|
||
env: | ||
global: | ||
- ARCHER_PUBLISH_VERSION=5.4 | ||
- secure: "ej7vR8/Y0dA4EGu2k+kQSW4TPfg0OmRtnh0Dh9u2LeSzmxoATLL86qrgYRk9J8nEpdLEUN+VCaydzlLQrCxlyaVQd/ewLPv4lVU1gT2nprYzJX3nz8Os3/TaFUfLmsTXU7DHXI4WvFrmSvqCb4mN3ueYhplO/OZtLGjYRcGH1X4=" | ||
|
||
install: | ||
- ./.travis.install | ||
script: | ||
- ./vendor/bin/archer travis:build | ||
|
||
matrix: | ||
# PHP 5.5 is still in alpha, so ignore build failures. | ||
allow_failures: | ||
- php: 5.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Duct Changelog | ||
|
||
### 0.1.0 | ||
|
||
* Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Contributing | ||
|
||
**Duct** is open source software; contributions from the community are encouraged. Please take a moment to read these guidelines before submitting changes. | ||
|
||
### Code style | ||
|
||
All PHP code must adhere to the [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) standard. | ||
|
||
### Branching and pull requests | ||
|
||
As a guideline, please follow this process: | ||
|
||
1. [Fork the repository](https://help.github.com/articles/fork-a-repo). | ||
2. Create a topic branch for the change: | ||
* New features should branch from **develop**. | ||
* Bug fixes to existing versions should branch from **master**. | ||
* Please ensure the branch is clearly labelled as a feature or fix. | ||
3. Make the relevant changes. | ||
4. [Squash](http://git-scm.com/book/en/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) commits if necessary. | ||
4. Submit a pull request to the **develop** branch. | ||
|
||
Please note this is a general guideline only. | ||
For more information on the branching structure please see the [git-flow cheatsheet](http://danielkummer.github.com/git-flow-cheatsheet/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# License | ||
|
||
**© 2013, [James Harris](https://github.com/jmalloc)** | ||
|
||
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.** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,56 @@ | ||
duct | ||
==== | ||
# Duct | ||
|
||
[![Build Status]](http://travis-ci.org/IcecaveStudios/duct) | ||
[![Test Coverage]](http://icecave.com.au/duct/artifacts/tests/coverage) | ||
|
||
**Duct** is a PHP library for parsing continuous streams of JSON values. | ||
|
||
## Installation | ||
|
||
* [Composer](http://getcomposer.org) package [icecave/duct](https://packagist.org/packages/icecave/duct) | ||
|
||
## Example | ||
|
||
```php | ||
<?php | ||
use Icecave\Duct\Parser; | ||
|
||
$parser = new Parser; | ||
|
||
// JSON data can be fed to the parser incrementally. | ||
$parser->feed('[ 1, '); | ||
|
||
// Completed values can be retreived using the values() method, which returns an | ||
// Icecave\Collections\Vector of values. | ||
// | ||
// At this point no complete object has been parsed so the vector is empty. | ||
$values = $parser->values(); | ||
assert($values->isEmpty()); | ||
|
||
// As more data is fed to the parser, we now have one value available, an array | ||
// of elements 1, 2, 3. | ||
// | ||
// Note that calling values() is destructive, in that any complete objects are | ||
// removed from the parser and will not be returned by future calls to values(). | ||
$parser->feed('2, 3 ][ 4, 5'); | ||
$values = $parser->values(); | ||
assert($values->size() === 1); | ||
assert($values[0] == array(1, 2, 3)); | ||
|
||
// Finally we feed the remaining part of the second object to the parser and the | ||
// second value becomes available. | ||
$parser->feed(', 6 ]'); | ||
$values = $parser->values(); | ||
assert($values->size() === 1); | ||
assert($values[0] == array(4, 5, 6)); | ||
``` | ||
|
||
## Notes | ||
|
||
Please note that **Duct** does not provide an evented (SAX-like) JSON parser, instead it allows incremental parsing of | ||
sequential JSON strings, for example when streaming JSON over a network connection. | ||
|
||
<!-- references --> | ||
[Build Status]: https://raw.github.com/IcecaveStudios/duct/gh-pages/artifacts/images/icecave/regular/build-status.png | ||
[Test Coverage]: https://raw.github.com/IcecaveStudios/duct/gh-pages/artifacts/images/icecave/regular/coverage.png | ||
|
||
Parse streams of JSON values. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name": "icecave/duct", | ||
"description": "Parse continuous streams of JSON objects.", | ||
"keywords": ["json", "parse", "parser", "stream"], | ||
"homepage": "https://github.com/IcecaveStudios/duct", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "James Harris", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.3", | ||
"eloquent/enumeration": "~3", | ||
"icecave/collections": "~0.6" | ||
}, | ||
"require-dev": { | ||
"icecave/archer": "~0.3" | ||
}, | ||
"autoload": { | ||
"psr-0": { | ||
"Icecave\\Duct": "lib", | ||
"Icecave\\Duct\\TypeCheck": "lib-typhoon" | ||
} | ||
} | ||
} |
Oops, something went wrong.