Created
June 18, 2011 19:41
-
-
Save jeroenvandijk/1033442 to your computer and use it in GitHub Desktop.
ack your gems
This file contains hidden or 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 | |
# Usage: | |
# | |
# ./ack.rb your-query | |
require 'rubygems' | |
require 'bundler' | |
if query = ARGV[0] | |
gem_dirs = Bundler.load.specs.map(&:full_gem_path).join(' ') | |
ack_installed = system("which ack > /dev/null 2>&1") | |
if ack_installed | |
cmd = %{ack -i "#{query}" #{gem_dirs}} | |
exec cmd | |
# elsif grep_installed | |
# TODO add grep support | |
else | |
puts %{Please install ack | |
E.g. brew install ack} | |
end | |
else | |
puts "No query given" | |
end |
This file contains hidden or 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
./ack.rb "your query" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you should make this into a rubygem plugin, or a bundler addition, i can talk to andré about it