2016-06-13 14 views

答えて

1

、一般的な方法は次のとおりです。

#!/usr/bin/env ruby 

# content of the library 
... 

if $0 == __FILE__ 
    # command to be executed only when the file is called by a command 
end 

あなたはそれに宝石を作りたい場合は、標準的な方法は、ファイルに実行可能なRubyスクリプトを書くことである(みましょう宝石のディレクトリ内/binディレクトリの下)fooを言うと、*.gemspecファイルに次の行を追加します。まだ宝石をいじっていない、

Gem::Specification.new do |s| 
    ... 
    s.executables << "foo" 
    ... 
end 
+0

Thxを。 – Konstantin

関連する問題