Skip to content

Instantly share code, notes, and snippets.

@mcdwayne
Last active March 25, 2019 12:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcdwayne/55fa82c0f71ca0c8fe7573f6e55421c6 to your computer and use it in GitHub Desktop.
Save mcdwayne/55fa82c0f71ca0c8fe7573f6e55421c6 to your computer and use it in GitHub Desktop.
a little script to ask you for a module name to install, check and give you hash in one step, per Joe Purcell's process: https://docs.google.com/document/d/1UnVzmQhCv9_IT0-u-tjvWPDR-QQAU31ij2iKkio8U3U
#!/bin/bash
## Author: mcdwayne
## Created to support this project doc:
## https://docs.google.com/document/d/1UnVzmQhCv9_IT0-u-tjvWPDR-QQAU31ij2iKkio8U3U/edit#
##
## Made at MidCamp 2019
# Ask for the module's machine name
# this is found in the module URL.
# example: jsonapi - https://www.drupal.org/project/jsonapi
if [ -z "$1" ]; then
echo -n "What module we checking? " && read MODULENAME
else
MODULENAME=$1
fi
# Make sure we don't lose newlines in our echo later, but safely
old_IFS=$IFS
IFS=
# open the ticket to assign the meta properly
open -a /Applications/Google\ Chrome.app 'https://www.drupal.org/node/add/project-issue/drupal?title=Drupal%209%20Deprecated%20Code%20Report&categories=2&priorities=200&status=1&tags=Drupal%209%20compatibility%2C%20midcamp2019'
# Install the module with composer
composer require drupal/$MODULENAME
# use the awesome drupal-check tool, store output as a variable dcount
dcout=$(drupal-check web/modules/contrib/$MODULENAME)
# grep the hash and store it in the variable hashout
hashout=$(composer show -i drupal/$MODULENAME | grep source)
# construct the thing we are going to paste into the template
# copy it into the Mac clipboard
## Windows and Linux users, you going to have to figure this out, but if you drop '| pbcopy'
## it should just print to the screen to manually c/p
echo -e "drupal-check results on commit hash: \n" $hashout '\n \n' "<code>" '\n\n' $dcout "\n </code>" | pbcopy
# reset ISF to whatever it was before for safety reasons
IFS=${old_IFS}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment