Class: Batali::Origin::Git

Inherits:
Path show all
Includes:
Git
Defined in:
lib/batali/origin/git.rb

Overview

Fetch unit from local path

Instance Method Summary collapse

Methods included from Git

#base_path, #clone_repository, included, #ref_dup

Constructor Details

#initialize(args = {}) ⇒ Git

Returns a new instance of Git.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/batali/origin/git.rb', line 13

def initialize(args={})
  super
  self.identifier = Smash.new(
    :url => url,
    :ref => ref,
    :subdirectory => subdirectory
  ).checksum
  unless(name?)
    self.name = identifier
  end
end

Instance Method Details

#fetch_repoString

Returns path to repository.

Returns:

  • (String)

    path to repository



50
51
52
53
54
55
# File 'lib/batali/origin/git.rb', line 50

def fetch_repo
  memoize(:fetch_repo) do
    clone_repository
    ref_dup
  end
end

#load_metadataSmash

Returns metadata information.

Returns:

  • (Smash)

    metadata information



40
41
42
43
44
45
46
47
# File 'lib/batali/origin/git.rb', line 40

def 
  fetch_repo
  original_path = path.dup
  self.path = File.join(*[path, subdirectory].compact)
  result = super
  self.path = original_path
  result
end

#unitsArray<Unit>

Returns:



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/batali/origin/git.rb', line 26

def units
  memoize(:g_units) do
    items = super
    items.first.source = Source::Git.new(
      :url => url,
      :ref => ref,
      :subdirectory => subdirectory,
      :cache_path => cache_path
    )
    items
  end
end