Class: Locca::ProjectDirLocator

Inherits:
Object
  • Object
show all
Defined in:
lib/locca/projects/project_dir_locator.rb

Instance Method Summary collapse

Instance Method Details

#config_path(project_dir) ⇒ Object



48
49
50
# File 'lib/locca/projects/project_dir_locator.rb', line 48

def config_path(project_dir)
    return File.join(project_dir, '.locca/config')
end

#locate(dir) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/locca/projects/project_dir_locator.rb', line 28

def locate(dir)
    if not File.directory?(dir)
        return nil
    end

    while dir
        if File.directory?(File.join(dir, ".locca"))
            return dir
        end
        
        new_dir = File.expand_path('..', dir)
        if new_dir == dir
            break
        end
        dir = new_dir
    end

    return nil
end