Class: LearnLab::VCS
- Inherits:
-
Object
- Object
- LearnLab::VCS
- Defined in:
- lib/learn_lab/vcs.rb
Overview
Adapter for the Version Control System.
Instance Method Summary collapse
-
#initialize(directory, &block) ⇒ VCS
constructor
A new instance of VCS.
- #remote_url ⇒ Object
- #working_directory ⇒ Object
Constructor Details
permalink #initialize(directory, &block) ⇒ VCS
Returns a new instance of VCS.
7 8 9 10 11 12 13 14 |
# File 'lib/learn_lab/vcs.rb', line 7 def initialize(directory, &block) @repo = Git.open(directory) rescue StandardError => e msg = "You don't appear to be in a Learn lesson's directory. Please " \ 'cd to an appropriate directory and try again.' block_given? ? block.call(msg, e) : raise(LearnLab::Error.new(msg)) end |
Instance Method Details
permalink #remote_url ⇒ Object
[View source]
16 17 18 |
# File 'lib/learn_lab/vcs.rb', line 16 def remote_url @repo.remote.url end |
permalink #working_directory ⇒ Object
[View source]
20 21 22 |
# File 'lib/learn_lab/vcs.rb', line 20 def working_directory @repo.dir.path end |