Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Potential folders that might show up here as accidental script output.
composer.lock
backups
tmp
bin
/vendor/

# OS generated files
.DS_Store
Expand All @@ -11,5 +14,3 @@ tmp
Icon?
ehthumbs.db
Thumbs.db

/vendor/
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,31 @@ This collection of scripts is intended to provide consistency and shortcuts for
The following dependencies are assumed to be available on the target system and available in the default `PATH`.

* `bash`
* `php`
* `composer`
* `phpcs`
* `phpunit`
* `mysqldump`
* `git`
* `zip`
* `mail`
* `bin/phpdoc.php` (composer installed)
* `bin/cake` (composer installed)

* `mysqldump`
* `pear`
* `php`
* `realpath` (not available by default on OS X)
* `readlink`
* `zip`

Additionally, some scripts expect additional tools that should be automatically installed as composer dependencies to _this_ package:

* `bin/phpcs`
* `bin/phpunit`
* `bin/phpdoc.php`
* `bin/cake` (composer installed **by target project**)

If these items are not available, some scripts may not function as expected.


## Installation ##

**WARNING!** These scripts are currently only compatible with Cake 2.x. Don't try to use them on a 1.x project.

## composer ##
### composer ###

Your project's own `composer.json` file should look something like this:

Expand All @@ -54,7 +57,7 @@ Then run `composer install` to pull this repo into your project. A `bin/` folder

**Note**: The `bin-dir` is non-standard and may cause conflicts with other composer packages that install "binaries". These scripts are all expect to live in `PROJECT_ROOT/bin` though so don't expect anything to work if you forgo the `bin-dir` setting in your project.

## git submodule ##
### git submodule ###

(This is the old method and will eventually be retired.)

Expand Down
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
}
],
"require": {
"php": ">=5.3.0"
"php": ">=5.3.0",
"phpunit/phpunit": "3.7.*",
"phpdocumentor/phpdocumentor": "2.*@beta",
"squizlabs/php_codesniffer": "1.*",
"loadsys/loadsys_codesniffer": "0.*"
},
"config": {
"bin-dir": "bin"
Expand Down Expand Up @@ -45,6 +49,7 @@
"pear-package-installed-dumb",
"rename-empty",
"run-codesniffer",
"run-in-vagrant",
"run-tests",
"set-configs",
"set-owner",
Expand Down
1 change: 1 addition & 0 deletions deps-install
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ if [ -e "$COMPOSER_CONFIG_FILE" ]; then
else
echo "## Found composer at: ${COMPOSER}"
"$COMPOSER" install --no-interaction
"$COMPOSER" dumpautoload --optimize
fi
fi

Expand Down
8 changes: 7 additions & 1 deletion run-codesniffer
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,10 @@ $PHPCS -p --extensions=php --standard=CakePHP ${COVERAGE} ${SNIFF_FOLDERS[@]}
if [ $SAVE_REPORTS ] && [ $? -eq 0 ]; then
echo "## Full report created at: ${FULL_REPORT_FILE}"
echo "## Summary report created at: ${SUMMARY_REPORT_FILE}"
fi
fi


#@TODO: Make use of new Loadsys code standard.
# Ref: https://github.com/loadsys/loadsys_codesniffer
# Example usage:
# bin/phpcs --standard=Vendor/loadsys/loadsys_codesniffer/Loadsys --report-summary -p --extensions=php Controller/ Model/ View/ Lib/
33 changes: 33 additions & 0 deletions run-in-vagrant
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

#---------------------------------------------------------------------
usage ()
{
cat <<EOT

${0##*/}
Executes the provided arguments inside the current vagrant VM,
if present. Otherwise just executes the arguments. The entire
command string MUST be quoted. All paths used must be relative
to the root project folder shared between the host and VM.

Usage:
bin/${0##*/} "Command [--with args]"

EOT

exit 0
}
if [ "$1" = '-h' ]; then
usage
fi

echo "@TODO: WIP"
exit 1


if mount | grep -q '^/vagrant'; then
vagrant ssh -c "cd /vagrant; $@"
else
eval "$@"
fi
6 changes: 3 additions & 3 deletions run-tests
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ else
fi

bin/clear-cache
if [ -e '.vagrant' ]; then
vagrant ssh -c "cd /var/www; Console/cake test app $TESTCASE --configuration="${PHPUNIT_CONFIG}" "$@""
else
if mount | grep -q '^/vagrant'; then
Console/cake test app $TESTCASE --configuration="${PHPUNIT_CONFIG}" "$@"
else
vagrant ssh -c "cd /var/www; Console/cake test app $TESTCASE --configuration="${PHPUNIT_CONFIG}" "$@""
fi