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
jmalloc committed May 2, 2013
2 parents d05b8a3 + a0113a1 commit 57764dd
Show file tree
Hide file tree
Showing 25 changed files with 1,810 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .gitattributes
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# archer start
/artifacts/
/vendor/
# archer end
1 change: 1 addition & 0 deletions .travis.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ej7vR8/Y0dA4EGu2k+kQSW4TPfg0OmRtnh0Dh9u2LeSzmxoATLL86qrgYRk9J8nEpdLEUN+VCaydzlLQrCxlyaVQd/ewLPv4lVU1gT2nprYzJX3nz8Os3/TaFUfLmsTXU7DHXI4WvFrmSvqCb4mN3ueYhplO/OZtLGjYRcGH1X4=
32 changes: 32 additions & 0 deletions .travis.install
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);
6 changes: 6 additions & 0 deletions .travis.key
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-----
29 changes: 29 additions & 0 deletions .travis.yml
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Duct Changelog

### 0.1.0

* Initial release
23 changes: 23 additions & 0 deletions CONTRIBUTING.md
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/).
9 changes: 9 additions & 0 deletions LICENSE.md
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.**
58 changes: 55 additions & 3 deletions README.md
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.
27 changes: 27 additions & 0 deletions composer.json
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"
}
}
}
Loading

0 comments on commit 57764dd

Please sign in to comment.