Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I go about using the Gemfile's :path argument to reference local gems in development with a value that is OS agnostic?

I am writing a Gemfile to help with the development of a few gems my team is creating.

I know that the Gemfile allows the use of the :path argument to reference local directories that contain a .gemspec file:

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.

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?

like image 523
linusthe3rd Avatar asked Feb 03 '12 22:02

linusthe3rd


People also ask

How to use Gemfile in Ruby?

run the command bundle install in your shell, once you have your Gemfile created. This command will look your Gemfile and install the relevant Gems on the indicated versions. The Gemfiles are installed because in your Gemfile you are pointing out the source where the gems can be downloaded from.

What is a Gemfile for?

A Gemfile is a file that is created to describe the gem dependencies required to run a Ruby program. A Gemfile should always be placed in the root of the project directory.


1 Answers

Use File.join('..', 'Ruby_Libs', 'my_gem'') instead of "../Ruby_Libs/my_gem".

gem "my_gem", :path => File.join('..', 'Ruby_Libs', 'my_gem'')
like image 180
gioele Avatar answered Sep 22 '22 03:09

gioele