Tutorials

Tutorial: Making a Self Updater (Only Ubuntu Linux)

While I was making my longest program (Empires at War, a game), I made a cool self updater. It says there is an update, and asks if you want to install it. When you say yes, then it deletes the current program file, and then downloads the new one from online. For that I used Dropbox. It has been tested and tried, and using the same concept, I was able to make a plugin for it too. Anyway, here is how I did it (oh, this only works on Linux computers):

First, I used the concept for making terminal commands.

Then, I made the command to be "rm \"FileProgram.rb\" (Make sure you have a backup of the file in case it doesn't download the new one).

Next, you make another command: "wget \"URLToFile\"

That's it! if you have a separate file for updating your program, then add another command:

"rm \"fileupdater.rb\"

That way the user doesn't have to delete the updater. Well, that's it! Oh, if you're really good, you can have it automatically check for updates online every time you run the program.