|
Very nice way to generate xml, thanks for the article.
I had to adapt your instructions slightly to get builder installed on Debian without gem putting things where it shouldn't. Perhaps these notes will be useful.
0) Obviously you've already installed ruby, irb, ri, rake, using the Debian packages.
1) After downloading RubyGems, configure with:
ruby ./setup.rb config --prefix=/usr/local --sysconfdir=/usr/local/etc --siteruby=/usr/local/lib/site_ruby
Then ruby ./setup.rb install
It's a good idea not to do this as root; set up perms on /usr/local appropriately. Just in case gem tries to violate the FHS!
2) export GEM_HOME=/usr/local/lib/ruby/gems
3) gem install builder
4) export RUBYOPT=rubygems
5) irb --simple-prompt
>> require_gem 'builder'
=> true
>> x = Builder::XmlMarkup.new(:target => $stdout, :indent => 1)
<inspect/>
=> #<IO:0xb7ca3000>
>> exit
irb won't load builder with a simple require, but require_gem works. Not necessary when just running ruby.
6) Fix a couple of missing close quotes in xhtml.rb (lines 14 & 26), and as long as you've got the two exports defined above, works beautifully.
Cheers!
|