2012-12-04 34 views
1

我試圖讓ttscoff的TaskPaper Markdown紅寶石腳本https://gist.github.com/511174工作。但是,我使用rvm,這似乎會帶來一些挑戰。要求聲明不能在紅寶石工作從bash

-rjcode是一個不再需要的Unicode標誌,-Ku是我可以忽略的另一個編碼標誌。

我發現了將rvm作爲函數添加到您的腳本的說明,但腳本仍然錯誤,只要它碰到require ftools

我加的是:

#!/usr/bin/env bash 
# TaskPaper to Markdown converter 
# Usage: tp2md.rb filename.taskpaper > output.md 
# Load RVM into a shell session *as a function* 


# Load RVM into a shell session *as a function* 
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then 
    # First try to load from a user install 
    source "$HOME/.rvm/scripts/rvm" 
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then 
    # Then try to load from a root install 
    source "/usr/local/rvm/scripts/rvm" 
else 
    printf "ERROR: An RVM installation was not found.\n" 
fi 

# Configure ruby and gemset 
rvm [email protected] 

ruby <<-rb 
    puts "Hello!" 
rb 

Hello!輸出很好,但我得到以下錯誤算賬:。

require: command not found 
infile: command not found 
prevlevel: command not found 
begin: command not found 
syntax error near unexpected token `(' 
` file = File.new(infile, "r")' 

我的問題似乎與創業板在沒有得到拉我已經卸載ftools並重新安裝了rvm,但仍然沒有骰子。感謝任何幫助!

+2

真正的問題是,在某個地方,ruby腳本被bash解釋(這些都是bash錯誤消息)。 –

回答

0

你告訴紅寶石加載'b'庫。

-r library Causes Ruby to load the library using require. It is useful when using -n or -p.

這應該工作。

ruby -r ftools <<rb 
    puts "Hello!" 
rb 
+1

不,那不是,「-rb」是一個有效的here-document單詞,連字符表示從文檔中刪除前導製表符。 –