Class: AnnotateRb::ConfigFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/annotate_rb/config_finder.rb

Constant Summary collapse

DOTFILE =
".annotaterb.yml"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.config_pathObject

Returns the value of attribute config_path.



10
11
12
# File 'lib/annotate_rb/config_finder.rb', line 10

def config_path
  @config_path
end

Class Method Details

.find_project_dotfileObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/annotate_rb/config_finder.rb', line 18

def find_project_dotfile
  return @config_path if @config_path && File.exist?(@config_path)

  [
    find_project_root.join(DOTFILE),
    find_project_root.join("config", DOTFILE.delete_prefix(".")),
    find_project_root.join(".config", DOTFILE),
    find_project_root.join(".config", "annotaterb", "config.yml")
  ].find(&:exist?)
end

.find_project_rootObject



12
13
14
15
16
# File 'lib/annotate_rb/config_finder.rb', line 12

def find_project_root
  # We should expect this method to be called from a Rails project root and returning it
  # e.g. "/Users/drwl/personal/annotaterb/dummyapp"
  Pathname.pwd
end