TextMate Execute and Update '# => Markers are evaluated using ruby ​​1.8 instead of 1.9

In the TextMate 2 menu, Execute and Update '# => The marker updates the markers in the following code as if I were running ruby ​​1.8, although my TM_RUBY environment variable is set to ~ / .rvm / rubies / ruby-1.9.3 -p286 / bin / ruby:

v = RUBY_VERSION # => "1.8.7" puts "".singleton_class puts v # ~> -:2: undefined method `singleton_class' for "":String (NoMethodError) 

Executing the same code in TextMate 2, on the other hand, returns the expected output of the command:

 #<Class:#<String:0x007fcf418941b8>> 1.9.3 

This is a wonderful feature, and it would be very disappointing if it were limited to Ruby 1.8. I suspect, however, that this may be characteristic of my installation (I really saw that it works with 1.9 code here: http://ruby-kickstart.com/ ). Execute and Update '# => The token action is defined in the Ruby package, where it calls xmpfilter from rcodetools:

 #!/usr/bin/env bash [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh" export RUBYLIB="$TM_BUNDLE_SUPPORT/vendor/rcodetools/lib${RUBYLIB:+:$RUBYLIB}" export TM_RUBY=$(which "${TM_RUBY:-ruby}") "${TM_RUBY}" -r "${TM_SUPPORT_PATH}/lib/ruby1.9/add_1.8_features.rb" -- "$TM_BUNDLE_SUPPORT/vendor/rcodetools/bin/xmpfilter" 

The add_1.8_features.rb file adds several deprecated methods to the String and File classes (for example, grep and remove). Indeed, this allows him to support ruby ​​1.9 (see https://github.com/textmate/ruby.tmbundle/blob/master/Support/vendor/rcodetools/CHANGES ).

At this moment, I'm not even sure where the ruby ​​1.8 came from. Even passing an explicit path to the last ruby ​​instead of "$ {TM_RUBY}" in the last line above does not change the result.

I would be very grateful for any help that would allow me to use this (or equivalent) menu action in TextMate.

+4
source share
1 answer

This is a good recommendation.

http://cl.ly/23Ylhttp://cl.ly/23Yl/rvm_textmate.png

Make sure you are using all new versions.

Out of the box, rvm comes with the ruby ​​binary, usually in ~ / .rvm / bin (or, in a system installation, inside / usr / local / bin), which will follow these steps before ruby

 Load up RVM Look for any RVMRC files and load them Execute as a normal ruby 

This approach allows you to use ruby ​​for each project without additional work. With rvm installed, this is a matter of navigating the full path to rvm-auto-ruby found through:

$ which rvm-auto-ruby

And in the extended textmate settings section, adding or changing the TM_RUBY variable, point to this path, as shown in this screenshot, with an approximate setting.

Source: https://rvm.io/integration/textmate/

FWIW: Josh Cheek Excellent (rubykickstart)

+1
source

Source: https://habr.com/ru/post/1444571/


All Articles