class LearnLab::VCS

Adapter for the Version Control System.

Public Class Methods

new(directory, &block) click to toggle source
# 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

Public Instance Methods

remote_url() click to toggle source
# File lib/learn_lab/vcs.rb, line 16
def remote_url
  @repo.remote.url
end
working_directory() click to toggle source
# File lib/learn_lab/vcs.rb, line 20
def working_directory
  @repo.dir.path
end