Class: Spaarti::Repo

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

Overview

Repo object, handles individual repo syncing and state

Instance Method Summary collapse

Constructor Details

#initialize(data, client, params = {}) ⇒ Repo

Returns a new instance of Repo.



7
8
9
10
11
12
# File 'lib/spaarti/repo.rb', line 7

def initialize(data, client, params = {})
  @data = data
  @client = client
  @options = params
  @path = resolve_path(@options[:formats], @data) % @data
end

Instance Method Details

#parent_of(repo) ⇒ Object



23
24
25
# File 'lib/spaarti/repo.rb', line 23

def parent_of(repo)
  repo.relative_path_from(Pathname.new(@path)).each_filename.first != '..'
end

#sync!Object



14
15
16
17
18
19
20
21
# File 'lib/spaarti/repo.rb', line 14

def sync!
  clone
  Dir.chdir(@path) do
    config
    add_upstream
    update_submodules
  end
end