From: Gordon Thiesfeld Date: 2009-08-07T04:45:51+09:00 Subject: Re: including gems with standalone app On Thu, Aug 6, 2009 at 11:23 AM, Eric Peterson wrote: > hmm.. well, something went wrong.  I already have fastercsv installed, > so I found a different gem to test this. Installation to this defined > directory works fine. > > C:\InWork\myApp>mkdir gem > C:\InWork\myApp>gem install html-table --install-dir gem > Successfully installed strongtyping-2.0.6-x86-mswin32-60 > Successfully installed test-unit-2.0.3 > Successfully installed structured_warnings-0.1.1 > Successfully installed html-table-1.3.3 > 4 gems installed > > > C:\InWork\myApp>cat foo.rb > >  require 'rubygems' >  $LOAD_PATH << File.expand_path( File.dirname( __FILE__ ) + '/gem' ) >  ENV['GEM_HOME'] = 'gem' >  require 'html-table' >  include HTML > >  Table.html_case = "lower" >  Table::Row.end_tags = false >  Table::Row::Data.end_tags = false >  table = Table.new >  tr1 = Table::Row.new >  tr2 = Table::Row.new >  tr3 = Table::Row.new >  tr1.content = "foo", "bar", "baz" >  tr2.content = 1, 2, 3 >  tr3.content = %w/hello world/ >  table.push( tr1, tr2, tr3 ) >  table[0][1].align = "left" >  puts table.html > > > > C:\InWork\myApp>ruby foo.rb > > C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in > `gem_original_require': no such file to load -- html-table (LoadError) >        from > C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in > `require' >        from foo.rb:5 > > > Appears to be ignoring the $LOAD_PATH I set before require this gem. > > Eric Try setting ENV['GEM_HOME'] before requiring rubygems. Also, I don't think you require html-table, I think it's html/table. C:\myapp>gem install html-table -i gem Building native extensions. This could take a while... Successfully installed strongtyping-2.0.6 Successfully installed test-unit-2.0.3 Successfully installed structured_warnings-0.1.1 Successfully installed html-table-1.3.3 4 gems installed C:\myapp>cat foo.rb # $LOAD_PATH << File.expand_path( File.dirname( __FILE__ ) + '/gem' ) ENV['GEM_HOME'] = './gem' require 'rubygems' require 'html/table' include HTML Table.html_case = "lower" Table::Row.end_tags = false Table::Row::Data.end_tags = false table = Table.new tr1 = Table::Row.new tr2 = Table::Row.new tr3 = Table::Row.new tr1.content = "foo", "bar", "baz" tr2.content = 1, 2, 3 tr3.content = %w/hello world/ table.push( tr1, tr2, tr3 ) table[0][1].align = "left" puts table.html C:\myapp>ruby foo.rb
foo bar baz
1 2 3
hello world
C:\myapp>