This is a great idea. Might be worth looking at the approach iTerm takes. 


On Nov 28, 2021, at 4:05, Jacob Carlborg via TextMate <textmate@lists.macromates.com> wrote:

Yes, it’s a bit complicated.

I think TextMate should bundle its own copy of Ruby 2 as it does with Ruby 1.8.7, especially since Ruby won’t be shipped on macOS forever. This can be used by all bundle commands implemented in Ruby. As for those using the actual Ruby bundle, I would expect those to be familiar with how to install Ruby and they would care which version they’re using, at least for executing their Ruby code. But they should not need to care about  how the bundle commands are implemented. If they’re implemented in Ruby that’s just an implementation detail.

On 27 Nov 2021, at 17:01, Greg via TextMate <textmate@lists.macromates.com> wrote:

Thank you for the detailed explanation. No wonder I keep getting confused by this.

What about `whereis` pointing to `ruby/usr/bin/ruby`? One (at least I) can’t look at the file and see what version it is either. Both of these files are too small, so presumably pointers.

The confusion won’t end of course since we have different OSs and different methods of managing Rubies. If people like Matt are tripped up by this I don’t feel so bad.

I found 17 files named “ruby’ and one name “Ruby” (/System/Library/Frameworks/Ruby.framework/Versions/2.6/Ruby) on my eight year old MBP. I’ve very much an amateur.

On Nov 27, 2021, at 2:09 AM, Jacob Carlborg via TextMate <textmate@lists.macromates.com> wrote:

On 27 Nov 2021, at 01:00, Matt Neuburg via TextMate <textmate@lists.macromates.com> wrote:

You cannot mean that I should be installing any gems using the system Ruby. It is off limits, and has been since Catalina. You are _supposed_ to install your own Ruby, and I have done so.

I didn’t say that. I said you should use the version of Ruby that TextMate invokes when invoking that command. It can be system Ruby and it can be something else.

And TextMate _is_ using it. When I run a TextMate ruby script consisting of `puts RUBY_VERSION`, I get `2.6.3`. When I say in the Terminal `ruby --version`, I get

   ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin20]

Moreover, when I run a TextMate ruby script consisting of

   require 'redcarpet'
   markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, extensions = {})
   puts markdown.render("This is *bongos*, indeed.")

I get the expected

   <p>This is <em>bongos</em>, indeed.</p>

So I don't think you can deny that TextMate Ruby sees redcarpet. The question is why the GitHub Markdown bundle does not see it.

Running a Ruby script and running a bundle command is not the same thing. When running a Ruby script from within TextMate  you’re invoking the “Run” bundle command in the Ruby bundle. This will invoke Ruby 1.8.7 [1], which will invoke the ruby_script.rb [2] script inside the Ruby bundle. This script will later use the TM_RUBY environment variable, if it’s set, or otherwise fall back to what’s in the PATH environment variable to find the appropriate Ruby to execute your script with.

I can just go on using Typora for Markdown, but it would be nice to use TextMate. But I need GitHub-flavored Markdown for this project.

m.

PS It is clear that the GitHub Markdown bundle is working in the sense that if I use code fences with a language, it is correctly formatted in the `.md` file. The problem is that I can't _render_ the Markdown.

When it comes to the Markdown preview command, you can see here [4] that it’s invoking Ruby 1.8.7. As for the redcarpet part, that comes from GitHub-Markdown bundle, which is invoking system Ruby here [5]. If you change [5] to the path of your Ruby 2.6.3p62 it should work.






-- 
/Jacob Carlborg

_______________________________________________
TextMate mailing list -- textmate@lists.macromates.com
To unsubscribe send an email to textmate-leave@lists.macromates.com

_______________________________________________
TextMate mailing list -- textmate@lists.macromates.com
To unsubscribe send an email to textmate-leave@lists.macromates.com

-- 
/Jacob Carlborg

_______________________________________________
TextMate mailing list -- textmate@lists.macromates.com
To unsubscribe send an email to textmate-leave@lists.macromates.com