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
-
#info(commit_id) ⇒ Object
Get some information about the specified commit.
-
#initialize(uri, branch) ⇒ Abstract
constructor
A new instance of Abstract.
-
#with_commit(commit_id) ⇒ Object
Checkout the code into
working_dir
at the specified revision and call the passed block. -
#working_dir ⇒ Object
Directory where the code will be checked out.
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
#info(commit_id) ⇒ 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)
32 33 34 |
# File 'lib/bob/scm/abstract.rb', line 32 def info(commit_id) raise NotImplementedError end |
#with_commit(commit_id) ⇒ Object
Checkout the code into working_dir
at the specified revision and call the passed block
13 14 15 16 17 |
# File 'lib/bob/scm/abstract.rb', line 13 def with_commit(commit_id) update_code checkout(commit_id) yield end |
#working_dir ⇒ Object
Directory where the code will be checked out. Make sure the user running Bob is allowed to write to this directory (or you’ll get a Errno::EACCESS
)
21 22 23 24 25 |
# File 'lib/bob/scm/abstract.rb', line 21 def working_dir @working_dir ||= "#{Bob.directory}/#{path_from_uri}".tap do |path| FileUtils.mkdir_p path end end |