Created
October 17, 2013 18:42
-
-
Save jamie/7030049 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
function command_not_found_handler() { | |
~/bin/command-not-found $* | |
} |
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
#!/usr/bin/env ruby | |
command = ARGV.first | |
def run(cmd) | |
$stderr.puts "Running #{cmd.inspect} instead" | |
system(cmd) | |
end | |
case | |
# Paste git repo url to clone it | |
when command =~ /^git(@|:\/\/).*\.git$/ | |
run("git clone #{command.inspect}") | |
# paste compressed url to download+extract it | |
when command =~ /^(?:ftp|https?):\/\/.+\.t(?:ar\.)?gz$/ | |
run("curl #{command.inspect} | tar xzv") | |
when File.exist?("./tmp/isolate/ruby-1.8/bin/#{command}") | |
run("rake isolate:sh['#{ARGV.join(' ')}']") | |
when File.exist?("./.bundle/config") && (File.exist?("./bin/#{command}") || File.exist?("./bins/#{command}")) | |
run("bundle exec #{ARGV.join(' ')}") | |
else | |
exit 1 | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment