Posts

UPDATE 4/20/2010: Well Grounded Rubyist is not prerelease anymore. Corrected. UPDATE 6/30/2011: Fix links to _why’s poignant guide, since he vanished from the earth. Add a bit about finding live people to help you. UPDATE 9/27/2015: Add udemy ruby guides. More updates coming soon, as many books have been updated since I originally posted this. Several people have asked me for tutorials, books, and other resources to help them learn Ruby, so I’ve attempted to compile a list of resources I feel are particularly valuable for beginning Rubyists.

CONTINUE READING

The latest master Sinatra now supports optional block parameters. It captures any parameters in the URL and passes them into the block that defines the action: get'/hello/:name'do|n|"Hello #{n}!"end The params hash is still available as before, so this should not break any existing applications. It will also work with regular expressions. Any captures are yielded in order: get%r{/hello/([\w]+)/([\w]+)}do|a,b|"Hello, #{a}and #{b}!"end Big thanks to rtomayko for accepting my patch, and working with me to get this solid enough to put into Sinatra!

CONTINUE READING

It seems that it’s not well publicized, but if you want to run your RSpec files with autotest try autospec instead. It looks inside the spec/ directory for files named “*_spec.rb” by default for specs. autospec is part of the RSpec gem, and basically just sets up the proper environment and then shells out to autotest. Also, if your files in lib/ match up with specs in spec/, autospec will automatically re-run your specs for changed files in lib/ on save.

CONTINUE READING

I’m getting all packed for CodeMash! Hope too see a lot of you there. I’m a little bit disappointed by the dearth of Ruby sessions, but there are enough of us that the open sessions will be rockin’. And the ever popular scotch track always helps.

CodeMash

CONTINUE READING

Update: Deskin points out that there is a commit to git that fixes this problem by adding a --root option to rebase --onto. So when you get a new build of git, you can probably ignore everything here. The other day I needed to commit a plain old (git-svn free) git repository to subversion. Why, you ask? I had been working on a small project at work in my own little git repository and needed to get it into our official version control.

CONTINUE READING

This is a Capistrano recipe I use to configure my production database.yml. Before deploy:setup executes, this recipe will prompt for a database password and save a new database.yml file to the shared directory on your server. After each deploy, the database.yml file will be symlinked from the shared directory. You can reconfigure your database by executing cap db:configure. Here are the goods. I’m pretty sure I got this from Jeremy Voorhis a while back, and modified it to work with Capistrano 2.

CONTINUE READING

I generally think that new year resolutions are silly, but since it’s the new year and I have some goals I’d like to set, I guess I might as well call them resolutions. Since goals, like technical requirements, are meaningless if you can’t measure them, I’ll be as specific as possible even if it means that I’ll have to adjust them later. So here we go: Resolved: I will blog at least once a week.

CONTINUE READING

Ruby Hoedown 2008 videos are now live. There are a lot of good talks. I highly recommend checking them out. I’ve set up a torrent of all the videos for your convenience.

CONTINUE READING

To make TextMate’s RubyMate work with MacPorts (or any other non-default ruby install) just set TM_RUBY environment variable to be the path to your custom ruby interpreter in TextMate’s preferences. Custom environmental variable settings are located under ‘Advanced’->‘Shell Variables’ in TM’s prefs.

CONTINUE READING

I’ve had a problem with my sake tasks being blank for the past couple days. Since there were a couple comments on err about similar things, I’ll share my fix: gem install -v 2.0.1 ParseTree. That’s it. Turns out my ParseTree install was messed up and to_ruby was not working on the task blocks.

CONTINUE READING