Getting Started With Thor

I’ve known about Thor for some time now, and have been using it in my Rails 3 work. It seemed like a great little tool for writing command line apps in ruby. So, when I had a need to write a small file importer, I decided to give thor a run and see how it worked.

The end result is something I’m very happy with. I really like the polished feel that my thor task has, with command line options, help screen, etc.  Unfortunately, the process of learning thor was painful and generally awful. The documentation makes it sound like thor is a rake-style syntax, but I found that to be very misleading. I tried to use my extensive rake experience to build my thor scripts, based on the examples in their documentation, and I failed miserably.

After struggling through this, I decided to do something about it and spent my lunch time today working on the Thor wiki. I moved all of the documentation out of the readme file and into the wiki, first. Jose Valim was kind enough to accept a pull request on the thor code to change the readme, too, so it now points to the wiki. After that, I dove into what I hope is a useful ‘getting started’ wiki page, to try and help others get up and running with Thor faster than I was able to.

In the getting started page, I explain a few of the conventions that thor uses and show how to build and run some very simple example tasks, including task parameters and options.

So, what are you waiting for? Go read the Getting Started page on the Thor wiki! The great part about this is that it’s a wiki page, so anyone with a Github account can update it and help improve it.


Post Footer automatically generated by Add Post Footer Plugin for wordpress.

About Derick Bailey

Derick Bailey is an entrepreneur, problem solver (and creator? :P ), software developer, screecaster, writer, blogger, speaker and technology leader in central Texas (north of Austin). He runs SignalLeaf.com - the amazingly awesome podcast audio hosting service that everyone should be using, and WatchMeCode.net where he throws down the JavaScript gauntlets to get you up to speed. He has been a professional software developer since the late 90's, and has been writing code since the late 80's. Find me on twitter: @derickbailey, @mutedsolutions, @backbonejsclass Find me on the web: SignalLeaf, WatchMeCode, Kendo UI blog, MarionetteJS, My Github profile, On Google+.
This entry was posted in Documentation, Open Source, Ruby, Thor. Bookmark the permalink. Follow any comments here with the RSS feed for this post.