Log in
Please log in or register.
Pages: [1]
  Print  
Author Topic: Automated Flixel Update  (Read 1259 times)
SeiferTim
Full Member
***
Posts: 219



View Profile WWW
« on: Thu, Dec 17, 2009 »

Hey guys,

I tried using GIT, and I guess I don't really understand it too well (more of an SVN guy myself), but I was wondering if anyone knew an easy way to write a script that would run on windows to:

1: delete the contents of a specific folder (path\flixel\*.*)
2: download the latest flixel build from gitHub: "http://github.com/AdamAtomic/flixel/zipball/master"
3: extract the zip into the folder above?

I'd like to be able to have 1 button on all the computers that I'm working with flixel that does all this for me so I don't have to worry about it lol... I know nothing about python or java which I think are the languages best suited to pulling that off... I could write something on a linux machine to do it, but I've got 3 different windows computers that need this Tongue

Any help? Thanks!
Logged

Rybar
Full Member
***
Posts: 204



View Profile
« Reply #1 on: Thu, Dec 17, 2009 »

This takes a bit of setup, but the result is a one-click shortcut that will update your flixel repository to the latest version in Windows.

with git installed, you can set up a bash script that will update your flixel repository to the latest version. This works best if you set up a global classpath in your IDE, rather than trying to update a copy inside a project folder.

Assuming you haven't touched git yet, first we need any empty repository.

From the Git Bash prompt, change to the directory you want to create a repository in:

Code:
cd /d/flashdev/

Then create the repository:

Code:
git init

and then create a copy of the flixel repository inside it:

Code:
git clone git://github.com/AdamAtomic/flixel

This will download flixel to d:\flashdev\ (or the directory you choose)

Now we need a bash script to pull changes; copy this to a new txt file, name it updateflixel.sh:
Note: Replace cd /d with the path to your .git repository, (d:\flashdev in my example) NOT to where flixel is.

Code:
clear
echo "Updating Flixel Repository..."
cd /d/flashdev
git pull git://github.com/AdamAtomic/flixel
echo "Press any key to exit.."
read -e DUN

Next, create a new shortcut on the desktop.  Name it "Update Flixel", Then in the shortcut properties, edit the target to read:

Code:
C:\WINDOWS\system32\cmd.exe /c ""C:\Program Files\Git\bin\sh.exe" --login /c/updateflixel.sh"

/c/updateflixel.sh will of course need to be changed to wherever you chose to save your bash script.

Done!  You can double click your "Update Flixel" shortcut at any time to get the latest greatest flixel repo.




« Last Edit: Thu, Dec 17, 2009 by Rybar » Logged
SeiferTim
Full Member
***
Posts: 219



View Profile WWW
« Reply #2 on: Thu, Dec 17, 2009 »

Thanks! I actually spent some time learning and playing around with AutoIt to pull it off lol...

I'm attaching my finished product: FlxGrab.exe

You'll need to have 7-Zip installed to "%PROGRAMFILES%\7-Zip" for this to work.

You can place it anywhere, and the first time you run it, it will ask where your Flixel folder is.
For example, if you want all your Flixel stuff to be in "c:\my stuff\projects\Flixel", just enter that in the box, and it will download the master release from GitHub, extract it, delete the content in your original Flixel folder, and then place the contents of the downloaded zip into the destination folder, and finally, clean up the downloaded and temporary files.

If you ever want to change the destination of your Flixel stuff, just delete (or edit) the .ini file.

Be careful: whatever directory you specify as the destination will be completely purged when the file is downloaded - do not specify a path which contains any files you want to save... All my projects are in their own directories, and point to the same Flixel folder:

\Dev\FlixelProjects\BlastingAgent
\Dev\FlixelProjects\Flixel
\Dev\FlixelProjects\FlxAdventure
\Dev\FlixelProjects\FlxTestA

So when I set my path, I need to make sure it's "\Dev\FlixelProjects\Flixel" and nowhere else, and all my other stuff is safe!

As far as I know, this *should* work on any Windows, but I'm not sure... It for sure works on Vista.
Logged

Rybar
Full Member
***
Posts: 204



View Profile
« Reply #3 on: Thu, Dec 17, 2009 »

That's awesome!   I'll definitely make use of this at work where I probably shouldn't (but could) install git and such.  Thanks! 


Logged
SeiferTim
Full Member
***
Posts: 219



View Profile WWW
« Reply #4 on: Thu, Dec 17, 2009 »

That's awesome!   I'll definitely make use of this at work where I probably shouldn't (but could) install git and such.  Thanks! 

Awesome! Glad I could solve my own problem and help others at the same time lol
I have git installed, I just cannot for the life of me figure out how to tell it to 'grab the latest version'... with svn, you just update and it's done, git keeps telling me that i have changes (I don't) or that I'm not on the right tag or something and I either don't get anything, or don't get everything, so I just gave up messing with that... lol
Logged

bepawuca
Newbie
*
Posts: 5


View Profile
« Reply #5 on: Thu, Dec 17, 2009 »

Great, I've been trying to figure out how to do something like this. Thanks, Tim.
Logged
SeiferTim
Full Member
***
Posts: 219



View Profile WWW
« Reply #6 on: Thu, Dec 17, 2009 »

...does not seem to work properly on Win7... Sad
Logged

Rybar
Full Member
***
Posts: 204



View Profile
« Reply #7 on: Fri, Dec 18, 2009 »

I think if you edit the properties of your EXE and give it administrator privileges ('run as administrator') before you run it, it should work.  I can't fiddle with it till I get home though... still running XP here.

I can confirm however that the longer solution of setting of git and a shortcut does work in windows7.   Grin
Logged
Pages: [1]
  Print  
 
Jump to: