Skip to content

Commit 18d139e

Browse files
committed
Merge pull request #15 from loadsys/f/tweaks
F/tweaks
2 parents c3625a4 + 8984af9 commit 18d139e

7 files changed

Lines changed: 66 additions & 17 deletions

File tree

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Potential folders that might show up here as accidental script output.
2+
composer.lock
23
backups
34
tmp
5+
bin
6+
/vendor/
47

58
# OS generated files
69
.DS_Store
@@ -11,5 +14,3 @@ tmp
1114
Icon?
1215
ehthumbs.db
1316
Thumbs.db
14-
15-
/vendor/

README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,31 @@ This collection of scripts is intended to provide consistency and shortcuts for
1515
The following dependencies are assumed to be available on the target system and available in the default `PATH`.
1616

1717
* `bash`
18-
* `php`
1918
* `composer`
20-
* `phpcs`
21-
* `phpunit`
22-
* `mysqldump`
2319
* `git`
24-
* `zip`
2520
* `mail`
26-
* `bin/phpdoc.php` (composer installed)
27-
* `bin/cake` (composer installed)
28-
21+
* `mysqldump`
22+
* `pear`
23+
* `php`
2924
* `realpath` (not available by default on OS X)
3025
* `readlink`
26+
* `zip`
3127

28+
Additionally, some scripts expect additional tools that should be automatically installed as composer dependencies to _this_ package:
29+
30+
* `bin/phpcs`
31+
* `bin/phpunit`
32+
* `bin/phpdoc.php`
33+
* `bin/cake` (composer installed **by target project**)
3234

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

37+
3538
## Installation ##
3639

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

39-
## composer ##
42+
### composer ###
4043

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

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

5558
**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.
5659

57-
## git submodule ##
60+
### git submodule ###
5861

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

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
}
1010
],
1111
"require": {
12-
"php": ">=5.3.0"
12+
"php": ">=5.3.0",
13+
"phpunit/phpunit": "3.7.*",
14+
"phpdocumentor/phpdocumentor": "2.*@beta",
15+
"squizlabs/php_codesniffer": "1.*",
16+
"loadsys/loadsys_codesniffer": "0.*"
1317
},
1418
"config": {
1519
"bin-dir": "bin"
@@ -45,6 +49,7 @@
4549
"pear-package-installed-dumb",
4650
"rename-empty",
4751
"run-codesniffer",
52+
"run-in-vagrant",
4853
"run-tests",
4954
"set-configs",
5055
"set-owner",

deps-install

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ if [ -e "$COMPOSER_CONFIG_FILE" ]; then
6060
else
6161
echo "## Found composer at: ${COMPOSER}"
6262
"$COMPOSER" install --no-interaction
63+
"$COMPOSER" dumpautoload --optimize
6364
fi
6465
fi
6566

run-codesniffer

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,10 @@ $PHPCS -p --extensions=php --standard=CakePHP ${COVERAGE} ${SNIFF_FOLDERS[@]}
6666
if [ $SAVE_REPORTS ] && [ $? -eq 0 ]; then
6767
echo "## Full report created at: ${FULL_REPORT_FILE}"
6868
echo "## Summary report created at: ${SUMMARY_REPORT_FILE}"
69-
fi
69+
fi
70+
71+
72+
#@TODO: Make use of new Loadsys code standard.
73+
# Ref: https://github.com/loadsys/loadsys_codesniffer
74+
# Example usage:
75+
# bin/phpcs --standard=Vendor/loadsys/loadsys_codesniffer/Loadsys --report-summary -p --extensions=php Controller/ Model/ View/ Lib/

run-in-vagrant

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
3+
#---------------------------------------------------------------------
4+
usage ()
5+
{
6+
cat <<EOT
7+
8+
${0##*/}
9+
Executes the provided arguments inside the current vagrant VM,
10+
if present. Otherwise just executes the arguments. The entire
11+
command string MUST be quoted. All paths used must be relative
12+
to the root project folder shared between the host and VM.
13+
14+
Usage:
15+
bin/${0##*/} "Command [--with args]"
16+
17+
EOT
18+
19+
exit 0
20+
}
21+
if [ "$1" = '-h' ]; then
22+
usage
23+
fi
24+
25+
echo "@TODO: WIP"
26+
exit 1
27+
28+
29+
if mount | grep -q '^/vagrant'; then
30+
vagrant ssh -c "cd /vagrant; $@"
31+
else
32+
eval "$@"
33+
fi

run-tests

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ else
3939
fi
4040

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

0 commit comments

Comments
 (0)