Sha256: a6e996d62bc96fa7b143d2e5a6a6aa59a57e5aa9ad7f5bf1ae46d60c942d0756
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
require 'uri' require 'thread' require 'open3' module ASF class SVN @base = URI.parse('https://svn.apache.org/repos/') @mock = 'file:///var/tools/svnrep/' @semaphore = Mutex.new @testdata = {} def self.repos @semaphore.synchronize do svn = Array(ASF::Config.get(:svn)).map {|dir| dir.untaint} @repos ||= Hash[Dir[*svn].map { |name| next unless Dir.exist? name.untaint Dir.chdir name.untaint do out, err, status = Open3.capture3('svn', 'info') if status.success? [out[/URL: (.*)/,1].sub(/^http:/,'https:'), Dir.pwd.untaint] end end }.compact] end end def self.[]=(name, path) @testdata[name] = File.expand_path(path).untaint end def self.[](name) return @testdata[name] if @testdata[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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
whimsy-asf-0.0.76 | lib/whimsy/asf/svn.rb |
whimsy-asf-0.0.75 | lib/whimsy/asf/svn.rb |