From dc1233ab3a49d14db8d5d1d27063b5b1e5b5fce5 Mon Sep 17 00:00:00 2001 From: Brian Porter Date: Tue, 12 Apr 2016 10:10:50 -0500 Subject: [PATCH 1/2] WIP --- baremetal-bootstrap | 15 ++++++++++++++- deploy | 4 ++-- tests-run | 4 +--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/baremetal-bootstrap b/baremetal-bootstrap index 417e95b..f0888e2 100644 --- a/baremetal-bootstrap +++ b/baremetal-bootstrap @@ -15,7 +15,7 @@ ${0##*/} Usage: From the machine to be provisioned: - curl https://raw.githubusercontent.com/loadsys/CakePHP-Shell-Scripts/master/${0##*/} | bash -s -- + curl -sS https://raw.githubusercontent.com/loadsys/CakePHP-Shell-Scripts/master/baremetal-bootstrap | bash -s -- Should be run as the user the app will run as on the target server. @@ -93,6 +93,19 @@ fi # EOD +if [ -n "$(which git-lfs)" ]; then + echo "## Git-LFS support appears to already be installed." +elif [ -n "$(which brew)" ]; then + echo "## Installing git-lfs support using Homebrew." + brew install git-lfs + git lfs install +elif [ -n "$(which port)" ]; then + echo "## Installing git-lfs support using MacPorts." + sudo port install git-lfs + git lfs install +fi + + echo "## Cloning repo." git clone -b $GIT_BRANCH $REPO_CLONE_URL repo diff --git a/deploy b/deploy index 03099ab..9c31e93 100755 --- a/deploy +++ b/deploy @@ -102,7 +102,7 @@ echo "## Current commit is $EXISTINGBRANCH ($EXISTINGCOMMIT)"; # Update repository. echo "## Pulling changes from remote repo."; -git fetch origin refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/* +git fetch origin --prune refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/* # Apply database updates, one way or another. @@ -118,7 +118,7 @@ fi # forward on the same branch, or switch to the HEAD of a different branch. # if [ "$ARG_NEWCOMMIT" = "origin/master" ]; then echo "## Merging upstream changes from: $ARG_NEWCOMMIT"; - git merge $ARG_NEWCOMMIT + git merge --ff-only $ARG_NEWCOMMIT # else # echo "## Checking out new commit: $ARG_NEWCOMMIT"; # git checkout $ARG_NEWCOMMIT diff --git a/tests-run b/tests-run index dd4711b..eedc4f5 100755 --- a/tests-run +++ b/tests-run @@ -99,15 +99,13 @@ if (isset($argv[1]) && $argv[1] == '-h') { // Set up variables. array_shift($argv); // Strip the script name off and throw it away. $argc--; // Reindex argc so we can use it directly on remaining args. +$args = ''; if ($argc) { $args = array_map('Loadsys\CakePHPShellScripts\TestsRun\findTestCase', $argv); $args = array_map('escapeshellarg', $args); $args = implode(' ', $args); -// $args = '"' . $args . '"'; $args = ' ' . $args; -} else { - $args = ''; } $testCmd = "bin/vagrant-exec \"bin/phpunit{$args}\""; From 76370b3743f8be6e3728c46d6106f8ab9dec9e4a Mon Sep 17 00:00:00 2001 From: Brian Porter Date: Wed, 15 Jun 2016 12:50:09 -0500 Subject: [PATCH 2/2] WIP on a more generic, non-grunt-based file watcher. --- watch | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 watch diff --git a/watch b/watch new file mode 100644 index 0000000..4c3e2be --- /dev/null +++ b/watch @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# Wrapper around `fswatch` to pass changed files into `bin/tests-run`. + +#@TODO: Bail if fswatch is not available. (add to readme as a dep.) + +echo "## Test watcher running. Save a file to execute the corresponding test in vagrant." + +fswatch -0 src/ tests/ | xargs -0 -n 1 -I {} sh -c 'echo " - {}"; bin/tests-run "{}"' + +#@TODO: Use a custom phpunit.xml that does not produce TWO coverage reports by default. + +#@TODO: Suppress tests/bootstrap.php from clearing caches? (reduce output "noise")