I am writing a Gemfile to help with the development of a few gems my team is creating.
我正在编写一个Gemfile来帮助开发我的团队正在创建的一些宝石。
I know that the Gemfile allows the use of the :path argument to reference local directories that contain a .gemspec file:
我知道Gemfile允许使用:path参数来引用包含.gemspec文件的本地目录:
gem "my_gem", :path => "../Ruby_Libs/my_gem"
gem“my_gem”,:path =>“../Ruby_Libs / my_gem”
However, the members of my team are using different OSs (OS X, Win XP, Win 7) when writing their code.
但是,我的团队成员在编写代码时使用不同的操作系统(OS X,Win XP,Win 7)。
So my question is how can I go about using the Gemfile's :path argument to reference local gems in development with a value that is OS agnostic?
所以我的问题是如何使用Gemfile的:path参数来引用开发中的本地gem,其值与操作系统无关?
1 个解决方案
#1
14
Use File.join('..', 'Ruby_Libs', 'my_gem'')
instead of "../Ruby_Libs/my_gem"
.
使用File.join('..','Ruby_Libs','my_gem'')而不是“../Ruby_Libs/my_gem”。
gem "my_gem", :path => File.join('..', 'Ruby_Libs', 'my_gem'')
#1
14
Use File.join('..', 'Ruby_Libs', 'my_gem'')
instead of "../Ruby_Libs/my_gem"
.
使用File.join('..','Ruby_Libs','my_gem'')而不是“../Ruby_Libs/my_gem”。
gem "my_gem", :path => File.join('..', 'Ruby_Libs', 'my_gem'')