How to change version of Ruby being run in TextWrangler?

Joined
Feb 12, 2013
Messages
3
Reaction score
0
Points
1
Hi there..
I am using textwrangler to write ruby scripts, and it goes just fine, except for:
it uses the 1.8.7 version and not the 1.9.3 that i have installed via rvm.

i have read on the TW manual that i should write a "shebang" line pointing to where the new ruby version is,
I type this :
#!/Users/Bus/.rvm/rubies/ruby-1.9.3-p362/bin/irb:16:in `<main>'1.9.3p362
but TW is still using the old version.

Any ideas??

thanks a lot

p
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
You've got quite the complicated shebang line there. Let's simplify that a bit:
Code:
#!/Users/Bus/.rvm/rubies/ruby-1.9.3-p362/bin/irb
 
OP
S
Joined
Feb 12, 2013
Messages
3
Reaction score
0
Points
1
You've got quite the complicated shebang line there. Let's simplify that a bit:
Code:
#!/Users/Bus/.rvm/rubies/ruby-1.9.3-p362/bin/irb

thank you vansmith!
i have made it as you suggested, but still, when further down on my script i type
"puts RUBY_VERSION"
it returns the 1.8.7 old one.

and in fact, i still can't use a method (.force_encoding) wich is only available in the newer ruby version.

thank you!!!
(and apllogizes if i am not following the right way to answer or communicate... i'm totally new to this type of forums.)

p
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
I'm going to guess that the RUBY_VERSION env variable still returns 1.8.7 because the shebang line doesn't actually change that.

Read p. 227 here.
 
OP
S
Joined
Feb 12, 2013
Messages
3
Reaction score
0
Points
1
I'm going to guess that the RUBY_VERSION env variable still returns 1.8.7 because the shebang line doesn't actually change that.

Read p. 227 here.

thank you so much...
this is pretty amazing, you answering so quickly :)

yes... I had read the TW manual before and it states that one should do it that way (with the shebang line)...

what i don't really understand is why, running the script in terminal it accepts the .force_encoding method and returns the new ruby version,
while running it in TW it doesn't accept the method and returns the old version...
it seems to me that that TW it's not really using the new.

any way, thank you very much for you time and attention.

best!

p
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top