Skip to content

Instantly share code, notes, and snippets.

@apeiros
Created March 5, 2010 10:35
Show Gist options
  • Save apeiros/322628 to your computer and use it in GitHub Desktop.
Save apeiros/322628 to your computer and use it in GitHub Desktop.
unless ENV["BUNDLE_GEMFILE"] then
if $stdout.tty? # Only do an interactive "do you really want to" if we're in an interactive session
require 'timeout'
Timeout.timeout 30 do
puts "\e[1;41m WARNING \e[0;41mYou're running `#{$0}` instead of `bundle exec #{$0}` \e[0m"
print "Proceed? [yN] "
$stdout.flush
abort "Terminated" unless $stdin.gets.chomp =~ /\Ay(?:es)?\z/i
end
else # not interactive, just terminate with a non-zero status
puts "You're running `#{$0}` instead of `bundle exec #{$0}`"
exit! 1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment