Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在编写一个 Gemfile 来帮助开发我的团队正在创建的一些 gem。
我知道 Gemfile 允许使用 :path 参数来引用包含 .gemspec 文件的本地目录:
gem "my_gem", :path => "../Ruby_Libs/my_gem"
但是,我的团队成员在编写代码时使用不同的操作系统(OS X、Win XP、Win 7)。
所以我的问题是如何使用 Gemfile 的 :path 参数来引用开发中的本地 gem,其值与操作系统无关?
使用File.join('..', 'Ruby_Libs', 'my_gem'')而不是"../Ruby_Libs/my_gem".
File.join('..', 'Ruby_Libs', 'my_gem'')
"../Ruby_Libs/my_gem"
gem "my_gem", :path => File.join('..', 'Ruby_Libs', 'my_gem'')