module CapistranoDirty::PatternFinder

Constants

DISABLE_STRING_LOOKAHEAD

Adding a line with this string and the name of the pattern above the line on which the pattern matches will ignore it.

Public Class Methods

build_regex(pattern) click to toggle source
# File lib/capistrano_dirty/pattern_finder.rb, line 13
def self.build_regex(pattern)
  Regexp.new([pattern, DISABLE_STRING_LOOKAHEAD].map(&:source).join)
end
disable_string(name) click to toggle source
# File lib/capistrano_dirty/pattern_finder.rb, line 17
def self.disable_string(name)
  [DISABLE_STRING_PREFIX, name].join(' ')
end
match(file, pattern) click to toggle source

If there is a match in the file, return the filename

# File lib/capistrano_dirty/pattern_finder.rb, line 7
def self.match(file, pattern)
  regex = build_regex(pattern)

  file.match(regex)
end