Sha256: 4616269e0d842ee2925e57955fdd89bb63710111896a840fee1dc0b9e6bc6ad8

Contents?: true

Size: 1.32 KB

Versions: 73

Compression:

Stored size: 1.32 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 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='))
			if(!`git status`.include?('nothing to commit') &&
			   !`git status`.include?('untracked files present'))
			  if(message.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 --file commit.message"
			    add "<%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 '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

73 entries across 73 versions & 1 rubygems

Version Path
dev-2.0.268 lib/tasks/commit.rb
dev-2.0.267 lib/tasks/commit.rb
dev-2.0.266 lib/tasks/commit.rb
dev-2.0.265 lib/tasks/commit.rb
dev-2.0.264 lib/tasks/commit.rb
dev-2.0.263 lib/tasks/commit.rb
dev-2.0.262 lib/tasks/commit.rb
dev-2.0.261 lib/tasks/commit.rb
dev-2.0.260 lib/tasks/commit.rb
dev-2.0.259 lib/tasks/commit.rb
dev-2.0.258 lib/tasks/commit.rb
dev-2.0.257 lib/tasks/commit.rb
dev-2.0.256 lib/tasks/commit.rb
dev-2.0.255 lib/tasks/commit.rb
dev-2.0.254 lib/tasks/commit.rb
dev-2.0.253 lib/tasks/commit.rb
dev-2.0.252 lib/tasks/commit.rb
dev-2.0.251 lib/tasks/commit.rb
dev-2.0.250 lib/tasks/commit.rb
dev-2.0.249 lib/tasks/commit.rb