Class: Bob::SCM::Abstract
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#directory_for(commit) ⇒ Object
Directory where the code will be checked out for the given
commit
. -
#head ⇒ Object
Return the identifier for the last commit in this branch of the repository.
-
#info(commit) ⇒ Object
Get some information about the specified
commit
. -
#initialize(uri, branch) ⇒ Abstract
constructor
A new instance of Abstract.
-
#with_commit(commit) ⇒ Object
Checkout the code at the specified
commit
and call the passed block.
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
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
4 5 6 |
# File 'lib/bob/scm/abstract.rb', line 4 def branch @branch end |
#uri ⇒ Object (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
#directory_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 directory_for(commit) File.join(Bob.directory, "#{path}-#{commit}") end |
#head ⇒ Object
Return the identifier for the last commit in this branch of the repository.
37 38 39 |
# File 'lib/bob/scm/abstract.rb', line 37 def head raise NotImplementedError end |
#info(commit) ⇒ Object
Get some information about the specified commit
. Returns a hash with:
:author
-
Commit author’s name and email
:message
-
Commit message
:committed_at
-
Commit date (as a
Time
object)
31 32 33 |
# File 'lib/bob/scm/abstract.rb', line 31 def info(commit) raise NotImplementedError end |
#with_commit(commit) ⇒ Object
Checkout the code at the specified commit
and call the passed block.
13 14 15 16 17 |
# File 'lib/bob/scm/abstract.rb', line 13 def with_commit(commit) update_code(commit) checkout(commit) yield end |