문제

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?

도움이 되었습니까?

해결책

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 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top