Class: HolePicker::ConfigReader

Inherits:
Object
  • Object
show all
Defined in:
lib/holepicker/config_reader.rb

Constant Summary collapse

ROOT_LINE_PATTERN =
%r{\b(?:root|DocumentRoot)\s+(.*)/public\b}

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ ConfigReader

Returns a new instance of ConfigReader.



5
6
7
# File 'lib/holepicker/config_reader.rb', line 5

def initialize(path)
  @contents = File.read(path)
end

Instance Method Details

#find_gemfilesObject



9
10
11
# File 'lib/holepicker/config_reader.rb', line 9

def find_gemfiles
  @contents.scan(ROOT_LINE_PATTERN).map { |result| "#{result.first}/Gemfile.lock" }.select { |f| File.exist?(f) }
end