PATCH: include gems load path in 'path'

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

PATCH: include gems load path in 'path'

Doug Kearns

This includes the gems load path in 'path' so that :find and friends
will search there first.

Is my limited understanding of gems correct?

Regards,
Doug


Index: ftplugin/ruby.vim
===================================================================
RCS file: /var/cvs/vim-ruby/vim-ruby/ftplugin/ruby.vim,v
retrieving revision 1.10
diff -u -r1.10 ruby.vim
--- ftplugin/ruby.vim 10 Sep 2005 07:46:45 -0000 1.10
+++ ftplugin/ruby.vim 11 Sep 2005 09:05:33 -0000
@@ -67,9 +67,9 @@
 if !exists("s:rubypath")
   if executable("ruby")
     if &shellxquote == "'"
-      let s:rubypath = system('ruby -e "print $:.join(%q{,})"' )
+      let s:rubypath = system('ruby -e "print (begin; require %q{rubygems}; Gem.all_load_paths; rescue LoadError; []; end + $:).join(%q{,})"')
     else
-      let s:rubypath = system("ruby -e 'print $:.join(%q{,})'" )
+      let s:rubypath = system("ruby -e 'print (begin; require %q{rubygems}; Gem.all_load_paths; rescue LoadError; []; end + $:).join(%q{,})'")
     endif
     let s:rubypath = substitute(s:rubypath,',.$',',,','')
   else
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: include gems load path in 'path'

Nikolai Weibull-5
Doug Kearns wrote:

> Is my limited understanding of gems correct?

My Gems knowledge is even more limited, but that seems to be working,
        nikolai

--
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: include gems load path in 'path'

Doug Kearns
In reply to this post by Doug Kearns
On Sun, Sep 11, 2005 at 07:39:38PM +1000, Doug Kearns wrote:
>
> This includes the gems load path in 'path' so that :find and friends
> will search there first.
>
> Is my limited understanding of gems correct?

This should be an improvement.

Because of the multiple directory approach Gems takes the 'path' may be
__very__ long... ;-) Perhaps this inclusion of the Gems search path
should be configurable?

Regards,
Doug


Index: ftplugin/ruby.vim
===================================================================
RCS file: /var/cvs/vim-ruby/vim-ruby/ftplugin/ruby.vim,v
retrieving revision 1.13
diff -u -r1.13 ruby.vim
--- ftplugin/ruby.vim 27 Sep 2005 05:08:01 -0000 1.13
+++ ftplugin/ruby.vim 27 Sep 2005 14:28:56 -0000
@@ -66,10 +66,11 @@
 
 if !exists("s:rubypath")
   if executable("ruby")
+    let s:code = "print ($: + begin; require %q{rubygems}; Gem.all_load_paths.sort.uniq; rescue LoadError; []; end).join(%q{,})"
     if &shellxquote == "'"
-      let s:rubypath = system('ruby -e "print (begin; require %q{rubygems}; Gem.all_load_paths; rescue LoadError; []; end + $:).join(%q{,})"')
+      let s:rubypath = system('ruby -e "' . s:code . '"')
     else
-      let s:rubypath = system("ruby -e 'print (begin; require %q{rubygems}; Gem.all_load_paths; rescue LoadError; []; end + $:).join(%q{,})'")
+      let s:rubypath = system("ruby -e '" . s:code . "'")
     endif
     let s:rubypath = substitute(s:rubypath, '\%(^\|,\)\.\%(,\|$\)', ',,', '')
   else
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel