class Seafoam::Config
Finds and loads configuration.
Public Class Methods
new()
click to toggle source
# File lib/seafoam/config.rb, line 4 def initialize @dot_dir = find_dot_dir end
Public Instance Methods
load_config()
click to toggle source
Load the configuration.
# File lib/seafoam/config.rb, line 9 def load_config config_file = File.expand_path('config', @dot_dir) if File.exist?(config_file) puts "loading config #{config_file}" if $DEBUG load config_file end end
Private Instance Methods
find_dot_dir()
click to toggle source
Walk up the directory chain from the current directory to root, looking for .seafoam.
# File lib/seafoam/config.rb, line 21 def find_dot_dir dir = Dir.getwd loop do dot_dir = File.expand_path('.seafoam', dir) return dot_dir if Dir.exist?(dot_dir) new_dir = File.expand_path('..', dir) break if new_dir == dir dir = new_dir end end