Sha256: ab744359272f7ef681136571ef5b4ddd1a687bdaa9e5cecb5bd3fcf4119f2916
Contents?: true
Size: 980 Bytes
Versions: 10
Compression:
Stored size: 980 Bytes
Contents
require 'uri' require 'thread' module ASF class SVN @base = URI.parse('https://svn.apache.org/repos/') @mock = 'file:///var/tools/svnrep/' @semaphore = Mutex.new def self.repos @semaphore.synchronize do svn = ASF::Config.get(:svn).map {|dir| dir.untaint} @repos ||= Hash[Dir[*svn].map { |name| Dir.chdir name.untaint do [`svn info`[/URL: (.*)/,1].sub(/^http:/,'https:'), Dir.pwd.untaint] end }] end end def self.[](name) result = repos[(@mock+name.sub('private/','')).to_s.sub(/\/*$/, '')] || repos[(@base+name).to_s.sub(/\/*$/, '')] # lose trailing slash return result if result # recursively try parent directory if name.include? '/' base = File.basename(name) result = self[File.dirname(name)] if result and File.exist?(File.join(result, base)) File.join(result, base) end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems