Class: DependencyWiring::SCM

Inherits:
Object
  • Object
show all
Includes:
ShellCommand, Wiring
Defined in:
lib/dependency_wiring/scm.rb

Direct Known Subclasses

Git, Mercurial

Instance Attribute Summary collapse

Attributes included from Wiring

#dest, #src

Instance Method Summary collapse

Methods included from Wiring

#to_s, #wire

Constructor Details

#initialize(src, dest, opts = {}) ⇒ SCM

Returns a new instance of SCM.



10
11
12
13
# File 'lib/dependency_wiring/scm.rb', line 10

def initialize(src, dest, opts = {})
  super(src, dest)
  @opts = default_opts().merge(opts)
end

Instance Attribute Details

#optsObject

Returns the value of attribute opts.



9
10
11
# File 'lib/dependency_wiring/scm.rb', line 9

def opts
  @opts
end

Instance Method Details

#default_optsObject

def update end



24
25
26
# File 'lib/dependency_wiring/scm.rb', line 24

def default_opts
  {}
end

#prepare_destObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/dependency_wiring/scm.rb', line 28

def prepare_dest
  if File.exists?(@dest) && File.directory?(@dest)
    unless valid_destination?
      raise("#{@dest} doesn't seems to be a working copy.")
    end
  else
    super()
    begin
      clone
    rescue Exception => e 
      Dir.delete(@dest) if File.exists?(@dest) && File.directory?(@dest)
      raise e
    end      
  end
end