What happens if you’re a prolific developer and decide to release all of the source code from your work? Well, you should get a huge pat on the back from all interested parties. And so we say thank you to [Hunter Davis] for releasing the source code for his 70+ Android apps. But just making the decision isn’t the end of things, you’ve got actually get the code out there. And herein lies the hack. Instead of archiving and posting all of those projects he wrote a script to crawl, init, and push his projects to Github automatically.
This process is made pretty easy because of the Github API. Looks like he used version 2 for his script but you’ll want to check out version 3 if you’re looking to write your own script. His script takes the API key and username as command line arguments, then traverses his local source tree. Along the way it uses some text manipulation to sanitize the directories for use as the name of the repository. Once that’s established it steps into the directory, creates a repository, adds and commits all the files, then pushes them to Github.
Following [Hunter's] example makes it really easy to share your code. We hope more will follow suit, putting their work out there for others to learn from and build upon.