git clone works
[repobrowse.git] / lib / repobrowse / repo.rb
blobcb08117b3b4d1cdb62c23b937ae04ccbb42e354c
1 # Copyright (C) 2017 all contributors <repobrowse@80x24.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
3 # frozen_string_literal: true
5 # class for represpenting an inbox git repository.
6 class Repobrowse::Repo
7   attr_reader :driver
8   attr_reader :name
9   attr_reader :path
11   def initialize(opts)
12     @tip = @description = @cloneurl = nil
13     opts.each { |k, v| instance_variable_set "@#{k}", v }
14     case @vcs
15     when 'git'
16       @driver = Repobrowse::Git.new(@path)
17     end
18   end
20   def description
21     @description ||= @driver.read_description
22   end
24   def cloneurl
25     @cloneurl ||= @driver.read_cloneurl
26   end
28   def tip
29     @tip ||= @driver.read_tip
30   end
31 end