Sha256: f389302a1cf84e102eae892b3368d40aa170a37fe1b8521e387981130fa8751b

Contents?: true

Size: 638 Bytes

Versions: 1

Compression:

Stored size: 638 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
        @repos ||= Hash[Dir['/home/whimsysvn/svn/*'].map { |name| 
          Dir.chdir name.untaint do
            [`svn info`[/URL: (.*)/,1].sub(/^http:/,'https:'), Dir.pwd.untaint]
          end
        }]
      end
    end

    def self.[](name)
      repos[(@mock+name.sub('private/','')).to_s.sub(/\/*$/, '')] ||
        repos[(@base+name).to_s.sub(/\/*$/, '')] # lose trailing slash
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
whimsy-asf-0.0.1 lib/whimsy/asf/svn.rb