Sha256: 5b2699e3b34819bcd6d39444c412fcdb6370169ac9177cf52d4051ddc929262f

Contents?: true

Size: 1.69 KB

Versions: 29

Compression:

Stored size: 1.69 KB

Contents

puts __FILE__ if defined?(DEBUG)

desc 'adds source files to git or subversion'
task :add do Tasks.execute_task :add;end

class Add < Array
	def update
		if(File.exists?('.git') && File.exists?('.gitignore'))
			add_quiet 'git add --all' 
		else
			if(defined?(SOURCE))
				if(File.exists?('.svn'))
					#---
					list_output = %x[svn list -R]
	        status_output = %x[svn status]
	        status_output = status_output.gsub(/\\/,"/")
					#---
					SOURCE.each{|f|
						if(File.exists?(f) && File.file?(f) && !list_output.include?(f))
							if(m = status_output.match(/^(?<action>.)\s+(?<file>#{f})$/i))
			          if(m[:file] == f && m[:action] == '?')
									add_quiet "svn add \"#{f}\" --parents"
			          end
		          end
            end
						#	if(f.include?(' '))
	          #    status=Command.output("svn status \"#{f}\"") 
	          #    error=Command.error("svn status \"#{f}\"")
	          #  else
	          #    status=Command.output("svn status #{f}") 
	          #    error=Command.error("svn status #{f}")
	          #  end
	          #  if(status.include?('?') || status.include?('was not found') || error.include?('was not found'))
	          #    if(f.include?(' '))
						#		  add_quiet "svn add \"#{f}\" --parents"
						#	  else
						#		  add_quiet "svn add #{f} --parents"
						#	  end
						#	end
						#end
					}
				end
				if(File.exists?('.git'))
					SOURCE.each{|f|
						if(File.exists?(f) && File.file?(f))
						  status=Command.output("git status #{f} --short")
						  if status.include?('??') || status.include?(' M ')
							  add_quiet "git add #{f} -v" 
						  end
					  end
					}
				end
			end
		end
	end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
dev-2.1.58 lib/tasks/add.rb
dev-2.1.57 lib/tasks/add.rb
dev-2.1.56 lib/tasks/add.rb
dev-2.1.55 lib/tasks/add.rb
dev-2.1.54 lib/tasks/add.rb
dev-2.1.53 lib/tasks/add.rb
dev-2.1.52 lib/tasks/add.rb
dev-2.1.51 lib/tasks/add.rb
dev-2.1.50 lib/tasks/add.rb
dev-2.1.49 lib/tasks/add.rb
dev-2.1.48 lib/tasks/add.rb
dev-2.1.47 lib/tasks/add.rb
dev-2.1.46 lib/tasks/add.rb
dev-2.1.45 lib/tasks/add.rb
dev-2.1.44 lib/tasks/add.rb
dev-2.1.43 lib/tasks/add.rb
dev-2.1.42 lib/tasks/add.rb
dev-2.1.41 lib/tasks/add.rb
dev-2.1.40 lib/tasks/add.rb
dev-2.1.39 lib/tasks/add.rb