Class: Sherpa::Git::Repo

Inherits:
Object
  • Object
show all
Defined in:
lib/sherpa/git/repo.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:) ⇒ Repo

Returns a new instance of Repo.



6
7
8
# File 'lib/sherpa/git/repo.rb', line 6

def initialize(path:)
  @path = path
end

Class Method Details

.findObject



10
11
12
13
14
15
16
# File 'lib/sherpa/git/repo.rb', line 10

def self.find
  stdout, stderr, status = Open3.capture3("git rev-parse --show-toplevel")

  if status.success?
    new(path: stdout.chomp)
  end
end

Instance Method Details

#nameObject



18
19
20
# File 'lib/sherpa/git/repo.rb', line 18

def name
  path.split("/").slice(0..-1).last
end