Callbacks are executable things, like a Proc or methods in Ruby, whereas a hook is usually a spot in your code where you want to execute a certain subset of callbacks. Or, precisely, callbacks that are associated to the hook. I have lots of these places throughout my libraries, and after playing around with ActiveSupport::Callbacks… Continue reading Hooks and callbacks for Ruby. But simple.
Haml has a feature called “Whitespace Preservation” which usually tries to nicely indent your markup. This is great. However, sometimes it gets in your way – especially when it indents your <pre> paragraphs wrong. I had a setup like %p Here, some code! = render_some_code where #render_some_code would return some markup. def render_some_code “include ‘cells’ninclude… Continue reading Haml breaks pre indentation
Suck me sideways! It is said the generator layer in Rails 3 got really ohsom, flexible and whatever. I can now confirm “That’s true, somehow.” – nevertheless it took me years to figure out all the internals, conventions and places where to find documentation. What I wanted So here’s my requirement. I have a gem… Continue reading Getting a bloody Rails 3 generator running. And testing it.
Packaging and releasing gems is easy. Many people simply use jeweler to handle all the tiresome tasks. Others try to avoid 3rd-party tools and don’t take any “opinionated” shortcuts at all. Not that I would care about opinions, anyway. However, I catched myself using a mixture of all ruby release tools, so here’s my current… Continue reading Releasing Gems self-opinionated
I love jeweler for releasing my gems, however I tend to forget how it is working, so here’s my release workflow. 1. Bump and Commit Bump the version (usually in lib/a_perfect_gem/version.rb) and git commit my latest changes 2. Doublecheck git status to check if my working tree is clean git status # On branch master… Continue reading Releasing with Jeweler