Skip to content

Commit 973845a

Browse files
committed
Updates documentation of "notable" scripts.
Adds a license file.
1 parent ba662fc commit 973845a

2 files changed

Lines changed: 63 additions & 15 deletions

File tree

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# The MIT License (MIT)
2+
3+
Copyright (c) 2015 Loadsys Web Strategies
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
13+
> all 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
21+
> THE SOFTWARE.

README.md

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ The following dependencies are assumed to be available on the target system and
2020
* `composer`
2121
* `git`
2222
* `mail`
23+
* `mysql`
2324
* `mysqldump`
24-
* `php`
25+
* `php` (v5.6 recommended)
2526
* `realpath` (not available by default on OS X)
2627
* `readlink`
2728
* `zip`
@@ -52,6 +53,7 @@ Your project's `composer.json` file should include something like this:
5253
}
5354
}
5455
```
56+
5557
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.
5658

5759
**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
7375
## Notable Scripts
7476

7577

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
77108

78109
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:
79110

80111
* 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.
81112
* 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.
83113
* Pulling and merging code from the remote repo.
84114
* Applying Migrations, if present.
85115
* Clearing Cake cache directories.
86116
* Copying over environment-specific configs, if present.
87-
* Updating git submodules.
117+
* Updating git submodules and/or composer dependencies.
88118
* 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.
91120

92-
### bin/db-login
93121

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
95123

124+
Wraps the call to phpDocumentor so that it can be called from inside or outside a Vagrant VM but always executed inside.
96125

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.
100126

127+
### bin/tests-run
101128

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.
103130

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.
105132

106133

107134
## License
108135

109-
MIT
136+
[MIT](LICENSE.md)
110137

111138

112139
## Copyright
113140

114-
Copyright 2015 Loadsys Web Strategies
141+
Copyright &copy; 2015 [Loadsys Web Strategies](http://loadsys.com)

0 commit comments

Comments
 (0)