Class: PortVCS::VCS

Inherits:
Object
  • Object
show all
Defined in:
lib/portvcs/portvcs.rb

Overview

A wrapper for *Dumb classes

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sys) ⇒ VCS

sys – a class like CVSDumb



19
20
21
# File 'lib/portvcs/portvcs.rb', line 19

def initialize(sys)
  @sys = VCS.select(sys)
end

Instance Attribute Details

#sysObject

Returns the value of attribute sys.



23
24
25
# File 'lib/portvcs/portvcs.rb', line 23

def sys
  @sys
end

Class Method Details

.select(type) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/portvcs/portvcs.rb', line 9

def self.select(type)
  case type
  when 'cvs'
    return CVSDumb
  else
    fail "unknown VCS '#{type}'"
  end
end

Instance Method Details

#open(p) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/portvcs/portvcs.rb', line 25

def open(p)
  s1 = s2 = @sys.new(p)
  if block_given?
    begin
      s1 = yield(s2)
    rescue
      fail $!
    ensure
      s2.close
    end
  end
  
  return s1
end