Working with Ruby
Occasional blog posts about Ruby updates, tools, editor tweaks, and random snippets. You might also be interested in my newer project that docuements lesser-known features in Ruby: Idiosyncratic Ruby.

Requirements: A Mini RubyGems plugin

The .gemspec file of a gem allows to specify requirements for that gem – but usually you do not get to see them. These five lines patch RubyGems, so that gem displays the requirements of a gem after it has been installed:

 1
2
3
4
5
Gem.post_install do |gem|
  gem.spec.requirements.each{ |req|
    puts "Please note, the #{gem.spec.name} gem requires: #{req}"
  }
end

gem install requirements

Creative Commons License