Class: Monolith::GitLocation
- Inherits:
-
BaseLocation
show all
- Includes:
- Berkshelf::Mixin::Git
- Defined in:
- lib/monolith/locations/git.rb
Instance Method Summary
collapse
#clean, #initialize
Instance Method Details
#install ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/monolith/locations/git.rb', line 8
def install
unless File.directory?(@destination)
Monolith.formatter.install(@cookbook, @destination)
git %|clone "#{cache_path}" "#{@destination}"|
cached_origin_url = origin_url(cache_path)
set_origin_url(@destination, cached_origin_url)
true
else
rel_dest = Monolith.formatter.rel_dir(@destination)
Monolith.formatter.skip(@cookbook, "#{rel_dest} already exists")
nil
end
end
|
#update ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/monolith/locations/git.rb', line 30
def update
if File.directory?(@destination)
Monolith.formatter.update(@cookbook, @destination)
Dir.chdir(@destination) do
git %|pull|
end
true
else
rel_dest = Monolith.formatter.rel_dir(@destination)
Monolith.formatter.skip(@cookbook, "#{rel_dest} doesn't exist")
nil
end
end
|