Skip to content

Instantly share code, notes, and snippets.

View mpdonadio's full-sized avatar

Matthew Donadio mpdonadio

View GitHub Profile
@mpdonadio
mpdonadio / patch.sh
Created May 5, 2017 00:45
Generate a Drupal patch+interdiff when using branch-per-patch method, where branch is issue#-comment#. Doesn't take into account fetching or rebasing.
#!/bin/bash
ISSUE=`git rev-parse --abbrev-ref HEAD | cut -d'-' -f1`
COMMENT1=`git branch | grep -B 1 '*' | head -1 | cut -d'-' -f2`
COMMENT2=`git rev-parse --abbrev-ref HEAD | cut -d'-' -f2`
rm -f *.patch interdiff*.txt
git diff origin/8.4.x > `git rev-parse --abbrev-ref HEAD`.patch
@mpdonadio
mpdonadio / phpunit.sh
Created March 4, 2017 15:49
Run phpunit on all changed tests
#!/bin/bash
for i in `git diff --name-only origin/8.4.x | grep -E 'src/Functional|src/Kernel'`; do
vendor/bin/phpunit --verbose --configuration core/phpunit.xml $i
done
@mpdonadio
mpdonadio / phpcs.sh
Created March 4, 2017 15:47
Run phpcs on changes files
#!/bin/bash
phpcs --standard=Drupal --report-width=74 `git diff --name-only origin/8.4.x`

Keybase proof

I hereby claim:

  • I am mpdonadio on github.
  • I am mpdonadio (https://keybase.io/mpdonadio) on keybase.
  • I have a public key whose fingerprint is D6B9 12FE 7E58 E17C EE66 4C9D 9D59 38FF 8EBD 3E94

To claim this, I am signing this object:

function drupal-install() {
# If you run this command with an argument, it will be the name of the DB
if [ $1 ] ; then
drush si --notify --account-pass=admin --db-url=mysql://root:root@localhost/$1 -y
else
drush si --notify --account-pass=admin --db-url=mysql://root:root@localhost/d8 -y
fi
# Install and uninstall common modules
#drush en devel simpletest -y
}
function drupal-clean() {
# Remove existing database
drush sql-drop -y;
# Remove existing install
sudo rm -rf sites/default;
# Restore the sites/default/default.settings.php file
sudo git checkout -- sites/default;
# Temporarily make the sites/default writable by anyone
sudo chmod -R 777 sites/default;
# Ensure the owner is the current user, not root user