Class: ASF::SVN
- Inherits:
-
Object
- Object
- ASF::SVN
- Defined in:
- lib/whimsy/asf/svn.rb
Class Method Summary collapse
Class Method Details
.[](name) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/whimsy/asf/svn.rb', line 31 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
27 28 29 |
# File 'lib/whimsy/asf/svn.rb', line 27 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 |
# File 'lib/whimsy/asf/svn.rb', line 13 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 out, err, status = Open3.capture3('svn', 'info') if status.success? [out[/URL: (.*)/,1].sub(/^http:/,'https:'), Dir.pwd.untaint] end end }.compact] end end |