If you are a TDD practitioner you don’t want to miss this.
We recently removed Grunfile.js from our Gushphp repository. And we replaced it all with Bldr.io. Bldr.io is written on PHP! And is an excellent tool that for the project’s current needs is perfect. We used Grunt in the past mainly for TDD, so that it would cycle running our PHPUnit tests for Gush. What we didn’t know is this Bldr.io tool can do that and in a very PHP-ish elegant way!
Check this file below:
bldr: name: gushphp/gush description: Gush Project profiles: travis: description: Travis Profile tasks: - prepare - lint - phpcs - test local: description: Local Development Profile tasks: - testLocal - watch tasks: prepare: calls: - type: filesystem:remove files: [build/coverage, build/logs] - type: filesystem:mkdir failOnError: true files: [build/coverage, build/logs] - type: filesystem:touch failOnError: true files: [build/coverage/index.html] - type: exec failOnError: true executable: composer arguments: [install, --prefer-dist] - type: notify message: Prepare Task Finished lint: description: Lints the files of the project calls: - type: apply failOnError: true src: - { path: [src, tests], files: *.php, recursive: true } output: /dev/null executable: php arguments: [-l] phpcs: description: Runs the PHP Code Sniffer calls: - type: exec executable: php arguments: - bin/phpcs - --standard=PSR2 - --report=full - src/ - type: exec output: /dev/null append: false executable: php arguments: - bin/phpcs - --standard=PSR2 - --report=checkstyle - --report-file=build/logs/checkstyle.xml - src/ test: description: Runs the PHPUnit Tests calls: - type: exec failOnError: true executable: php arguments: - bin/phpunit - --coverage-html=build/coverage - --coverage-text=php://stdout testLocal: description: Runs the PHPUnit Tests calls: - type: exec executable: clear - type: exec executable: php arguments: - bin/phpunit - --group=now watch: description: Watch Task for Local Development calls: - type: watch src: - { path: [src, tests], files: *.php, recursive: true } task: testLocal |
You can see in there that we have a couple of profiles. One for travis which is run by the .travis.yml file inside the same repository and one local that is our TDD flow. The travis profile has a list of tasks defined below under the task keys. The list only comprises a subset of these tasks, namely: prepare, lint, phpcs, and test. Bldr invokes every one of them sequentially preparing by installing composer dependencies, linting our php files, running coding style checks, and finally running the whole test suite for the project.
The output in travis is just beautiful:
Not only that but the very reason I was using Grunt is totally replaced as with the local profile I can run a much clearer and cleaner on the screen TDD workflow cycle:
Is just amazing, and a must use. I am removing Grunt from all my projects and replacing them with bldr.io.
It has so much more capabilities and nice architecture to look at.
Gush is a great project that aims to role model best practices. It also partners with Bldr.io because it makes development simpler.
We are looking into sharing a bldr.yml global configuration that can be served with Gush so to provide shortcuts on Gush flows.
I am thankful to God’s grace for having the opportunity to work on PHP development and to be maintaining a nice tool like Gush, and being able to meet people from the community developing projects such as bldr.io. This I do with great pleasure.
Thanks for reading!
I am also presenting in DrupalCon Austin about Symfony Components here. I gather some help for my trip but i am somewhat of 500$ away to cover for my expenses. If you would like to support me please send your donation to cordoval@gmail.com over paypal. Thank you!
your community friend @cordoval