Sha256: 1520eaf936f684766b58b4a4a68106136cb6d77fcb055fedfa15f5381350d77f

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

#require_relative('internet.rb')

class Commit < Array
	def update
		if(File.exists?('.git') && `git config --list`.include?('user.name='))
			if(!`git status`.include?('nothing to commit') &&
			   !`git status`.include?('untracked files present'))
			  if(File.exists?('commit.message') && File.read('commit.message').gsub(/\s+/,"").length >0)
			  	add "git commit -a -v -m \"#{File.read('commit.message')}\""
			  else
			    add "git commit -m'all'"
			  end
			  #add "<%FileUtils.rm('commit.message')%>" if File.exists?('commit.message')
			  add "<%File.open('commit.message','w'){|f|f.write('')}%>"
		    end 		
		end
		if(File.exists?('.svn'))
			message=""
			message=IO.read('commit.message').strip if File.exists?('commit.message')
			if(!File.exists?('commit.message') || message.length==0)
				if(defined?(REQUIRE_COMMIT_MESSAGE))
					puts "commit.message required to perform commit"
					Command.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 "<%Command.reset_commit_message%>"
				#add "<%FileUtils.rm('commit.message')%>" if File.exists?('commit.message')
			end
		end
	end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dev-2.0.133 lib/commands/commit.rb