June 20th, 2007

June Phoenix Rails Users Group - Alternative Ruby Web Frameworks

Tonight Jade and I gave a presentation on Alternative Ruby Web Frameworks at the Phoenix Rails Users Group. He kicked us off by showing how easy it was to build an application in Camping. I then followed up by showing off my new favorite framework, Merb. Both frameworks were a hit, and led us into a great conversation afterwards about when you might want to consider using an alternative to Rails.

While I don’t have any slides to upload, I do have a few resources which I found useful. The first of which is Ezra’s slides on writing custom Mongrel Handlers. I had the opportunity to see this presentation at SVRC which is what really turned me on to this framework. He does a great job explaining some of the weaknesses of Rails as well as why the need for Merb exists.

Once you’ve drank the kool-aid you’ll want to check out the development site. Here you’ll be able to keep up with all the latest changes as well as get instructions on how to check-out and build your Merb GEM from source (very important with a framework thats changing as fast as this one). Also, while you’re here be sure to download and check out the Merb sample app, mrblog.

After you’ve installed Merb you’re going to want to walk through Zack Chandler’s excellent tutorial and example app. He does a great job walking you through everything you need to know to hit the ground running.

If you get through all that and still have questions, which you probably will, hop onto #merb on Freenode. The channel is active and the community is quite friendly and willing to help.


Thanks again to everyone who came out to support the local Rails scene. Please join us next month where we’ll be talking about the Joys and Pains of ActiveScaffold!



April 20th, 2007

Heading to SVRC

I’m currently sitting at the airport in-route to San Jose for the Silicon Valley Ruby Conference. I’m quite excited for this conference as they’ve managed to secure a killer group of speakers in an intimate setting.

I’ll do my best to live-blog the event for those who couldn’t make it.



April 13th, 2007

ZenTest 3.5 + RSpec 0.9 = AutoSpec

One thing I find with developers who are new to writing tests/specs is that they will often forget to run the test suite prior to checking in their changes. When you’re developing by yourself this is one thing, but when developing on a large team this can often cause shame and ridicule when you break the build. Ryan Davis has attempted to solve this problem which a great tool called autotest, which is part of the ZenTest suite of tools.

Autotest is a script which runs in the background monitoring your source directory, automatically running your test suite when it notices a file has been modified. This is a huge productivity gain as it allows you to focus on writing code and not have to worry about switching contexts to run your tests/specs.

Prior to the latest version you were required to install an additional plugin if you wanted to use autotest on your Rails project with RSpec (you are writing specs right?). Thankfully version 3.5 of ZenTest now includes a RSpecRailsAutotest runner which will monitor for changes in your Rails source and run the appropriate specs.

Unfortunately this first pass at RSpec support assumes that you have the gem installed, and doesn’t work if you’ve decided to include rspec and rspec_on_rails into your vendor/plugins directory. Thankfully due to the extensible nature of autotest this problem is easily fixed by adding the following to your ~/.autotest file:

1
2
3
4
5
6

Autotest.add_hook :initialize do |autotest|
  if autotest.is_a? RspecRailsAutotest
    autotest.spec_command = 'script/spec --options spec/spec.opts' if File.exist? 'script/spec'
  end  
end

This will force autotest to use the spec command that is installed within the script/ directory of your Rails project as well as have it use the options defined in spec/spec.opts.

Note that this assumes that you are using RSpec version 0.9 which includes the script/spec command. If not you’ll need to modify the spec_command line above to point towards vendor/plugins/rspec/bin/spec.

Happy (Auto)Specing!



April 3rd, 2007

.erb lives a short life

Earlier this year the default Rails template extension switched from .rhtml to .erb and from .rxml to .builder. Yesterday Rick committed another change which modifies the defaults once again.

If you are keeping up with edge you should now be using .html.erb as opposed to .erb, and .xml.builder as opposed to .builder.

I assume this change was made to make a cleaner separation between the templating language being used and the content-type. This allows you to use something like .css.builder for css files rendered using builder, or .xml.erb for xml files using erb.

As always, Edge Rails is subject to change, use at your own risk!



March 29th, 2007

RSpec on Rails Matchers

While at the Mountain West Ruby Conf Matt and I implemented the first pass at the following rails matchers for rspec:

  • should belong_to(association)
  • should have_many(association)
  • should validate_confirmation_of(attribute)
  • should validate_format_of(attribute, valid => [], invalid => [])
  • should validate_length_of(attribute, range)
  • should validate_presence_of(attribute)
  • should validate_uniqueness_of(attribute)

Plugin available here: http://svn.integrumtech.com/public/plugins/rspecon_railsmatchers/

I haven’t had a chance to get the README done, or any rdoc, but there are specs for the majority of the matchers.

Comments / Suggestions Welcome!



March 28th, 2007

Goodbye ";", it's been fun!

The use of “;” to delineate non-crud member & collection actions has been replaced as of Changeset #6485 with the much loved “/” character.

As long as you’re using the default url generators (edituserpath) you shouldn’t have to change anything in your code. The only place this causes issues is if you’ve hard-coded URIs in your APIs or your users have bookmarked pages.



March 25th, 2007

IRB History

Add the following to your ~/.irbrc to get history through multiple IRB sessions:

1
2
3
4
5
6

require 'irb/completion'
require 'irb/ext/save-history'
ARGV.concat [ "--readline", "--prompt-mode", "simple" ]
IRB.conf[:SAVE_HISTORY] = 100
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"

For more IRB Tips and Tricks be sure to check out the Ruby Garden Wiki



March 20th, 2007

Mountain West Ruby Conference - Day 2

Day 2 of the Mountain West Ruby Conference has come and gone. Overall attendance was a bit weak. It seems like half the crowd decided that while it was great to attend a conference on a Friday, they weren’t about to give up their Saturday. To bad for them as this day’s talks were in my opinion much better then the previous. Nothing against the talks on day 1, everyone did a great job, the majority of them were just covering technical areas that I’m not all that interested in.

The day started with a talk from John Lam about his RubyCLR project. John is a brilliant developer who created a project which allows you to bridge between .Net and Ruby thus allowing you to write desktop applications in .Net which use Ruby code for the backend. (Geek translation, he kicks ass!) Due to all the buzz that dynamic languages have been getting, Microsoft saw the value in John’s work and hired him to work on this full time around 6 months ago. Since then he has been pretty quite, and even during his talk wasn’t really able to show off anything new that he’s been working on since starting at Microsoft. He did however hint at some pretty cool things and told us to keep our eyes on what comes out of the MIX conference this summer.

Following John was a very entertaining talk by Michael Hewner on how to interact with USB devices using Ruby. While I was a bit disappointed that we weren’t able to see a live demo, as Michael decided to use a Windows laptop for fear that his linux box wouldn’t work on the projector, Michael was very funny and made what could have been a boring talk on device drivers quite entertaining.

Due to catching a nasty illness Kirk Haines, who was suppose to present on something called IOWA, had to cancel. Fortunetly for us Jamis Buck and Marcel Molina stepped up at the last minute to do a live Rails Way refactoring session. This was probably my favorite talk of the whole conference (topping Chad’s keynote from the day before). I’m a huge fan of Jamis and Marcel and it was great to hear their thoughts on how things should be refactored as they “Strived for Symbolics”.

The final talk of the day was given by the JRuby guys. I have to say that I was a little disappointed at this talk. They spent what seemed like 30-40 minutes showing slides of statistics and talking about the VM, then spent what little time was remaining showing code. Now don’t get me wrong, Tom and Charles are great guys doing amazing things, and as a former Java guy I get that the VM kicks ass. I would have just rather seen more code, and less marketing material.

When the talks were over we headed over to Stoneground to grab a sandwich and a beer (yes you can find beer in SLC, I was surprised too!). Afterwards we headed back to the library and Matt and I spent the rest of the afternoon hacking on our RSpec plugin which I hope to release tomorrow morning. Afterwards we then headed back to the hotel for a bit, then grabbed a few of the remaining attendees and had a great dinner at a microbrewery down the street from the hotel. The rest of the evening was then spent hacking on code in the hotel lobby pub. Not your typical St. Pattys day event, but we had a great time!

Overall this was a great event, and definitely a nice warm-up for RailsConf this May. My excitement about the community has been re-energized and I’m looking forward to putting into practice many of the things I learned. As I mentioned previously, the organizers did a great job making sure everything was taken care of. They, as well as all of the great presenters, have my thanks!



March 20th, 2007

Phoenix Rails Users Group

The Phoenix Rails Users Group will be meeting this evening at 6:00pm at the Molly Brannigans in Mesa, AZ.

Agenda:

  • 6:00 - 7:00 Social Hour
  • 7:00 - 8:00 Introduction to RSpec
  • 8:00 - 9:00 Hacking

Hope you can make it!



March 16th, 2007

Mountain West Ruby Conference - Day 1

Day 1 of the Mountain West Ruby Conference is slowly winding down. Overall I’m happy with how things are turning out. From the coffee/juice in the morning, to the power-strips and ethernet cables (wireless sucks at conferences), the organizers have been on top of things and are making sure everyone is having a great time.

While it was great to cheer on James as he gave his well delivered talk, as well as Jade as he stepped up and gave an impromptu lightening talk, I don’t tend to come to these events for the presentations, but more for the hallway conversations, which have been great. I got to enjoy a great lunch with Tim, as well as many great conversations due to the small, intimate nature of this conference.

As far as the talks go, my favorite so far was they keynote by Chad Fowler. I read Chad’s book, “My Job Went to India”, when it first came out and was very inspired. His talk followed along a similar track and was equally as good. One of his biggest points is that technology comes and goes, and while we may be the pioneers of today we will easily become the dinosaurs of tomorrow unless we’re constantly challenging ourselves and searching for the next new technology.

The talk tonight, like the book, made me take a step back and re-evaluate my career and the direction I’m heading. While I love programming in Rails, I need to be very careful about getting to comfortable and allowing myself to be pigeon holed as “that rails guy”. As the Pragmatic Programmer suggests, you should be learning a new language once a year, but yet I have failed to do so in the most recent years. When I get home I’m going to spend some time evaluating the latest technology, and start committing to learning something new.

Tomorrow looks to be another great day with talks by the JRuby guys, John Lam and many others!

IMG_0640.JPG