XMLBuilder: no such file to load -- builder

I’m trying to use the XML builder package, but the require is not
working.
I have a hunch that I don’t have all the requisite dependencies
installed,
but what, I can’t figure out. Note, I’m a Ruby newbie.

I’ve tried the following on Fedora and CygWin after doing a “gem install
builder” on both systems:

require ‘csv’
require ‘builder’

xml = Builder::XmlMarkup.new( :target => “tmp.xml”, :indent => 2 )
xml.instruct!(:xml, :version => “1.1”, :encoding => “UTF-8”)
xml.declare!(:DOCTYPE, “beans”, :PUBLIC, “-//SPRING//DTD BEAN//EN”,
http://www.springframework.org/dtd/spring-beans.dtd:wink:

xml.beans do
CSV::Reader.parse(File.open(‘tmp.csv’, ‘rb’)) do |row|
xml.loginId( row[1] ) if row[1] != nil
end
end

… and I just get: transform-csv.rb:11:in `require’: no such file to
load
– builder (LoadError)
from transform-csv.rb:11

On 01/08/06, Matthew E. [email protected]
wrote:

xml = Builder::XmlMarkup.new( :target => “tmp.xml”, :indent => 2 )
… and I just get: transform-csv.rb:11:in `require’: no such file to load

Have you tried:
require ‘rubygems’
require_gem ‘builder’

Farrel

Farrel,

OK, then I get
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:204:in report_activate_error': Could not find RubyGem builder (> 0.0.0) (Gem::LoadError) from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:141:inactivate’
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:37:in
require_gem_with_options' from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:31:inrequire_gem’
from transform-csv.rb:12

gr, Mat

On Aug 1, 2006, at 10:46 AM, Matthew E. wrote:

`require_gem’
from transform-csv.rb:12

gr, Mat

Only use require_gem if you need a specific gem version ? and if you
do you still need to ?require “the_gem_lib”?. I think require_gem is
now named activate_gem to help lessen the confusion.

To get it to work:

require “rubygems”
require “builder”

– Daniel

Sorry, I posted too fast. The it works now on Fedora but not on CygWin,
so I’m just somehow missing this “RubyGem builder” thingy on CygWin.

gr, Mat

Daniel,

Yes, your simpler require’s work on Fedora as well, but CygWin still
cannot resolve the dependencies (I get the same error).

gr, Mat

Sorry, to clarify, on CygWin, if I do:

require ‘rubygems’
require ‘csv’
require ‘builder’

… I get …

/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require__': no such file to load -- builder (LoadError) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire’
from transform-csv.rb:9

… but if I do:

require ‘rubygems’
require ‘csv’
require_gem ‘builder’

… I get instead …

/usr/lib/ruby/site_ruby/1.8/rubygems.rb:204:in report_activate_error': Could not find RubyGem builder (> 0.0.0) (Gem::LoadError) from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:141:inactivate’
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:37:in
require_gem_with_options' from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:31:inrequire_gem’
from transform-csv.rb:9

both versions work OK on Linux/Fedora.

gr, Mat

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs