开发者

automatic updating an application with git

is there any way to use git as an automatic updating mechanism for applications. something like what google chrome does (or Github for Mac).

I want to create a central git repo that contains the whole app (including binaries) and be able to make the applic开发者_如何学JAVAation pull in changes from the repo in the background. The new version should be installed on the next start.

Thanks


I made a java program that uses Git as an autoupdater. What the program does is that it checks the raw text of a CurrentVersion.txt. If the number is greater than the program version, it downloads an updater from the git repo. The updater then acts as a medium between the versions and deleting the old version and replacing it with the newly downloaded one. It was pretty simple.


Aren't you giving the answer to your own question? Git pull on startup of your application. After a git pull you could run some scripts to execute update-specific actions.

If you've got a webapplication I wouldn't do this on each request to your application, but in a cron job that runs every N minutes.


It could look like a good idea, since git is quite efficient at storing files delta, but after it's not: you'd have to embed git with your application. Not sure it is desireable.

Better look at courgette, the Chrome's auto-update mechanism (only for Windows AFIK), and the most voted answers to auto-update tag


If you're on Windows machine, you can use my graphic solution

Or create a DOS batch file the way I did it Here is my solution:

    rem first install GIT Bash
rem then add C:\Program Files\Git\bin to the environment variable PATH and reboot you PC
set VisualStudioVersion=2012
set VisualStudioName=Visual Studio %VisualStudioVersion%
cd \
cd %userprofile%
cd "Documents"
cd %VisualStudioName%
cd "Projects"
echo Press a key to update all choosen git repositories if you're in the correct directory otherwise press CTRL-C to cancel
pause
cd AddFeatures
git pull origin master
cd ..
cd CodeGeneration
git pull origin master
cd ..


you always can make a workaround like a text file in server, that will store the last version. On your software startup, download this file, verify if version of file is different from version of installed software, and do the download the new version installer and run it.

is quite simple to implement...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜