Class: Add

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

Instance Method Summary collapse

Methods inherited from Array

#add, #execute, #to_html

Instance Method Details

#updateObject



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
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/tasks/add.rb', line 7

def update
  if(File.exists?('.git') && File.exists?('.gitignore'))
    add 'git add --all' 
  else
    if(defined?(SOURCE))
      if(File.exists?('.svn'))
        SOURCE.each{|f|
          if(File.exists?(f) && File.file?(f))
                        status=Command.output("svn status #{f}")
                        error=Command.error("svn status #{f}")
                        if(status.include?('?') || status.include?('was not found') || error.include?('was not found'))
              puts "svn add #{f} --parents"
              add "svn add #{f} --parents"
            else
              #puts "#{status}" if status.strip.length > 0

              #puts "        #{f}" if status.strip.length == 0

            end
          end
        }
      end
      if(File.exists?('.git'))
        SOURCE.each{|f|
          if(File.exists?(f) && File.file?(f))
            status=`git status #{f} --short`
            #if status.include?('untracked') || status.include?('modified:')

            if status.include?('??') || status.include?(' M ')
            puts "git add #{f} -v"
            add "git add #{f} -v" 
            else
            #puts status if status.strip.length > 0

            end
            end
        }
      end
    end
  end
end