Sha256: 6693ca891b87b97a34b5249a98580514663743b310439e3ea417dd3dddd84e55

Contents?: true

Size: 1.46 KB

Versions: 68

Compression:

Stored size: 1.46 KB

Contents

puts __FILE__ if defined?(DEBUG)

desc 'commits source files to git or subversion'
if(File.exists?('git'))
  task :commit=>[:add] do Tasks.execute_task :commit; end
else
  task :commit=>[:add] do Tasks.execute_task :commit;end
end

class Commit < Array
	def update
		message=""
		message=IO.read('commit.message').strip if File.exists?('commit.message')

		if(File.exists?('.git') && `git config --list`.include?('user.name=') && Git.user_email.length > 0)
			if(!`git status`.include?('nothing to commit') &&
			   !`git status`.include?('untracked files present') &&
			   !`git status`.include?('no changes add to commit'))
			  if(message.length==0)
				if(defined?(REQUIRE_COMMIT_MESSAGE))
					Commit.reset_commit_message
					raise "commit.message required to perform commit"
				else
			  		add_passive "git commit -m'all'"
			  	end
			  else
			    add_quiet "git commit -a -v --file commit.message"
			    add_quiet "<%Commit.reset_commit_message%>"
			  end
		    end 		
		end
		if(File.exists?('.svn'))
			if(message.length==0)
				if(defined?(REQUIRE_COMMIT_MESSAGE))
					Commit.reset_commit_message
					raise "commit.message required to perform commit"
				else
					add_quiet 'svn commit -m"commit all"'
				end
			else
				add_quiet 'svn commit --file commit.message'
				add_quiet "<%Commit.reset_commit_message%>"
			end
		end
	end

	def self.reset_commit_message
		File.open('commit.message','w'){|f|f.write('')}
	end
end

Version data entries

68 entries across 68 versions & 1 rubygems

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