I have a gem, that must be build with some options.
gem install pg --with-pg-include=/Library/PostgreSQL/9.0/include/ --with-pg-lib=/Library/PostgreSQL/9.0/lib/
Can I include this options in the Gemfile? In my Gemfile the pg
command is
gem "pg", "0.12.2"
I want to provide some options after the version number.
thx, tux
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.
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.
The Gemfile is where you specify which gems you want to use, and lets you specify which versions. The Gemfile. lock file is where Bundler records the exact versions that were installed. This way, when the same library/project is loaded on another machine, running bundle install will look at the Gemfile.
A Gemfile describes the gem dependencies required to execute associated Ruby code. Place the Gemfile in the root of the directory containing the associated code. For instance, in a Rails application, place the Gemfile in the same directory as the Rakefile .
Here is the relevant text from the link posted in comments already:
BUILD OPTIONS
You can use
bundle config
to give bundler the flags to pass to the gem installer every time bundler tries to install a particular gem.A very common example, the
mysql
gem, requires Snow Leopard users to pass configuration flags togem install
to specify where to find themysql_config
executable.
gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Since the specific location of that executable can change from machine to machine, you can specify these flags on a per-machine basis.
bundle config build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config
After running this command, every time bundler needs to install the
mysql
gem, it will pass along the flags you specified.
Here is another example of custom build options, in this case specifying a specific source to download from other than rubygems:
bundle config build.popen4 --source http://gemcutter.org
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With