class TestLauncher::Search::Ag::Interface
Attributes
shell[R]
Public Class Methods
new(shell)
click to toggle source
# File lib/test_launcher/search/ag.rb, line 10 def initialize(shell) @shell = shell end
Public Instance Methods
grep(regex, file_pattern)
click to toggle source
# File lib/test_launcher/search/ag.rb, line 18 def grep(regex, file_pattern) shell.run("ag '#{regex}' --file-search-regex '#{pattern_to_regex(file_pattern)}'") end
ls_files(pattern)
click to toggle source
# File lib/test_launcher/search/ag.rb, line 14 def ls_files(pattern) shell.run("ag -g '.*#{pattern_to_regex(pattern)}.*'") end
pattern_to_regex(pattern)
click to toggle source
# File lib/test_launcher/search/ag.rb, line 30 def pattern_to_regex(pattern) pattern.gsub("*", ".*") end
root_path()
click to toggle source
# File lib/test_launcher/search/ag.rb, line 22 def root_path shell.run("git rev-parse --show-toplevel").first.tap do if $? != 0 raise NotInRepoError, "test_launcher must be used in a git repository" end end end