Skip to content

Commit f010fe5

Browse files
author
Harry Bragg
committed
initial version, not really working
0 parents  commit f010fe5

Some content is hidden

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

44 files changed

+4954
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/vendor/
2+
/tests/report/

.travis.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
language: php
2+
3+
dist: trusty
4+
5+
cache:
6+
directories:
7+
- $HOME/.composer/cache/files
8+
9+
php:
10+
- 5.6
11+
- 7.0
12+
- 7.1
13+
- hhvm
14+
- nightly
15+
16+
env:
17+
- PREFER_LOWEST=--prefer-lowest
18+
- PREFER_LOWEST=
19+
20+
matrix:
21+
allow_failures:
22+
- php: nightly
23+
24+
before_script:
25+
- travis_retry composer update --no-interaction --prefer-dist $PREFER_LOWEST
26+
27+
script:
28+
- vendor/bin/phpcs -p --warning-severity=0 src/ tests/
29+
- vendor/bin/phpunit --coverage-clover=./tests/report/coverage.clover
30+
31+
after_script:
32+
- test -f ./tests/report/coverage.clover && (wget https://scrutinizer-ci.com/ocular.phar; php ocular.phar code-coverage:upload --format=php-clover ./tests/report/coverage.clover)

CONTRIBUTING.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Contributing
2+
3+
Contributions are **welcome**!
4+
5+
We accept contributions via Pull Requests on [Github](https://github.com/graze/sprout). We also recommend reading [How to write the perfect Pull Request](https://github.com/blog/1943-how-to-write-the-perfect-pull-request) which has some great tips and advice.
6+
7+
## Reporting an Issue
8+
9+
Please report issues via the issue tracker on GitHub. For security-related issues, please email the maintainer directly.
10+
11+
## Pull Requests
12+
13+
Contributions are accepted via Pull Requests. In order for your Pull Request to be merged, please ensure it meets
14+
the following criteria:
15+
16+
- **PSR-2 & PSR-4 Coding Standards**.
17+
- **Tests** - your contribution will not be merged unless it has tests covering the changes.
18+
- **Documentation** - please ensure that README.md and any other documentation relevant to your change is up-to-date.
19+
- **Description** - please provide a description of your pull request that details the changes you've made, why you've
20+
made them including any relevant information or justifications that will aid the person reviewing you changes.
21+
22+
## Development Environment
23+
24+
A Dockerfile is included in this repository for development. All make commands use the docker container to run the code.
25+
An initial step will need to be run to set up the environment:
26+
27+
```shell
28+
$ make setup
29+
```
30+
31+
A complete list of commands can be found by running: `$ make help`
32+
33+
## Running Tests
34+
35+
You can run all of the test suites in the project using:
36+
37+
```shell
38+
$ make test
39+
```
40+
41+
Or run individual suites using:
42+
43+
```shell
44+
$ make test-unit
45+
$ make test-integration
46+
$ make test-matrix
47+
```
48+
49+
You can get a coverage report in text, html and clover XML formats:
50+
51+
```shell
52+
$ make test-coverage
53+
$ make test-coverage-html
54+
$ make test-coverage-clover
55+
```

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM php:7.1-alpine
2+
3+
RUN set +xe \
4+
&& apk add --no-cache \
5+
mariadb-client
6+
7+
COPY bin /app/bin
8+
COPY src /app/src
9+
COPY vendor /app/vendor
10+
11+
VOLUME ["/seed", "/app/config"]
12+
13+
ENTRYPOINT ["php", "/app/bin/sprout"]
14+
CMD ["list"]

LICENSE.md

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

Makefile

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
SHELL = /bin/sh
2+
3+
DOCKER ?= $(shell which docker)
4+
VOLUME := /srv
5+
IMAGE ?= graze/php-alpine:test
6+
DOCKER_RUN := ${DOCKER} run --rm -t -v $$(pwd):${VOLUME} -w ${VOLUME} ${IMAGE}
7+
8+
PREFER_LOWEST ?=
9+
10+
.PHONY: build build-update composer-% clean help run
11+
.PHONY: lint lint-fix
12+
.PHONY: test test-unit test-lowest test-matrix test-coverage test-coverage-html test-coverage-clover
13+
14+
.SILENT: help
15+
16+
# Building
17+
18+
build: ## Download the dependencies then build the image :rocket:.
19+
make 'composer-install --prefer-dist --optimize-autoloader'
20+
21+
build-update: ## Update all dependencies
22+
make 'composer-update --prefer-dist --optimize-autoloader ${PREFER_LOWEST}'
23+
24+
composer-%: ## Run a composer command, `make "composer-<command> [...]"`.
25+
${DOCKER} run -t --rm \
26+
-v $$(pwd):/app \
27+
-v ~/.composer:/tmp \
28+
composer --ansi --no-interaction $* $(filter-out $@,$(MAKECMDGOALS))
29+
30+
# Testing
31+
32+
test: ## Run the unit and integration testsuites.
33+
test: lint test-unit
34+
35+
lint: ## Run phpcs against the code.
36+
${DOCKER_RUN} vendor/bin/phpcs -p --warning-severity=0 src/ tests/
37+
38+
lint-fix: ## Run phpcsf and fix possible lint errors.
39+
${DOCKER_RUN} vendor/bin/phpcbf -p src/ tests/
40+
41+
test-unit: ## Run the unit testsuite.
42+
${DOCKER_RUN} vendor/bin/phpunit --testsuite unit
43+
44+
test-lowest: ## Test using the lowest possible versions of the dependencies
45+
test-lowest: PREFER_LOWEST=--prefer-lowest --prefer-stable
46+
test-lowest: build-update test
47+
48+
test-matrix: ## Run the unit tests against multiple targets.
49+
${MAKE} IMAGE="php:5.6-alpine" test
50+
${MAKE} IMAGE="php:7.0-alpine" test
51+
${MAKE} IMAGE="php:7.1-alpine" test
52+
${MAKE} IMAGE="hhvm/hhvm:latest" test
53+
54+
test-matrix-lowest: ## Run the unit tests against
55+
${MAKE} build-update PREFER_LOWEST='--prefer-lowest --prefer-stable'
56+
${MAKE} test-matrix
57+
${MAKE} build-update
58+
59+
test-coverage: ## Run all tests and output coverage to the console.
60+
${DOCKER_RUN} phpdbg7 -qrr vendor/bin/phpunit --coverage-text
61+
62+
test-coverage-html: ## Run all tests and output coverage to html.
63+
${DOCKER_RUN} phpdbg7 -qrr vendor/bin/phpunit --coverage-html=./tests/report/html
64+
65+
test-coverage-clover: ## Run all tests and output clover coverage to file.
66+
${DOCKER_RUN} phpdbg7 -qrr vendor/bin/phpunit --coverage-clover=./tests/report/coverage.clover
67+
68+
# Help
69+
70+
help: ## Show this help message.
71+
echo "usage: make [target] ..."
72+
echo ""
73+
echo "targets:"
74+
egrep '^(.+)\:\ ##\ (.+)' ${MAKEFILE_LIST} | column -t -c 2 -s ':#'

README.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# sprout
2+
3+
[![Latest Version on Packagist](https://img.shields.io/packagist/v/graze/sprout.svg?style=flat-square)](https://packagist.org/packages/graze/sprout)
4+
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
5+
[![Build Status](https://img.shields.io/travis/graze/sprout/master.svg?style=flat-square)](https://travis-ci.org/graze/sprout)
6+
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/graze/sprout.svg?style=flat-square)](https://scrutinizer-ci.com/g/graze/sprout/code-structure)
7+
[![Quality Score](https://img.shields.io/scrutinizer/g/graze/sprout.svg?style=flat-square)](https://scrutinizer-ci.com/g/graze/sprout)
8+
[![Total Downloads](https://img.shields.io/packagist/dt/graze/sprout.svg?style=flat-square)](https://packagist.org/packages/graze/sprout)
9+
10+
>You now have a copy of the files in this repository, in a new git repository with no previous history that can you manipulate and push to other remote repositories.
11+
>
12+
> ## Continuous Integration
13+
>
14+
>Your project should make use of the following remote CI services:
15+
>
16+
> ### [Travis CI](https://travis-ci.org/graze/) - automated testing
17+
>
18+
> 1. Log-in with github
19+
> 1. visit: https://travis-ci.org/profile/graze
20+
> 1. Click `sync with github`
21+
> 1. Enable your project
22+
>
23+
> ### [Scrutinizer CI](https://scrutinizer-ci.com/organizations/graze/repositories) - code quality
24+
>
25+
> 1. Log-in via github
26+
> 1. Click `+ Add Repository`
27+
> 1. Select `graze` as the organisation (ask a graze/@open-source-team member for access)
28+
> 1. Entry the repository name
29+
> 1. Click `Add Repository`
30+
> 1. Click on the 🔧 > `Configuration` set `Shared Config` to `graze/standards + open source`
31+
>
32+
> ### [Packagist](https://packagist.org/graze) - package repository
33+
>
34+
> 1. Log-in using the graze account
35+
> 1. Click `Submit`
36+
> 1. Paste the `git` url (e.g. `git@github.com:graze/sprout.git`)
37+
> 1. Click `Check`
38+
> 1. Follow the instructions on auto updating the project in packagist
39+
>
40+
> ## Github Teams
41+
>
42+
> Add this project to the graze [Open Source](https://github.com/orgs/graze/teams/open-source-team/members) team to allows others to contribute to this project
43+
44+
45+
## Install
46+
47+
Via Composer
48+
49+
```bash
50+
composer require graze/sprout
51+
```
52+
53+
## Usage
54+
55+
```php
56+
$skeleton = new Graze\Sprout\Skeleton('big', 'small', 'dog');
57+
echo $skeleton->sing();
58+
```
59+
60+
## Change log
61+
62+
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
63+
64+
## Testing
65+
66+
```shell
67+
make build test
68+
```
69+
70+
## Contributing
71+
72+
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
73+
74+
## Security
75+
76+
If you discover any security related issues, please email security@graze.com instead of using the issue tracker.
77+
78+
## Credits
79+
80+
- [Harry Bragg](https://github.com/h-bragg)
81+
- [All Contributors](../../contributors)
82+
83+
## License
84+
85+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

bin/sprout

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env php
2+
3+
<?php
4+
5+
use Graze\Sprout\Command\DumpCommand;
6+
use Graze\Sprout\Command\SeedCommand;
7+
use Symfony\Component\Console\Application;
8+
9+
require_once '../vendor/autoload.php';
10+
11+
mb_internal_encoding("UTF-8");
12+
mb_http_output("UTF-8");
13+
14+
$console = new Application();
15+
16+
$console->add(new DumpCommand());
17+
$console->add(new SeedCommand());
18+
$console->add(new ChopCommand());
19+
20+
$console->run();

composer.json

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"name": "graze/sprout",
3+
"description": "Seed data for your project",
4+
"keywords": [
5+
"graze",
6+
"sprout"
7+
],
8+
"homepage": "https://github.com/graze/sprout",
9+
"license": "MIT",
10+
"authors": [
11+
{
12+
"name": "Harry Bragg",
13+
"email": "harry.bragg@gmail.com",
14+
"role": "Developer"
15+
},
16+
{
17+
"name": "Graze Developers",
18+
"email": "developers@graze.com",
19+
"homepage": "http://www.graze.com",
20+
"role": "Development Team"
21+
}
22+
],
23+
"config": {
24+
"platform": {
25+
"ext-tokenizer": "1.0",
26+
"ext-dom": "1.0",
27+
"ext-xmlwriter": "1.0",
28+
"ext-xml": "1.0",
29+
"ext-simplexml": "1.0",
30+
"php": "7.1"
31+
}
32+
},
33+
"require": {
34+
"php": "^5.5 | ^7.0",
35+
"symfony/console": "^3.3",
36+
"graze/parallel-process": "^0.4.0",
37+
"graze/console-diff-renderer": "^0.6.1",
38+
"symfony/filesystem": "^3.3",
39+
"graze/data-structure": "^2.0",
40+
"respect/validation": "^1.1",
41+
"graze/config-validation": "^0.1.1",
42+
"mockery/mockery": "^0.9.9"
43+
},
44+
"require-dev": {
45+
"phpunit/phpunit": "^4.2 | ^5.2",
46+
"squizlabs/php_codesniffer": "^3",
47+
"graze/standards": "^2.0"
48+
},
49+
"autoload": {
50+
"psr-4": {
51+
"Graze\\Sprout\\": "src"
52+
}
53+
},
54+
"autoload-dev": {
55+
"psr-4": {
56+
"Graze\\Sprout\\Test\\": "tests/src",
57+
"Graze\\Sprout\\Test\\Unit\\": "tests/unit",
58+
"Graze\\Sprout\\Test\\Integration\\": "tests/integration"
59+
}
60+
}
61+
}

0 commit comments

Comments
 (0)