For years I used nothing but Windows. When I started getting into robotics (for fun - let me know if you'd like me to do it professionally ;), I had to dive into the Linux world. After only a couple of weeks with Ubuntu, I was stunned at how far behind our Microsoft-following community is in some respects. Take Linux's "apt-get install" command, for example. Running this simple command, followed by an application name, finds the referenced application on the "Information Super Highway," downloads the binaries and installs it locally. No biggie, right? Well it also looks to see what dependencies the application has, downloads the latest of all of them, and installs them as well before installing the target application. It does all of that with just one command line (and sometimes even successfully! ;).
There are two scenarios that come to mind where something like "apt-get install" is tremendously useful when developing a project. The first, and most akin to the intent of "apt-get install" is when you're managing an open source project (e.g., S#arp Architecture) and want to provide an easy way for developers to get the latest of the project while concurrently grabbing the latest of its dependencies (e.g., Rhino tools, NHibernate, Fluent NHibernate, MVCConrib) in the process. The second scenario is if you have a project which has a large number of dependencies and dread checking for updates to the project dependencies. Which dependencies do you download? Where do you find the source? Which order should you build them in? How do you know, except through a lot of tedious snooping, which secondary dependencies are also involved in rebuilding the project dependencies?
The HornGet project is attempting (and succeeding I might add, even in its pre-beta form) to greatly ease the burden of updating dependencies of complex projects. With Horn installed and configured, it only takes a single command line to get the latest of your favorite OSS project or to rebuild your project's dependencies. Similarly to "apt-get install," you simply tell Horn what you'd like to have built and it does the rest. There's a full listing of all of Horn's supported packages found at http://code.google.com/p/hornget/wiki/SupportedPackages. As you can see, Horn supports a wide variety of projects such as NHibernate, Castle, LinFu, Ninject, AutoMapper, Subsonice, MVCContib, S#arp Architecture, and many others. Something quite unique about Horn is that it even checks for indirect, bi-directional library dependencies. For instance, NHibernate depends on a Castle project while one of the Castle projects depends on NHibernate. Horn is smart enough (through config files) to know which projects to build in which order to resolve such scenarios.
The best way to experience and appreciate Horn is to try it out. The following steps demonstrate using Horn to automatically download and build the latest of NHibernate with updated dependencies:
- Install TortoiseSVN (if you haven't already) to download Horn and to be used during the build process.
- Install msysgit as some of the dependencies will be downloaded from from Git distributed source repositories.
- Make sure that "C:\Program Files\Git\bin" and "C:\Program Files\Git\cmd" are included in your Environment Variable's PATH (and add them if not)
- Install Windows PowerShell (used during the dependency build process - it's included in Win 2008 automatically)
- Open a PowerShell command prompt and run "set-ExecutionPolicy RemoteSigned" to allow Horn to invoke PowerShell commands used during the dependency build process.
- Use SVN command line or TortoiseSVN to get latest of http://hornget.googlecode.com/svn/trunk/ to a folder we'll call HornRoot
- (Here's the only kludgey part, which I'm sure will be cleverly resolved very soon...) Open /HornRoot/src/Horn.Console/Program.cs in Notepad, or whatever, and modify, under GetRootFolderPath(), the line "var ret = new DirectoryInfo(rootFolder);" to be "var ret = new DirectoryInfo(@"C:\...\HornRoot\" + PackageTree.RootPackageTreeName);" and save/close the file - replacing C:\...HornRoot with a real file path. NOTE: Make sure there are NO spaces in the file path that you provide. PowerShell abhors spaces in file paths.
- Open a command prompt, cd to the /HornRoot/src folder and run "hornbuild.bat"...you be triumphantly rewarded with a BUILD SUCCEEDED message...but that's just the Horn project.
- In the same command prompt, cd to /HornRoot/src/build/net-3.5/debug and run "horn"
- You should see the Horn usage guidelines...that's a good sign.
- At this point, Horn is now installed, ready and configured to build any of the supported packages.
- As an example, run "horn -install:nhibernate" (and be patient as it'll take some to run...30 minutes to an hour or more for a project with many dependencies is possible probable)
- After executing this one liner, horn will spit out a whole bunch of "working......" statements as it figures out what NHibernate's dependencies are, downloads the source of the dependencies, builds them, and then downloads and builds NHibernate with all of the updated dependencies.
- Keep waiting...Horn is doing a LOT of tedious work for you right now. Don't be surprised if you see very long strings of "working......" statements at a time, throughout the build process; this is expected as it downloads each project dependency and builds them, accordingly. Go get another cup of coffee or something.
- Assuming the OSS world is in a Zen-like state with each other you'll get a number of BUILD SUCCEEDED messages for each project dependency and then eventually get a BUILD SUCCEEDED message for the target project itself.
- Horn outputs its results (the updated DLLs) into /HornRoot/.horn/result. Don't worry if there are more DLLs that you expected; just grab the updated ones that are applicable to your project and you're good to go.
If you've ever tried to update a bunch of project dependencies, you'll appreciate the enormous time savings in using Horn to pull together the dependencies for you. Doing this manually usually takes me at least a few hours to get latest of all dependencies, build them, and build them with S#arp Architecture. With Horn, it takes a one liner and a coffee break.
How does it do this magic you ask? Good question! Each project that Horn supports has a Boo configuration file; e.g., the S#arp Architecture Horn description is at http://hornget.googlecode.com/svn/trunk/package_tree/frameworks/sharp.architecture/sharp.architecture.boo. The file speaks for itself in describing what dependencies are necessary for the project and where to find the source of S#arp Architecture itself. So when you run "horn -install:sharp.architecture" (which takes a very long while mind you) Horn references the respective project description file and off it goes. It's really quite a remarkable feat that Horn has pulled off.
Horn is still maturing - it's not even beta yet - but it's quite a time saver already. So if you have ideas, would like to get involved, or have a project that you'd like to have added to the roster, be sure to let the Horn team know.
For more Horn:
10-29-2009 8:34 PM