Loading ...
Sorry, an error occurred while loading the content.

ruby.vim does not work with greater than rubygems 1.7

Expand Messages
  • mattn
    Hi list. I updated rubygems, then I got an error while opening *.rb file always. It seems some method become deprecated. Below is a patch that use fallback
    Message 1 of 5 , Jul 21, 2011
    • 0 Attachment
      Hi list.

      I updated rubygems, then I got an error while opening *.rb file always.
      It seems some method become deprecated.

      Below is a patch that use fallback using Gem::Specification.

      Please check and include.

      This patch change expression of &shellxquote == "'" to &shellxquote != '"'.
      shellxquote can set empty value on windows. It have better to use &shellxquote != '"'.

      Thanks.
      - Yasuhiro Matsumoto

      diff -r 1d1065c2e7fa runtime/ftplugin/ruby.vim
      --- a/runtime/ftplugin/ruby.vim Wed Jul 20 18:29:39 2011 +0200
      +++ b/runtime/ftplugin/ruby.vim Thu Jul 21 20:34:19 2011 +0900
      @@ -73,11 +73,11 @@
         if exists("g:ruby_path")
           let s:ruby_path = g:ruby_path
         elseif has("ruby") && has("win32")
      -    ruby VIM::command( 'let s:ruby_path = "%s"' % ($: + begin; require %q{rubygems}; Gem.all_load_paths.sort.uniq; rescue LoadError; []; end).join(%q{,}) )
      +    ruby VIM::command( 'let s:ruby_path = "%s"' % ($: + begin; require %q{rubygems}; Gem.all_load_paths.sort.uniq; rescue NoMethodError; Gem::Specification.map{|s|s.gem_dir}.sort.uniq; rescue LoadError; []; end).join(%q{,}) )
           let s:ruby_path = '.,' . substitute(s:ruby_path, '\%(^\|,\)\.\%(,\|$\)', ',,', '')
         elseif 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:code = "print ($: + begin; require %q{rubygems}; Gem.all_load_paths.sort.uniq; rescue NoMethodError; Gem::Specification.map{|s|s.gem_dir}.sort.uniq; rescue LoadError; []; end).join(%q{,})"
      +    if &shellxquote != '"'
             let s:ruby_path = system('ruby -e "' . s:code . '"')
           else
             let s:ruby_path = system("ruby -e '" . s:code . "'")

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • mattn
      Ah, sorry. Gem.all_load_paths.sort.uniq have better to be fallback. it show warning message. Check following. diff -r 1d1065c2e7fa runtime/ftplugin/ruby.vim
      Message 2 of 5 , Jul 21, 2011
      • 0 Attachment
        Ah, sorry.

        "Gem.all_load_paths.sort.uniq" have better to be fallback. it show warning message.
        Check following.

        diff -r 1d1065c2e7fa runtime/ftplugin/ruby.vim
        --- a/runtime/ftplugin/ruby.vim Wed Jul 20 18:29:39 2011 +0200
        +++ b/runtime/ftplugin/ruby.vim Thu Jul 21 20:43:42 2011 +0900
        @@ -73,11 +73,11 @@
           if exists("g:ruby_path")
             let s:ruby_path = g:ruby_path
           elseif has("ruby") && has("win32")
        -    ruby VIM::command( 'let s:ruby_path = "%s"' % ($: + begin; require %q{rubygems}; Gem.all_load_paths.sort.uniq; rescue LoadError; []; end).join(%q{,}) )
        +    ruby VIM::command( 'let s:ruby_path = "%s"' % ($: + begin; require %q{rubygems}; Gem::Specification.map{|s|s.gem_dir}.sort.uniq; rescue NoMethodError; Gem.all_load_paths.sort.uniq; rescue LoadError; []; end).join(%q{,}) )
             let s:ruby_path = '.,' . substitute(s:ruby_path, '\%(^\|,\)\.\%(,\|$\)', ',,', '')
           elseif 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:code = "print ($: + begin; require %q{rubygems}; Gem::Specification.map{|s|s.gem_dir}.sort.uniq; rescue NoMethodError; Gem.all_load_paths.sort.uniq; rescue LoadError; []; end).join(%q{,})"
        +    if &shellxquote != '"'
               let s:ruby_path = system('ruby -e "' . s:code . '"')
             else
               let s:ruby_path = system("ruby -e '" . s:code . "'")

        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Bram Moolenaar
        ... And a copy to the maintainer. -- ** Hello and Welcome to the Psychiatric Hotline ** If you are obsessive-compulsive, please press 1 repeatedly. If you are
        Message 3 of 5 , Jul 21, 2011
        • 0 Attachment
          Mattn wrote:

          > I updated rubygems, then I got an error while opening *.rb file always.
          > It seems some method become deprecated.
          >
          > Below is a patch that use fallback using Gem::Specification.
          >
          > Please check and include.
          >
          > This patch change expression of &shellxquote == "'" to &shellxquote != '"'.
          > shellxquote can set empty value on windows. It have better to
          > use &shellxquote != '"'.

          And a copy to the maintainer.

          --
          ** Hello and Welcome to the Psychiatric Hotline **
          If you are obsessive-compulsive, please press 1 repeatedly.
          If you are co-dependent, please ask someone to press 2.
          If you have multiple personalities, please press 3, 4, 5 and 6.
          If you are paranoid-delusional, we know who you are and what you want
          - just stay on the line so we can trace the call.
          If you are schizophrenic, listen carefully and a little voice will
          tell you which number to press next.
          If you are manic-depressive, it doesn't matter which number you press
          - no one will answer.
          If you suffer from panic attacks, push every button you can find.
          If you are sane, please hold on - we have the rest of humanity on the
          other line and they desparately want to ask you a few questions.

          /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
          /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
          \\\ an exciting new programming language -- http://www.Zimbu.org ///
          \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • mattn
          Bram, It seems some users hope fixing this issue. -- You received this message from the vim_dev maillist. Do not top-post! Type your reply below the text you
          Message 4 of 5 , Jan 31, 2012
          • 0 Attachment
            Bram, It seems some users hope fixing this issue.

            --
            You received this message from the "vim_dev" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          • mattn
            Sorry, mistaken to reply. It seems that some users hope fixing this issue. This warning appear in ruby 1.9 later. -- You received this message from the
            Message 5 of 5 , Jan 31, 2012
            • 0 Attachment
              Sorry, mistaken to reply.

              It seems that some users hope fixing this issue.
              This warning appear in ruby 1.9 later.

              --
              You received this message from the "vim_dev" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php
            Your message has been successfully submitted and would be delivered to recipients shortly.