Class: Piston::Git::WorkingCopy
Instance Attribute Summary
Attributes inherited from WorkingCopy
#path
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from WorkingCopy
add_handler, #after_remember, #copy_from, guess, handlers, #import, #info, #initialize, #logger, logger, #pistonized?, #recall, #remember, #temp_dir_name, #to_s, #update, #validate!
Class Method Details
.client ⇒ Object
36
37
38
|
# File 'lib/piston/git/working_copy.rb', line 36
def client
@@client ||= Piston::Git::Client.instance
end
|
.git(*args) ⇒ Object
40
41
42
|
# File 'lib/piston/git/working_copy.rb', line 40
def git(*args)
client.git(*args)
end
|
.understands_dir?(dir) ⇒ Boolean
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/piston/git/working_copy.rb', line 11
def understands_dir?(dir)
path = dir
begin
begin
logger.debug {"git status on #{path}"}
Dir.chdir(path) do
response = git(:status)
return true if response =~ /# On branch /
end
rescue Errno::ENOENT
path = path.parent
retry unless path.to_s == "/"
return false
end
rescue Piston::Git::Client::BadCommand
rescue Piston::Git::Client::CommandError
false
end
false
end
|
Instance Method Details
#create ⇒ Object
49
50
51
|
# File 'lib/piston/git/working_copy.rb', line 49
def create
path.mkpath rescue nil
end
|
#exist? ⇒ Boolean
53
54
55
|
# File 'lib/piston/git/working_copy.rb', line 53
def exist?
path.directory?
end
|
#finalize ⇒ Object
57
58
59
|
# File 'lib/piston/git/working_copy.rb', line 57
def finalize
Dir.chdir(path) { git(:add, ".") }
end
|
#git(*args) ⇒ Object
45
46
47
|
# File 'lib/piston/git/working_copy.rb', line 45
def git(*args)
self.class.git(*args)
end
|