class PrePush::SlnFinder

Public Class Methods

find() click to toggle source
# File lib/sln_finder.rb, line 3
def self.find
        try_find_sln('.')
end

Private Class Methods

try_find_sln(location) click to toggle source
# File lib/sln_finder.rb, line 8
def self.try_find_sln location
        sln = Dir.entries(location).find {|f| File.file?("#{location}/#{f}") && f.end_with?('.sln')}
        return "#{location}/#{sln}" if sln != nil

        dirs = Dir.entries(location).select {|e| !File.file?("#{location}/#{e}") && File.directory?("#{location}/#{e}") && !(/^\.{1,2}$/ =~ e)}
        dirs.each do |dir|
                sln = try_find_sln("#{location}/#{dir}")
                return sln if sln != nil
        end
        sln
end