Hey all,
if i do, in a ruby file :
#!/usr/bin/env ruby
require 'plist'
plist=Plist.parse_xml(my_info_plist)
within TextMate i get :
NameError: uninitialized constant Plist
altought this script is running well from terminal doing a :
ruby essai.rb
the ruby used is the same (/opt/local/bin/ruby)
i did setup within textmate some enverironnement variables :
TM_RUBY => /opt/local/bin/ruby RUBYOPT => -rrubygems GEM_HOME => /opt/local/lib/ruby/gems/1.8
they all correspond to what i get in the Terminal ie :
which ruby
/opt/local/bin/ruby
echo $RUBYOPT
-rrubygems
echo $GEM_HOME
/opt/local/lib/ruby/gems/1.8
the, i don't understand where the prob comes from...
On 14/7/2006, at 12:06, Yvon Thoraval wrote:
require 'plist' plist=Plist.parse_xml(my_info_plist) within TextMate i get : NameError: uninitialized constant Plist
Since your require succeeds, I think it is a clash with TM’s own plist ruby extension (which isn’t the same as the gem.)
Could you try require another ruby gem and use that instead to see if that works?
Le 14 juil. 06 à 12:22, Allan Odgaard a écrit :
Could you try require another ruby gem and use that instead to see if that works?
if tried require 'iphoto2' which depends on the same plist, no more success.
however doing a test with htmltools gives about the same reult from Terminal than TextMate :
the script :
#!/usr/bin/env ruby
require 'htmltools' # <== Line 3
result from TextMate :
LoadError: no such file to load -- htmltools method gem_original_require in custom_require.rb at line 27 method require in custom_require.rb at line 27 at top level in essai_htmltools.rb at line 3
result from Terminal :
ruby essai_htmltools.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- htmltools (LoadError) from /opt/local/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:27:in `require' from essai_htmltools.rb:3
my gems rep :
ls -al $GEM_HOME/gems/
total 0 drwxr-xr-x 15 root admin 510 Jul 14 11:05 . drwxr-xr-x 7 root admin 238 Mar 8 08:48 .. drwxr-xr-x 9 root admin 306 Mar 23 06:46 builder-2.0.0 drwxr-xr-x 6 root admin 204 Mar 17 08:41 coderay-0.5.0.121 drwxr-xr-x 7 root admin 238 Mar 23 20:47 htmltools-1.09 drwxr-xr-x 4 root admin 136 Jul 14 11:05 iphoto2-1.0.1 drwxr-xr-x 9 root admin 306 Mar 8 08:51 libxml-ruby-0.3.6 drwxr-xr-x 4 root admin 136 Mar 9 13:24 plist-1.0.0 drwxr-xr-x 4 root admin 136 Jul 14 11:04 plist-2.0.0 drwxr-xr-x 12 root admin 408 Mar 8 16:03 rake-0.7.0 drwxr-xr-x 5 root admin 170 Mar 23 20:51 rubyful_soup-1.0.4 drwxr-xr-x 20 root admin 680 Mar 8 09:08 rubygems-update-0.8.11 drwxr-xr-x 20 root admin 680 Jul 14 08:32 rubygems-update-0.9.0 drwxr-xr-x 3 root admin 102 Mar 7 21:48 sources-0.0.1 drwxr-xr-x 10 root admin 340 Mar 8 08:49 tidy-1.1.2
???
quite confusing ;-)
On 14/7/2006, at 12:56, Yvon Thoraval wrote:
Could you try require another ruby gem and use that instead to see if that works?
if tried require 'iphoto2' which depends on the same plist, no more success.
Well, I wanted you to try something which didn’t use (directly or indirectly) the plist ruby gem. And of course something which actually worked (at least from Terminal.)
But try put the following line before the require 'plist' in your script:
$:.reject! { |path| path =~ %r{TextMate.*/Support/lib$} }
That should solve the plist clash. It’s not ideal, but will have to do until I find a better solution.
Le 14 juil. 06 à 13:04, Allan Odgaard a écrit :
Well, I wanted you to try something which didn’t use (directly or indirectly) the plist ruby gem. And of course something which actually worked (at least from Terminal.)
sorry i don't have very much gems...
But try put the following line before the require 'plist' in your script:
$:.reject! { |path| path =~ %r{TextMate.*/Support/lib$} }
That should solve the plist clash. It’s not ideal, but will have to do until I find a better solution.
it works fine from TextMate...
thanks a lot !!!
Le 14 juil. 06 à 13:04, Allan Odgaard a écrit :
But try put the following line before the require 'plist' in your script:
$:.reject! { |path| path =~ %r{TextMate.*/Support/lib$} }
That should solve the plist clash. It’s not ideal, but will have to do until I find a better solution.
Someone (Clayton Smith over comp.lang.ruby) gave me a more rubyish solution :
require 'rubygems' require_gem 'plist'
and it works fine even within TextMate...