Created
April 26, 2011 23:47
-
-
Save mwotton/943429 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def guarded(task) | |
%x{#{task}}.tap { raise "bad exit" if $?.exitstatus!=0 } | |
rescue => e | |
yield e if block_given? | |
end | |
guarded("git config --global github.token") do |error| | |
abort "please add your token to ~/.gitconfig with git config --global github.token MYTOKEN" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment