Keeping tabs on scripts and code
Any seasoned sysadmin will inevitably write a script. Or two. Or 142. The trouble becomes keeping track of all the code. While it is easy to create a folder to contain all your scripts, actually trying to remember which script does what can be challenging unless of course you have created a really nice naming convention. Or, you comment in the first few lines of your code. But, since sysadmins feed on efficiency, opening a script to find out what it does adds one extra step. Further, when these need to be deployed via a tool such as Apple Remote Desktop to clients, you now need to open that script in an editor. There must be a better way!
That is where using applications or services to house your code can come in handy. Some tools allow you to enter in a description of the code and create a structure so you can put everything in order. A category for printer fixes, one for permissions, another to set goofy app permissions for something that still needs OS 9 to run.
There are two apps that I’ve used doing a really good job. One, Schnippselchen Pro is a free application with a really simple structure. A nice ability with this app surrounds an Inspector-ish interface where you can link the authors email address or website where the code was found. Clicking the button “Copy” utilizes the pasteboard services and now this code is ready to be command-v’d into any app you need. Or a IM window to a colleague. Best of all, this app is free.
Another is Code Collector Pro by M Cubed software. This is a pay app, however the UI is great. You can lock code to prevent accidental deletions, and there is a creation / modified date for each snippet of code. You can create tags, descriptions and, extending the group feature, smart groups. Here, leverage your tags or descriptions to create a folder that will auto-populate with any additional code snippets written with those tags.
Ok, your turn: How do you organize and keep track of your code??



May 13, 2010 
















I use a git repository, both personally and at work. I keep my scripts organized by folder structure, but I suppose if you put keywords in your comments you could do Spotlight searches.
Personally at my workplace (like jpb) I use a git repository for all our scripts which are organized in folders and then as helpful as possible names along with a master README for quick consultation. (Where it is and super basic usage sometimes)
I did use folders and spotlight to organize and locate scripts. I also relied on my memory, although thats been failing lately. =) As I started to migrate some scripts from folders to Schnippselchen Pro, I quickly realized that my old method was not efficient. I found a lot of cool scripts I forgot about because they were buried in folders. I think I’ll do better tracking and using scripts with Schnippselchen Pro now! Thanks for the post, very helpful!
Rusty
Some of these apps work great for organizing your own code, but are there any good ways to organize it to share with others? I think of my own organization where I will craft up a few lines of code and I’ll send it to others via IM or email when they need it. I wonder if the wiki / blog services in OS X Server would provide a good way to publish the code and make it searchable? Any ideas on how to make sharing the code more usable? I could see a git repo being useful in that regard.
Now, if we could get a desktop app that synced a git repo, THAT would be really useful!
@Randy: Check out places like http://codesnippets.joyent.com/ or if you use Code Collector Pro: http://codecollector.net/ for examples. There are several snippet sharing websites that may just work. Alternatively GitHub gists could work as well.