Skip to content

Instantly share code, notes, and snippets.

@jgorset
Last active April 19, 2016 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgorset/bedf152398702de259072c80835c0be9 to your computer and use it in GitHub Desktop.
Save jgorset/bedf152398702de259072c80835c0be9 to your computer and use it in GitHub Desktop.
Find all Heroku apps with a given gem
# heroku-apps-with-gem.sh
apps=$(heroku apps | grep -E -v '(^===|^$)' | awk '{print $1}')

set -k

for app in $apps; do
  heroku run "cat Gemfile.lock | grep $1" -a $app --exit-code > /dev/null 2>&1

  if (( $? == 0)); then
    echo $app
  fi
done
$ ./heroku-apps-with-gem.sh rails
@jgorset
Copy link
Author

jgorset commented Apr 19, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment