Written by Simon Bailey
I have been working on some further ANT scripts recently on my Ant-Funk repository that tests out integrating Github logic. Thanks to an old friend Mark Lowe who helped put together an nice git-task ANT script I have managed to run the core common Github related tasks i.e. initialise a directory, add, checkout, commit, push, remote add and check current revision in a local repository.
I have written some test scripts that all work fine, running the ANTUnit build file works a treat, however, it’s kinda cheating as I am yet to fully add assertions to some of the tests. Due to lack of time I basically just wanted to get some simple scripts to test each bit of functionality individually to ensure it all works. I have been struggling to come to a definitive decision on how to pass/fail some of the tests due to committing to remote repositories etc, if anyone has some suggestions I would be appreciative, I am not sure if revision checking (on a push) is the best logic?
It’s been a tricky one getting some further understanding of how Github works and why some of my tests just would not work. For example, I was initialising a directory then clone/pulling into it which would fail, doh! This was because when you clone/pull the project folder is created and initialised, obvious really….
I will post up an actual example of how to use them in a project as I am yet to do this myself. I hope they are helpful for someone out there.
P.S. Props again to Mark Lowe for your help on this and also the blog post he got some source code from (and I used the revision comment by Timo).