Skip to content

Instantly share code, notes, and snippets.

@jeroenvandijk
Created June 18, 2011 19:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeroenvandijk/1033442 to your computer and use it in GitHub Desktop.
Save jeroenvandijk/1033442 to your computer and use it in GitHub Desktop.
ack your gems
#!/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
./ack.rb "your query"
@joshk
Copy link

joshk commented Jun 18, 2011

you should make this into a rubygem plugin, or a bundler addition, i can talk to andré about it

@jeroenvandijk
Copy link
Author

For others info: rubygems/bundler#1257

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment