Class: Bob::SCM::Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/bob/scm/abstract.rb

Direct Known Subclasses

Git, Svn

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri, branch) ⇒ Abstract

Returns a new instance of Abstract.



6
7
8
9
# File 'lib/bob/scm/abstract.rb', line 6

def initialize(uri, branch)
  @uri    = Addressable::URI.parse(uri)
  @branch = branch
end

Instance Attribute Details

#branchObject (readonly)

Returns the value of attribute branch.



4
5
6
# File 'lib/bob/scm/abstract.rb', line 4

def branch
  @branch
end

#uriObject (readonly)

Returns the value of attribute uri.



4
5
6
# File 'lib/bob/scm/abstract.rb', line 4

def uri
  @uri
end

Instance Method Details

#dir_for(commit) ⇒ Object

Directory where the code will be checked out for the given commit.



21
22
23
# File 'lib/bob/scm/abstract.rb', line 21

def dir_for(commit)
  Bob.directory.join(path, resolve(commit))
end

#with_commit(commit) {|commit| ... } ⇒ Object

Checkout the code at the specified commit and call the passed block.

Yields:

  • (commit)


13
14
15
16
17
# File 'lib/bob/scm/abstract.rb', line 13

def with_commit(commit)
  commit = resolve(commit)
  checkout(commit)
  yield(commit)
end