我刚刚创建了一个非常简单的 rubygem,它只有一个带有几个参数的文件。
我想在安装时自动将此 ruby 脚本添加到路径中,以便我可以从终端中的任何位置使用它,例如:
myruby "param1" "param2"
最佳答案
看看this documentation from RubyGems .
Adding an executable to a gem is a simple process. You just need to place the file in your gem’s bin directory, and then add it to the list of executables in the gemspec. Let’s add one for the Hola gem. First create the file and make it executable:
This article似乎也相当不错,它涵盖了添加可执行文件的基本细节。
关于ruby - 将 gem 中的 ruby 脚本添加到路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20608920/