Sha256: a8c2e9a143e9c885144c034f434391e8d389e1da7380331d902569f6e01edcdd

Contents?: true

Size: 1.4 KB

Versions: 15

Compression:

Stored size: 1.4 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'))
			  if(message.length==0)
				if(defined?(REQUIRE_COMMIT_MESSAGE))
					Commit.reset_commit_message
					raise "commit.message required to perform commit"
				else
			  		add_quiet "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

15 entries across 15 versions & 1 rubygems

Version Path
dev-2.0.289 lib/tasks/commit.rb
dev-2.0.288 lib/tasks/commit.rb
dev-2.0.287 lib/tasks/commit.rb
dev-2.0.286 lib/tasks/commit.rb
dev-2.0.285 lib/tasks/commit.rb
dev-2.0.284 lib/tasks/commit.rb
dev-2.0.283 lib/tasks/commit.rb
dev-2.0.282 lib/tasks/commit.rb
dev-2.0.281 lib/tasks/commit.rb
dev-2.0.280 lib/tasks/commit.rb
dev-2.0.279 lib/tasks/commit.rb
dev-2.0.278 lib/tasks/commit.rb
dev-2.0.277 lib/tasks/commit.rb
dev-2.0.276 lib/tasks/commit.rb
dev-2.0.275 lib/tasks/commit.rb