如何通過自制軟件部署簡單的紅寶石腳本?如何通過自制軟件發佈紅寶石腳本
這裏就是我試圖
名爲homebrew-foo
# file https://github.com/foo/homebrew-foo/blob/master/foo.rb
class Foo < Formula
desc "A command line tool"
url "https://github.com/foo/foo/archive/master.zip"
version "5.0.1"
def install
bin.install "foo"
lib.install Dir["lib/*"]
end
end
其他存儲庫包含Ruby腳本GitHub庫寫公式。這些文件
./foo
./lib/libfile1.rb
這裏就是劇本確實
#!/usr/bin/env ruby
require './lib/libfile1.rb'
puts "came here"
的問題是require
失敗。
$ brew install foo/foo/foo
$ foo
導致此錯誤
/Users/user1/.rbenv/versions/2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in
require': cannot load such file -- ./lib/libfile1.rb (LoadError) from /Users/user1/.rbenv/versions/2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in
需要」從/ usr/local/bin目錄/ foo的
$ which foo
/usr/local/bin/foo
我懷疑這是因爲.RB文件根本不存在/usr/local/bin/foo/lib/libfile1.rb
任何想法什麼是正確的方法來做到這一點?