Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails: Removing a dependency while installing a gem?

I'm attempting to gem install twitter-bootstrap-rails on my windows machine. This gem has a dependency on therubyracer, which is not yet compatible with Windows. I found this:

therubyracer gem on windows

Which tells me I should just be able to lean on JScript. Though I don't know how to tell the gem install to ignore dependencies. I've tried to force install with:

    gem install -f twitter-bootstrap-rails --platform ruby 

To no avail. Does anyone how I can say something like "gem install twitter-bootstrap-rails [but ignore that dependency on therubyracer]"?

like image 790
JakeP Avatar asked Feb 21 '12 16:02

JakeP


People also ask

What does Gemfile lock do?

The Gemfile. lock allows you to specify the versions of the dependencies that your application needs in the Gemfile , while remembering all of the exact versions of third-party code that your application used when it last worked correctly. By specifying looser dependencies in your Gemfile (such as nokogiri ~> 1.4.

How do I remove gem from Gemfile lock?

You can run just bundle or bundle install to install gems based on your Gemfile. That will remove the instance of mygem from your Gemfile. lock file.

How do you update a Ruby 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.


2 Answers

According to this doc, there's the options

-f, --[no-]force            Force gem to install, bypassing dependency checks

and

--ignore-dependencies        Do not install any required dependent gems
like image 174
Baldrick Avatar answered Sep 30 '22 10:09

Baldrick


If your goal is to get the rails twitter boostrap working on Windows, there is a version of this that uses static CSS, avoiding the fixed dependency on therubyracer. This will install on Windows. You won't have the Less functionality, but it does work in Windows. Try this in your Gemfile:

gem 'twitter-bootstrap-rails', :git => "git://github.com/seyhunak/twitter-bootstrap-rails.git", :branch => "static"
like image 43
Cliff Darling Avatar answered Sep 30 '22 11:09

Cliff Darling