Sha256: 2e10ae9788d7dc61159464237bffead112c2413825cadb8acbe70aaca2e77a64

Contents?: true

Size: 1.45 KB

Versions: 28

Compression:

Stored size: 1.45 KB

Contents

puts __FILE__ if defined?(DEBUG)

desc 'commits source files to git or subversion'
task :commit do Tasks.execute_task :commit;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='))
			if(!`git status`.include?('nothing to commit') &&
			   !`git status`.include?('untracked files present'))
			  if(message.length==0)#File.exists?('commit.message') && File.read('commit.message').gsub(/\s+/,"").length >0)
				if(defined?(REQUIRE_COMMIT_MESSAGE))
					Commit.reset_commit_message
					raise "commit.message required to perform commit"
				else
			  		add "git commit -m'all'"
			  	end
			  else
			    #add "git commit -a -v -m \"#{File.read('commit.message')}\""
			    add "git commit -a -v --file commit.message"
			    add "<%Commit.reset_commit_message%>"
			  end
			 # add "<%File.open('commit.message','w'){|f|f.write('')}%>"
		    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 'svn commit -m"commit all"'
				end
			else
				add 'svn commit --file commit.message'
				add "<%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

28 entries across 28 versions & 1 rubygems

Version Path
dev-2.0.177 lib/tasks/commit.rb
dev-2.0.176 lib/tasks/commit.rb
dev-2.0.175 lib/tasks/commit.rb
dev-2.0.174 lib/tasks/commit.rb
dev-2.0.173 lib/tasks/commit.rb
dev-2.0.172 lib/tasks/commit.rb
dev-2.0.171 lib/tasks/commit.rb
dev-2.0.170 lib/tasks/commit.rb
dev-2.0.169 lib/tasks/commit.rb
dev-2.0.168 lib/tasks/commit.rb
dev-2.0.167 lib/tasks/commit.rb
dev-2.0.166 lib/tasks/commit.rb
dev-2.0.165 lib/tasks/commit.rb
dev-2.0.164 lib/tasks/commit.rb
dev-2.0.163 lib/tasks/commit.rb
dev-2.0.162 lib/tasks/commit.rb
dev-2.0.161 lib/tasks/commit.rb
dev-2.0.160 lib/tasks/commit.rb
dev-2.0.159 lib/tasks/commit.rb
dev-2.0.158 lib/tasks/commit.rb