├── symfony ├── log ├── build ├── core ├── test └── dev ├── composer.json ├── git └── core ├── scrutinizer └── core ├── include.all ├── composer └── core ├── Makefile ├── travisci └── build ├── LICENSE └── README.md /symfony/log: -------------------------------------------------------------------------------- 1 | symfony.logs: 2 | cat app/logs/*.log 3 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "eddiejaoude/dev-helper-cmds", 3 | "description": "Useful commands for every Developer" 4 | } 5 | -------------------------------------------------------------------------------- /symfony/build: -------------------------------------------------------------------------------- 1 | build.assets: 2 | php app/console assetic:dump 3 | git add web/css/* 4 | git add web/js/* 5 | git commit -m "Web assets added" web/ 6 | -------------------------------------------------------------------------------- /git/core: -------------------------------------------------------------------------------- 1 | # Git core # 2 | # -------- # 3 | 4 | git.status: 5 | git status -s 6 | 7 | git.branch: 8 | git fetch --tags 9 | git checkout ${branch} 10 | -------------------------------------------------------------------------------- /symfony/core: -------------------------------------------------------------------------------- 1 | # Symfony # 2 | # ------- # 3 | 4 | symfony.server: 5 | php app/console server:run -vvv 6 | 7 | symfony.clear: 8 | php app/console cache:clear 9 | -------------------------------------------------------------------------------- /scrutinizer/core: -------------------------------------------------------------------------------- 1 | scrutinizer.coverage: 2 | wget https://scrutinizer-ci.com/ocular.phar 3 | php ocular.phar code-coverage:upload --format=php-clover test/build/coverage.xml 4 | -------------------------------------------------------------------------------- /include.all: -------------------------------------------------------------------------------- 1 | include $(LOCATION)/git/* 2 | include $(LOCATION)/composer/* 3 | include $(LOCATION)/symfony/* 4 | include $(LOCATION)/scrutinizer/* 5 | include $(LOCATION)/travisci/* 6 | -------------------------------------------------------------------------------- /composer/core: -------------------------------------------------------------------------------- 1 | composer.download: 2 | if [ ! -f "composer.phar" ] ; then curl -s http://getcomposer.org/installer | php ; fi 3 | 4 | composer.install: composer.download 5 | php composer.phar install --dev --no-interaction 6 | 7 | composer.update: composer.download 8 | php composer.phar update 9 | -------------------------------------------------------------------------------- /symfony/test: -------------------------------------------------------------------------------- 1 | # Symfony Test # 2 | # ------------ # 3 | 4 | symfony.test.run: 5 | bin/robo parallel:run 6 | 7 | symfony.test.bdd: 8 | bin/behat --suite=${suite} 9 | 10 | symfony.test.spec: 11 | bin/phpspec run -vvv --format=pretty 12 | 13 | symfony.test.unit: 14 | bin/phpunit --configuration ${suite} 15 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # This includes all helper make files # 2 | # ----------------------------------- # 3 | 4 | LOCATION=. 5 | 6 | include $(LOCATION)/include.all 7 | 8 | # --- 9 | # Below is example overwriting commands 10 | # Note: you will get warnings 11 | # --- 12 | 13 | #symfony.test.spec: 14 | # bin/phpspec run --config test/phpspec.yml 15 | 16 | #symfony.test.bdd: 17 | # bin/behat --config test/behat.yml --suite=${suite} 18 | -------------------------------------------------------------------------------- /symfony/dev: -------------------------------------------------------------------------------- 1 | # Symfony Dev # 2 | # ----------- # 3 | 4 | symfony.dev.rebuild: symfony.dev.db.drop symfony.dev.db.create symfony.dev.db.update symfony.dev.db.data 5 | 6 | symfony.dev.db.drop: 7 | -php app/console doctrine:database:drop --force 8 | 9 | symfony.dev.db.create: 10 | php app/console doctrine:database:create 11 | 12 | symfony.dev.db.update: 13 | php app/console doctrine:schema:update --force 14 | 15 | symfony.dev.db.data: 16 | php app/console doctrine:fixtures:load --no-interaction 17 | -------------------------------------------------------------------------------- /travisci/build: -------------------------------------------------------------------------------- 1 | GIT_TAG=build-$(TRAVIS_BRANCH)-$(TRAVIS_BUILD_NUMBER) 2 | 3 | # required for pushing tags to Github 4 | # ---------------------------------------- 5 | # $(GITHUBKEY) make sure this is encrypted 6 | # $(GITHUBPROJECT) 7 | # $(VERSIONFILE) 8 | # ---------------------------------------- 9 | 10 | build.package: build.user build.version build.changelog build.tag 11 | 12 | build.user: 13 | git config --global user.email "builds@travis-ci.com" 14 | git config --global user.name "Travis CI" 15 | 16 | build.version: build.version.update build.version.commit 17 | 18 | build.version.update: 19 | echo $(GIT_TAG) > $(VERSIONFILE) 20 | 21 | build.version.commit: 22 | git commit -m "Set build VERSION number $(GIT_TAG)" $(VERSIONFILE) 23 | 24 | build.changelog: 25 | git log --all --format='%h%x09%an%x09%ad%x09%s' > changelog 26 | git commit -m "Created changelog" changelog 27 | 28 | build.tag: 29 | git tag $(GIT_TAG) -a -m "Generated tag from TravisCI build $(TRAVIS_BUILD_NUMBER)" 30 | @git push --quiet https://$(GITHUBKEY)@github.com/$(GITHUBPROJECT) $(GIT_TAG) > /dev/null 2>&1 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Eddie Abou-Jaoude 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. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dev Helper Commands 2 | 3 | [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/eddiejaoude/dev-helper-cmds?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 4 | 5 | Useful commands for every Developer. 6 | 7 | This abstracts the commands required for development. 8 | 9 | For example: 10 | 11 | If a developer/tester needs to start the webserver, then should **NOT* * care if you are using vagrant or php built-in webserver. 12 | They should just run the same command (eg. make dev.server). This way, when updating the architecture, the same commands 13 | can be run, even if they are doing something slightly different or more than in an earlier version. 14 | 15 | ## Usage 16 | 17 | 1. Create a `Makefile` in the root of your project. 18 | 19 | 2. Added a `LOCATION` parameter to the top of the `Makefile` 20 | 21 | ``` 22 | LOCATION=. 23 | ``` 24 | 25 | If you have brought in this Helper Library with `composer`, then you need to update the location of the include files. 26 | 27 | In your main Makefile update the location parameter: 28 | 29 | ``` 30 | LOCATION=vendor/eddiejaoude/dev-helper-cmds 31 | ``` 32 | 33 | *Note: must **NOT** end in a `/`* 34 | 35 | 3. Now include the *commands* you want to use or include all by adding the following to your `Makefile` 36 | 37 | ``` 38 | include $(LOCATION)/include.all 39 | ``` 40 | 41 | 4. Then you are done. 42 | 43 | Below our the built-in commands. 44 | 45 | ### Overriding commands 46 | 47 | You can override these by adding to your Makefile that contains all the includes. 48 | 49 | ``` 50 | # --- 51 | # Below is example overwriting commands 52 | # Note: you will get warnings 53 | # --- 54 | 55 | symfony.test.spec: 56 | bin/phpspec run --config test/phpspec.yml 57 | 58 | symfony.test.bdd: 59 | bin/behat --config test/behat.yml 60 | ``` 61 | 62 | ### Combining commands to make new ones 63 | 64 | It is also possible to combine exist or new commands with a new command: 65 | 66 | ``` 67 | new.command: old.cmd1 old.cmd2 68 | echo NEW CMD 69 | ``` 70 | 71 | ### Added Custom commands 72 | 73 | 1. Create a directory in your project root `.make/` 74 | 75 | 2. Add command files inside new directory `.make/log` 76 | 77 | 3. In your Makefile include new custom files with 78 | 79 | ``` 80 | include .make/* 81 | ``` 82 | 83 | All done! 84 | 85 | 86 | --- 87 | 88 | ### Built-in commands 89 | 90 | #### Git commands 91 | 92 | * `make git.status` 93 | * `make git.branch branch=build-feature/symfony2-behat-35` (this can be a branch or tag or commit hash) 94 | 95 | #### Composer commands 96 | 97 | * `make composer.download` 98 | * `make composer.install` 99 | * dependency on `composer.download` 100 | * `make composer.update` 101 | * dependency on `composer.download` 102 | 103 | #### Symfony 104 | 105 | ##### Built-in Server 106 | 107 | * `make symfony.server` 108 | 109 | ##### Dump logs 110 | 111 | * `make symfony.logs` 112 | 113 | ##### Database 114 | 115 | * `make symfony.dev.rebuild` runs all the commands below... 116 | 117 | * `make symfony.dev.db.drop` drops the database 118 | * `make symfony.dev.db.create` creates the database 119 | * `make symfony.dev.db.update` updates the database 120 | * `make symfony.dev.db.data` loads fixture data into database 121 | 122 | ##### Dump & commit assets 123 | 124 | * `make build.assets` 125 | 126 | Example usage / override, add the following to your custom Makefile (or include) 127 | 128 | ```build.package: build.user build.version build.changelog build.assets build.tag``` 129 | 130 | ##### Running tests in parallel using Robo 131 | 132 | * `make symfony.test.run` 133 | * dependency on Robo 134 | 135 | ##### Running Behat tests 136 | 137 | * `make symfony.test.bdd` 138 | * dependency on Behat & SymfonyBehat bundle 139 | 140 | ##### Running PHPSpec 141 | 142 | * `make symfony.test.spec` 143 | * dependency on PHPSpec 144 | 145 | ##### Running PHPUnit 146 | 147 | * `symfony.test.unit suite=app` 148 | 149 | --------------------------------------------------------------------------------