You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+42-15Lines changed: 42 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,8 +20,9 @@ The following dependencies are assumed to be available on the target system and
20
20
*`composer`
21
21
*`git`
22
22
*`mail`
23
+
*`mysql`
23
24
*`mysqldump`
24
-
*`php`
25
+
*`php` (v5.6 recommended)
25
26
*`realpath` (not available by default on OS X)
26
27
*`readlink`
27
28
*`zip`
@@ -52,6 +53,7 @@ Your project's `composer.json` file should include something like this:
52
53
}
53
54
}
54
55
```
56
+
55
57
Then run `composer install` to pull this repo into your project. A `bin/` folder should be created in your project root with symlinks to all of the scripts from this package.
56
58
57
59
**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.
@@ -73,42 +75,67 @@ There currently is not a convenient way to set up a test harness around this rep
73
75
## Notable Scripts
74
76
75
77
76
-
### bin/update
78
+
### bin/cache-clear
79
+
80
+
Uses the new `ConsoleShell` to iterate over all of the configured Caches in your app and clear each one.
81
+
82
+
83
+
### bin/codesniffer-run
84
+
85
+
Wraps the call to PHPCodeSniffer so that it can be called from inside or outside a Vagrant VM. Also checks the `installed_paths` configuration of phpcs and injects the necessary paths for the CakePHP and Loadsys coding standards if they are not already present.
86
+
87
+
88
+
### bin/coverage-ensure
89
+
90
+
Reads the location of the `clover.xml` file generated from your phpunit runs from your `phpunit.xml[.dist]` file, then examines that file for how much of your code is covered. Takes an integer command line argument representing the minimum required percentage, and returns with an exit status non-zero if your coverage is lacking. Intended for use during automated testing runs, such as on Travis.
91
+
92
+
93
+
### bin/db-backup
94
+
95
+
Uses the default database credentials in `config/app.php` to create a ZIPed `mysqldump` of that database in a local `backups/` folder. Helpful because you don't have to specify DB credentials. It also reports the ZIP size to help you keep a mental tally over time.
96
+
97
+
Can be used manually for one-off backups before dangerous operations (such as a code deploy and DB migrations), or automatically (such as in a Vagrant VM shutdown script, to preserve an internal DB and protect it from `vagrant destroy`.)
98
+
99
+
100
+
### bin/db-login
101
+
102
+
A simple shortcut script that uses the `[Datasources][default]` key defined in `config/app.php` to start a command line `mysql` session for you. Incredibly convenient in a production environment to run manual data queries during troubleshooting.
103
+
104
+
Also properly handles I/O redirection, so any time you would normally run `mysql --user=user -ppass --host=host --port=3306 database_name < import.sql` you can instead just run `bin/db-login < import.sql` and never have to worry about the connection credentials. Great for scripting and provisioning.
105
+
106
+
107
+
### bin/deploy
77
108
78
109
Automates all of the steps for a read-only copy of the app (such as staging or production) to pull new code from the repo and update the local running copy. It performs tasks like:
79
110
80
111
* Checking the local working copy to make sure no changes have been made from the checked-out commit that might prevent an automatic pull or merge.
81
112
* Backing up the active database (crudely, but effective for smallish apps).
82
-
* On older projects, checking for db_updates.sql changes that should be applied before merging new code and pausing to display them to the user before proceeding.
83
113
* Pulling and merging code from the remote repo.
84
114
* Applying Migrations, if present.
85
115
* Clearing Cake cache directories.
86
116
* Copying over environment-specific configs, if present.
* Ensuring file ownership and write permissions are still correct.
89
-
* Showing the user the new active commit's log.
90
-
119
+
* Showing the user the new active commit's log and optionally generating a notification email.
91
120
92
-
### bin/db-login
93
121
94
-
A simple shortcut script that uses the `[Datasources][default]` key defined in `config/app.php` to start a command line `mysql` session for you. Incredibly convenient in a production environment to run manual data queries during troubleshooting.
122
+
### bin/docs-generate
95
123
124
+
Wraps the call to phpDocumentor so that it can be called from inside or outside a Vagrant VM but always executed inside.
96
125
97
-
### bin/db-backup
98
-
99
-
Uses the default database credentials in `config/app.php` to create a ZIPed `mysqldump` of that database in a local `backups/` folder. Helpful because you don't have to specify DB credentials. It also reports the ZIP size to help you keep a mental tally over time.
100
126
127
+
### bin/tests-run
101
128
102
-
### @TODO:
129
+
Intended to serve as a convenience method for executing phpunit since it's callable from your host machine and will execute tests inside of vagrant in that case.
103
130
104
-
Add cache-clear, tests-run, docs-generate, codesniffer-run here as notable scripts.
131
+
It can also take a partial filename as an argument and run the corresponding test case directly. This mode of uses is intended to be paired with a file watcher, like [kicker](https://github.com/alloy/kicker), [grunt](http://gruntjs.com/) or [efsw](https://bitbucket.org/SpartanJ/efsw). When a source file or its test case counterpart is changed, the tests for that single file can be executed.
0 commit comments