File tree Expand file tree Collapse file tree 11 files changed +29
-72
lines changed
Expand file tree Collapse file tree 11 files changed +29
-72
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,6 @@ if [ "$1" = '-h' ]; then
2626fi
2727
2828
29- DIR=" $( cd -P " $( dirname " $0 " ) " /.. > /dev/null 2>&1 && pwd ) "
30-
3129echo " ## Clearing cache folders." ;
3230
3331cat << -'EOPHP ' | bin/cake console
Original file line number Diff line number Diff line change 2727# Set up local variables.
2828umask a+rw
2929
30- DIR=" $( cd -P " $( dirname " $0 " ) " /.. > /dev/null 2>&1 && pwd ) "
31- TMP_DIR=" ${DIR} /tmp"
30+ TMP_DIR=" tmp"
3231REPORT_DIR=" ${TMP_DIR} /code-sniffs"
3332FULL_REPORT_FILE=" ${REPORT_DIR} /report-full.txt"
3433SUMMARY_REPORT_FILE=" ${REPORT_DIR} /report-summary.txt"
Original file line number Diff line number Diff line change 3434
3535
3636# Set up working vars.
37- DIR=" $( cd -P " $( dirname " $0 " ) " /.. > /dev/null 2>&1 && pwd ) "
38- BIN_DIR=" ${DIR} /bin"
39- COMPOSER_CONFIG_FILE=" $DIR /composer.json"
40- GUESSES=( " $( which composer ) " " $BIN_DIR /composer" " $( which composer.phar ) " " $BIN_DIR /composer.phar" )
37+ COMPOSER_CONFIG_FILE=" composer.json"
38+ GUESSES=( " $( which composer ) " " bin/composer" " $( which composer.phar ) " " bin/composer.phar" )
4139
4240
4341# Bail out if there's no config file present.
Original file line number Diff line number Diff line change @@ -24,19 +24,17 @@ if [ "$1" = '-h' ]; then
2424fi
2525
2626
27- DIR=" $( cd -P " $( dirname " $0 " ) " /.. > /dev/null 2>&1 && pwd ) "
28- COVERAGE_PATH=" tmp/coverage/html/"
27+ COVERAGE_PATH=" tmp/coverage/html"
2928
3029
3130# Launch the coverage in a browser if requested and we're on the host.
3231if command -v ' open' > /dev/null 2>&1 ; then
33- bin/vagrant-exec " vendor/ bin/phpunit --coverage-html=" $COVERAGE_PATH " "
34- open " ${COVERAGE_PATH} index.html"
32+ bin/vagrant-exec " bin/phpunit --coverage-html=" $COVERAGE_PATH " "
33+ open " ${COVERAGE_PATH} / index.html"
3534else
36- cd " $DIR "
3735 bin/phpunit --coverage-html=" $COVERAGE_PATH "
3836 echo " "
39- echo " ## Run 'open ${COVERAGE_PATH} index.html'"
37+ echo " ## Run 'open ${COVERAGE_PATH} / index.html'"
4038 echo " ## from your host to view coverage reports in a browser."
4139 echo " "
4240fi
Original file line number Diff line number Diff line change 4242 * @return string The converted value with the "closest" unit used.
4343 */
4444function human_filesize ($ bytes , $ decimals = 2 ) {
45- $ sz = 'BKMGTP ' ;
45+ $ sz = 'BKMGTPEZY ' ;
4646 $ factor = floor ((strlen (intval ($ bytes )) - 1 ) / 3 );
4747 return (sprintf ("%. {$ decimals }f " , intval ($ bytes ) / pow (1024 , $ factor )) + 0 ) . @$ sz [$ factor ];
4848}
@@ -56,16 +56,15 @@ if (isset($argv[1]) && $argv[1] == '-h') {
5656}
5757
5858// Set up variables.
59- $ dir = getcwd ();
60- $ backupDir = $ dir . '/backups ' ;
59+ $ backupDir = 'backups ' ;
6160$ date = date ('Ymd-His ' );
6261try {
63- $ credentialsScript = "{ $ dir } / bin/db-credentials" ;
62+ $ credentialsScript = ' bin/db-credentials ' ;
6463 if (!is_readable ($ credentialsScript )) {
6564 echo "!! DB credentials are not available. Aborting. " ;
6665 exit (3 );
6766 }
68-
67+
6968 ob_start (); // Capture the shebang line from db-credentials.
7069 $ db = include ($ credentialsScript );
7170 ob_get_clean (); // Flush it.
Original file line number Diff line number Diff line change @@ -82,10 +82,9 @@ class DbConfig {
8282 * @return void
8383 */
8484 public function __construct () {
85- $ dir = getcwd ();
86- $ injectedCode = 'use Cake\Datasource\ConnectionManager; echo serialize(ConnectionManager::config("default")) . PHP_EOL; exit; ' ; // This must be on a single line to work with the REPL.
85+ $ injectedCode = 'echo serialize(\Cake\Datasource\ConnectionManager::config("default")) . PHP_EOL; exit; ' ; // This must be on a single line to work with the REPL.
8786 $ cmd = "echo ' {$ injectedCode }' | "
88- . escapeshellcmd ("{ $ dir } / bin/cake Console -q " );
87+ . escapeshellcmd ("bin/cake Console -q " );
8988 $ response = [];
9089 $ code = 0 ;
9190 exec ($ cmd , $ response , $ code );
Original file line number Diff line number Diff line change @@ -32,11 +32,8 @@ if [ "$1" = '--help' ]; then
3232fi
3333
3434
35- DIR=" $( cd -P " $( dirname " $0 " ) " /.. > /dev/null 2>&1 && pwd ) "
36- BIN_DIR=" $DIR /bin"
37-
3835# Holy yuck, but nothing else works!
39- eval $( ${BIN_DIR} /db-credentials )
36+ eval $( bin /db-credentials )
4037
4138# Set a custom port, if provided to us.
4239if [ -n " ${DB_PORT} " ]; then
Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ ${0##*/}
1616Usage:
1717 bin/${0##*/ } [table] [table2] [table3]
1818
19+ Environment:
20+ DB_SAMPLE_DATA_URL - If this environment variable is set, it will
21+ be used when displaying the download URL for
22+ the temporary zip file.
1923
2024EOT
2125
@@ -30,21 +34,18 @@ if [ -z "$1" ]; then
3034else
3135 TABLES=" --tables " $* " "
3236fi
33- DIR=" $( cd -P " $( dirname " $0 " ) " /.. > /dev/null 2>&1 && pwd ) "
34- APP_DIR=" $DIR "
35- BIN_DIR=" ${DIR} /bin"
3637
3738
3839# Configuration vars. Set these appropriately for your app and environment.
39- PUBLIC_URL=" "
40- WEBROOT_PATH=" $APP_DIR / webroot/"
40+ PUBLIC_URL=${DB_SAMPLE_DATA_URL :- }
41+ WEBROOT_PATH=" webroot/"
4142
4243
4344# Internal var setup.
44- eval $( ${BIN_DIR} /db-credentials ) # Yuck, but nothing else works!
45+ eval $( bin /db-credentials ) # Yuck, but nothing else works!
4546DATE=$( date +%Y-%m-%d)
4647OPTIONS=" --skip-add-drop-table --no-create-info"
47- TMP_PATH=" $APP_DIR / tmp/"
48+ TMP_PATH=" tmp/"
4849DESTINATION_NAME=" ${DB_NAME} _sample_data_${DATE} "
4950
5051# Generate the dump, compress it and move it into place.
Original file line number Diff line number Diff line change @@ -26,7 +26,5 @@ if [ "$1" = '-h' ]; then
2626fi
2727
2828
29- DIR=" $( cd -P " $( dirname " $0 " ) " /.. > /dev/null 2>&1 && pwd ) "
30-
3129echo " ## Clearing logs." ;
32- rm -f $DIR / logs/*
30+ rm -f logs/*
Original file line number Diff line number Diff line change @@ -6,13 +6,11 @@ usage ()
66 cat << EOT
77
88${0##*/ }
9- Convenience wrapper to run any pending Migrations. Takes an optional
10- Migrations COMMAND (defaults to "run all") and an optional plugin
11- for which to execute migrations. Should be run from the project
12- root folder.
9+ Convenience wrapper to run any pending Migrations. Should be
10+ run from the project root folder.
1311
1412Usage:
15- bin/${0##*/ } [command] [plugin]
13+ bin/${0##*/ }
1614
1715
1816EOT
@@ -23,29 +21,6 @@ if [ "$1" = '-h' ]; then
2321 usage
2422fi
2523
26-
27-
28- DIR=" $( cd -P " $( dirname " $0 " ) " /.. > /dev/null 2>&1 && pwd ) "
29-
30- if [ " $1 " ]; then
31- OPTION=$1 ;
32- else
33- OPTION=" run all" ;
34- fi
35-
36- if [ " $2 " ]; then
37- PLUGIN=$2 ;
38- else
39- PLUGIN=" app"
40- fi
41-
42-
43- if [ $PLUGIN == " app" ]; then
44- PLUGIN=" "
45- else
46- PLUGIN=" -p $PLUGIN "
47- fi
48-
49- $DIR /bin/cache-clear
50- $DIR /bin/cake Migrations.migration $OPTION $PLUGIN
51- $DIR /bin/cache-clear
24+ bin/cache-clear
25+ bin/cake Migrations.migration migrate
26+ bin/cache-clear
You can’t perform that action at this time.
0 commit comments