Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2015 14:14
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
export PATH="/usr/local/bin/:$PATH"
eval "$(rbenv init - zsh)"
# Syntax check
ruby -w -c $1
# Brakeman vulnerability check
rails_root=`bundle exec rake about 2>/dev/null | grep "Application root" | awk '{print $3}'`
if [ "x${rails_root}" != "x" ]; then
bundle exec brakeman ${rails_root} -f json -z --only-files $1 | ruby -r json -e 'JSON.parse(["warnings"].collect {|h| path = h["file"].gsub(File.dirname(h["file"]), File.dirname(ARGV[0])); [path, h["line"], h["warning_type"], h["message"]].join(":")}.each {|s| STDERR.puts s}' $1
exit $? || $rc_exitcode
exit $rc_exitcode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment