Frage

I'm trying to write a textmate 2 command to convert the selected text from HTML to HAML. I'm use RVM so I installed html2haml gem to a textmate specific gemset and set TM_RUBY variable to /Users/mark/.rvm/bin/ruby-1.9.3-p392@Textmate as per https://rvm.io/integration/textmate

here's my attempt:

#!/usr/bin/env bash
[[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"

echo "$TM_SELECTED_TEXT" | html2haml -s

but this gives the error "command not found html2haml" because html2haml is installed in an rvm gemset and textmate is running a bash script so it doesn't know about TM_RUBY. How do I sort this mess out?

War es hilfreich?

Lösung

the solution is to use the TM_RUBY as ruby has -S which does PATH search:

echo "$TM_SELECTED_TEXT" | $TM_RUBY -S html2haml -s 
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top