Got my historical figure twittering now

Inspired by Darwin twittering, I got an account for Francisco I. Madero, initial leader of the Mexican Revolution of 1910. Write now I have him twittering random quotes from his book, The Presidential Succession. This is topical since the 100 anniversary of the Mexican Revolution is about to hit the next year. I got to make some changes to the script so that it will hash out certain key terms. Madero is exclusively twittering in Spanish :P

The code is below:

require 'grackle'
 
file = IO.readlines("maderobook.txt")
 
randomLine = rand(file.length) + 1
 
text = file[randomLine]
 
tweets = Array.new
words = text.split
 
while (words.length > 0)
	message = ""
	while (message.length < 100 && words.length > 0)
		message += " " + words.shift
	end
	tweets.push(message)	
end
 
tweets.each{ |m|
client = Grackle::Client.new(:auth=>{:type=>:basic,:username=>'name',:password=>'xxx'})
 
result = client.statuses.update.json! :status=>m
}