Class: Add

Inherits:
Array show all
Defined in:
lib/commands/add.rb

Instance Method Summary collapse

Methods inherited from Array

#add, #execute, #to_html

Instance Method Details

#updateObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/commands/add.rb', line 2

def update
	if(File.exists?('.git') && File.exists?('.gitignore'))
		add 'git add --all' 
	else
		if(defined?(SOURCE))
			if(File.exists?('.svn'))
				SOURCE.each{|f|

                       status=Command.output("svn status #{f}")
					if( status.include?('?') ||
						status.include?('was not found') ||
						 Command.exit_code("svn status #{f}") != 0 )
						puts "svn add #{f} --parents"
						add "svn add #{f} --parents"
					else
						puts "#{status}"
					end
					#add "svn add #{f} --parents" if Command.output("svn status #{f}").include?('?')
					#add "svn add #{f} --parents" if Command.output("svn status #{f}").include?('was not found')
					#add "svn add #{f} --parents" if Command.exit_code("svn status #{f}") != 0
				}
			end
			if(File.exists?('.git'))
				SOURCE.each{|f|
					add "git add #{f} -v" if `git status #{f}`.include?('untracked')
				}
			end
		end
	end
end