Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Telling Bundler to exclude certain gems from a particular gem's installation

Within a gemfile, is there any way to tell Bundler something like:

gem 'twitter-bootstrap-rails', :exclude therubyracer

I need to install twitter-bootstrap-rails but it automatically pulls therubyracer in, so bundle install fails and bootstrap isn't included in the project since this is a Windows machine. I installed execjs to no avail.

I tried to list therubyracer under production, and bundle install --without production, also to no avail.

"therubyracer gem on windows" is also this problem, but none of the suggestions there change the error I'm getting.

My old thread was "When I do "bundle update", I get an error from a gem not in my gemfile. How do I ignore this dependency?".

like image 231
JakeP Avatar asked Feb 23 '12 21:02

JakeP


People also ask

How do I install a specific version of a bundler gem?

Install BundlerSelect Tools | Bundler | Install Bundler from the main menu. Press Ctrl twice and execute the gem install bundler command in the invoked popup. Open the RubyMine terminal emulator and execute the gem install bundler command.

How do I remove a bundler gem?

Installation and usage To install a prerelease version (if one is available), run gem install bundler --pre . To uninstall Bundler, run gem uninstall bundler . See bundler.io for the full documentation.

How do you update a gem to a specific version?

The correct way to update the version of a gem to a specific version is to specify the version you want in your Gemfile, then run bundle install . As for why your command line was failing, there is no -version option.


1 Answers

There is no option for this in Bundler.

So you're left with these options:

  • Don't use twitter-bootstrap-rails. You can just copy the compiled css and js files into the proper directories under vendor/assets. You'll lose the ability to change less variables. Or you can use the compass_twitter_bootstrap gem, which uses sass instead of less.

  • Get the maintainer of the less gem to use execjs instead of commonjs and therubyracer. It would probably mean significant refactoring for the maintainer(s) if at all possible.

  • Use the :platform option in your Gemfile, to only install on OSX or Linux. Then require the parts you can use by hand, without loading less. This probably won't work.

like image 169
iain Avatar answered Sep 20 '22 03:09

iain