Class: ASF::SVN
- Inherits:
-
Object
- Object
- ASF::SVN
- Defined in:
- lib/whimsy/asf/svn.rb
Class Method Summary collapse
Class Method Details
.[](name) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/whimsy/asf/svn.rb', line 32 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 |
.[]=(name, path) ⇒ Object
28 29 30 |
# File 'lib/whimsy/asf/svn.rb', line 28 def self.[]=(name, path) @testdata[name] = File.(path).untaint end |
.repos ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/whimsy/asf/svn.rb', line 13 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 |