Update twitter-bootstrap-rails gem - ruby-on-rails

I have a rails project with twitter-bootstrap-rails gem and twitter bootstrap 2. Now I need to migrate to twitter bootstrap 3. But I don't know how to do this, because I update my gemfile like this:
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
then
bundle install
and everything works perfect, so I guess nothing is updated. How I can update my gem and work with twitter bootstrap 3.
Thanks in advance for your help.

According the documentation you need to switch to the bootstrap3 branch, so add a branch option to your Gemfile.
gem 'twitter-bootstrap-rails', :github => 'seyhunak/twitter-bootstrap-rails', :branch => 'bootstrap3'

Please read the documentation of the gem here: https://github.com/seyhunak/twitter-bootstrap-rails/tree/bootstrap3
Try generating the assets using the described procedure based on whether you are using less or static css.

Related

Rails: Requiring "RMagick" is deprecated. Use "rmagick" instead.FactoryGirl

When I create an object via FactoryGirl and Faker, shell show me an error
[1] pry(main)> FactoryGirl.create(:company)
[DEPRECATION] requiring "RMagick" is deprecated. Use "rmagick" instead
but when I create object in development db - it's ok
there is factory
factory :company do
title Faker::Company.name
image Faker::Avatar.image("my-own-slug", "200x200")
end
how fix?
This is most certainly dues to CarrierWave when the execution comes to your line image Faker::Avatar.image("my-own-slug", "200x200").
There is an issue on CarrierWave which is closed now and the fix is merged. Either you include the github commit in your GemFile, or you wait for the next gem release.
First, most people will want to include rmagick in their bundle like this:
gem 'rmagick', require: false
Second, rmagick 2.15.0 was just released. (Find your version with bundle list.) Upgrade the gem to version 2.15.0 with bundle update.
At this point you may still get the error as a pull request to remove it is on github but has not been merged yet.
This is very late however it might help someone:
gem 'carrierwave', :github => 'satoruk/carrierwave' , :ref => '43179f94d6a4e62f69e812f5082d6447c9138480'
gem 'rmagick', require: false
This should give you the version with rmagick fixed. I am not sure why they don't merge it to the master.
Hope it helps.
If you are writing the following in Gemfile:
gem 'rmagick', :require => 'RMagick'
try rewrite as follows:
gem 'rmagick'
https://github.com/gemhome/rmagick#installing-via-bundler
Just update your carrierwave gem and that should do.
bundle update carrierwave
I had this same challenge when upgrading a Rails 5 app to Rails 6
Here's how I fixed it:
First, I added the most recent version of the rmagick gem to the Gemfile. As of this writing it is rmagick 4.2:
gem 'rmagick', '~> 4.2'
Next, I checked for the files where rmagick has been required. I modified the file below from:
class Admin::FormPrecedentsController < Admin::BaseController
require 'RMagick'
end
to this:
class Admin::FormPrecedentsController < Admin::BaseController
require 'rmagick'
end
That's all.
I hope this helps
If you are using Carrierwave gem you had to try downgrading the version to 0.7.0, add on your gemfile 'carrierwave', '0.7.0' and then run on the console 'bundle update carrierwave'

alternative for github : <repo-name> in gem file

I am trying to build the docrails in my system. When I clone the repo and do bundle install as the guides say.
I get the following error
You passed :github as an option for gem 'rails/active_record_deprecated_finders'
, but it is invalid.
Entry in gemfile looks like this:
gem 'rails/active_record_deprecated_finders', github: 'rails/active_record_deprecated_finders'
To avoid that what I am doing is commenting the rest of the line like this:
gem 'rails/active_record_deprecated_finders'#, github: 'rails/active_record_deprecated_finders'
Then it foregoes that and the next problem arrives with the error message saying:
Could not find gem 'active_record_deprecated_finders (>= 0) x86-mingw32' in any
of the gem sources listed in your Gemfile.
Environment specs:
Bundler version 1.0.21
Rails 3.2.3
Win7 64bit
Question
I dont know why its looking for x86 when my System is 64bit.Is there any work around for this? or its a bug?
If gem file couldn't accept github: as parameter why is it there in the first place?
Please let me know if there are any workarounds to this problem
The :github option is just shorthand for a longer :git option:
gem :foo, :github => 'rails/foo'
Is just short for
gem :foo, :git => 'git://github.com/rails/foo.git'
This is new in bundler 1.1 which is why it doesn't work on your setup. You could rewrite the gemfile but it would probably be easier to update bundler. In addition bundler 1.1 is a lot faster than 1.0

How to edit a gem at Heroku

I'm using 'rails3-jquery-autocomplete' gem, but it doesn't have multi column search, but there is a fork that does it ( more details at: https://github.com/crowdint/rails3-jquery-autocomplete/pull/95).
Now I need to deploy to Heroku but it will install the official gem. How can I edit it? Or if it's not possible, how can I import a gem to the application?
Thanks.
you can use the fork by specifying the :git path in your Gemfile declaration
something like
gem "_GEM_NAME_", :git => "git://git/repository.git"
your other option would be to just vendor the gem inside your into a directory like vendor/gems/_gem_name and then you could use the :path option as well
gem "_GEM_NAME_", :path => "vendor/gems/_gem_name"

'Could not find gem' error when specifying a forked version of a gem from Github in my gemfile

I am trying to use this forked version of the searchlogic gem. In my gemfile, I have
gem "searchlogic", :git => "http://github.com/railsdog/searchlogic.git"
when I do bundle install, I get this error:
Could not find gem 'searchlogic (>= 0, runtime)' in http://github.com/railsdog/searchlogic.git (at master).
Source does not contain any versions of 'searchlogic (>= 0, runtime)'
What is causing this error? Thanks for reading.
It's because your fork not define searchlogic gem by rd_searchlogic gem. So use in your Gemfile :
gem "rd_searchlogic",
:git => "rd_searchlogic.gemspec",
:require => "searchlogic"
Use:
gem 'rd_searchlogic', :git => 'https://github.com/railsdog/searchlogic.git', :require => 'searchlogic'
The .gemspec of your fork might contain a different name to that of the gem on RubyGems, for example when I forked active_merchant on GitHub their .gemspec file had:
s.name = 'activemerchant'
but the gem is defined as active_merchant on RubyGems so I changed my Gemfile from:
gem "active_merchant", git: "https://github.com/adamwaite/active_merchant.git", require: "active_merchant"
to:
gem "activemerchant", git: "https://github.com/adamwaite/active_merchant.git", require: "active_merchant"
note the lack of _.
All worked perfectly after that. This may be an obscure case, but hope it helps someone!
It doesn't look like that gem has been upgraded for Rails3. From the issues listed in Github, it seems that searchlogic is heavily dependent on ActiveRecord2 and may not be easily upgraded for Rails 3. It may be worth looking into an alternative.
Will searchlogic work with Rails 3?
http://github.com/binarylogic/searchlogic/issues/issue/65

how to add gem dependency with :path and :branch

I am working on a rails gem that has dependency on the following
gem 'authlogic', :git => 'git://github.com/odorcicd/authlogic.git', :branch => 'rails3'
How can I add this in the gem spec as a dependency? Specifically I need to specifiy the path and branch in the dependency.
You definitely want to use Bundler then. You would put exactly what you have into the Gemfile file. Go checkout the link to Bundler I left below.
-- older info --
For jeweler you would add something like this:
gem.add_dependency 'authlogic', '> 1.0', '<= 2.0'
But you might be better off using Bundler. It's not just for rails: http://gembundler.com/
You need generate the gem. Publish it and after use this gem deploy.

Resources