Class: BundleGrep

Inherits:
Bundler::Plugin::API
  • Object
show all
Defined in:
lib/bundle_grep.rb,
lib/bundle_grep/version.rb

Constant Summary collapse

VERSION =
"0.3.3"

Instance Method Summary collapse

Instance Method Details

#exec(command, args) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/bundle_grep.rb', line 9

def exec(command, args)
  # TODO: could just shell out to `bundle list --paths` instead?
  paths = with_captured_stdout {
    Bundler::CLI::List.new("paths" => true).run
  }.lines.map(&:strip)
  cmd = "grep --color -r #{args.join(' ')} #{paths.join(' ')}"
  system(cmd)
end