I decided to write a modified version of a MultiMarkdown command, and because I'm better at Ruby than I am at bash, I wrote my version of the command in Ruby. It's working!
However, in order to pass the incoming text thru MultiMarkdown.pl, I open a subprocess. I am not very savvy at subprocesses, so I have a couple of questions:
(1) Is there an elegant way? Right now I'm using IO.popen, which has the virtue that I understand what I'm doing, even though it's wordy.
(2) More important: we do not seem to be picking up the paths automatically, so I have to construct (from ENV) a full path to where MultiMarkdown.pl sits inside the support bundle. Is there a trick for handling this? The original bash version just automagically "sees" MultiMarkdown.pl and SmartyPants.pl; is there some way my Ruby script can automagically see them too?
Thx - m.
On 2. Jul 2007, at 23:37, Matt Neuburg wrote:
[...] (1) Is there an elegant way? Right now I'm using IO.popen, which has the virtue that I understand what I'm doing, even though it's wordy.
How is this wordy? Maybe show the full code because popen() is meant for running a shell command with its input/output connected to the calling process and has little syntactic overhead.
(2) More important: we do not seem to be picking up the paths automatically, so I have to construct (from ENV) a full path to where MultiMarkdown.pl sits inside the support bundle. Is there a trick for handling this? The original bash version just automagically "sees" MultiMarkdown.pl and SmartyPants.pl; is there some way my Ruby script can automagically see them too?
Commands in TM w/o shebang gets the TM_SUPPORT_DIR/lib/bash_init.sh file sourced, which sets up the path. For she-bang scripts, they have to do it themselves. Presently only “trick” is to not use shebang, instead using a here-doc, -e, call a script in the bundle from bash -- but personally I am not too fond of that “trick” (long-term there will be a unified PATH for shebang/non-shebang scripts).
On 7/7/07 1:42 AM, in article 26C81F52-DB42-48C0-840D-3C0F4A8CB666@macromates.com, "Allan Odgaard" throw-away-1@macromates.com wrote:
Commands in TM w/o shebang gets the TM_SUPPORT_DIR/lib/bash_init.sh file sourced, which sets up the path. For she-bang scripts, they have to do it themselves. Presently only ³trick² is to not use shebang, instead using a here-doc, -e, call a script in the bundle from bash -- but personally I am not too fond of that ³trick² (long-term there will be a unified PATH for shebang/non-shebang scripts).
The unified PATH would be great. Thx - m.