Disclaimer before reading: I have resolved this issue but I am asking because I still don't know the reasons behind it.
I'm working on an old gem that pulls assets into the asset pipeline. I'm not positive how the gem was originally created I imagine it was with rails plugin new static_assets.
Since it is a gem the Gemfile is not overly complex (I haven't made any changes to it):
source "http://rubygems.org"
gemspec
# jquery-rails is used by the dummy application
gem "jquery-rails"
But the Gemfile.lock has dozens of gems and dependencies showing up. For the most part, the gems seem up to date.
When I run a bundle update several of the gems go back to much older versions; like Rails 5 to Rails 3.
I believe I solved this by updating the Gemfile to
gem 'jquery-rails', '~> 4.3', '>= 4.3.3'
but I want to know why this was happening.
I'm not overly familiar with how Gemfile.lock gets created and updated but I was under the impression that it was based on the Gemfile, pulling all gems and their dependencies from the Gemfile. If all the gems in Gemfile.lock are dependant on jquery-rails why was it automatically downgrading them so unilaterally and by so much?
Related
I am trying to update a gem (specifically bootstrap-sass) to the latest version (3.1.1). To do this I first edited the Gemfile to change the bootstrap line to this:
gem 'bootstrap-sass', '3.1.1'
Then I ran
bundle install
bundle update
bundle install
and started the server, but when looking at the custom CSS file with Bootstrap included, the CSS included was still version 2.3.2. There is probably a simple answer to this question to force the update upon all components of the app, but how do I apply this update?
Here's the Github repo so people can help debug faster:
https://github.com/afuhrtrumpet/menu_app
Per the bootstrap-sass readme.md at:
https://github.com/twbs/bootstrap-sass
Make sure you have sass-rails in your Gemfile too.
gem 'sass-rails', '>= 3.2'
Since you already had been running bootstrap, I presume you have #import 'bootstrap' in your CSS tree.
The old version of bootstrap-sass was still installed along with the new version and was still being used. The following command fixed it:
gem cleanup bootstrap-sass
Delete Gemfile.lock, and rerun bundle commands
I have been repeating this tutorial for weeks now:
https://www.digitalocean.com/community/articles/how-to-1-click-install-ruby-on-rails-on-ubuntu-12-10-with-digitalocean
Here are the specifics of my project:
I am using Mongoid with database.yml production set to my tested and working Droplet (DigitalOcean VPS) running MongoDB.
My gem file is here, I am new to Rails and am not quite sure if it's set up right, so I just moved them all to assets hoping Unicorn might serve these gems for me?
source 'https://rubygems.org'
gem 'rails', '3.2.14'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem "therubyracer"
gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
gem "twitter-bootstrap-rails"
gem 'redcarpet', '1.17.2'
gem 'uglifier', '>= 1.0.3'
gem "will_paginate_mongoid"
gem 'will_paginate', '~> 3.0.5'
gem 'will_paginate-bootstrap'
gem 'devise'
gem 'jquery-rails'
gem "mongoid", "~> 3.0.0"
end
Here's what I did:
I used DigitalOcean's 1 click installer. Then I used FileZilla to SFTP into the credentials they provided me with. I deleted all the files in /home/rails and put my new files in from my project. Then I executed bundle install, and restarted the unicorn service. In the tutorial I had seen I can track the log of unicorn, so I executed this: tail -f /home/unicorn/log/unicorn.log
Here is the output which concerns me:
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/bundler-1.3.5/lib/bundler/runtime.rb:33:in `block in setup': You have already activated rack 1.5.2, but your Gemfile requires rack 1.4.5. Using bundle exec may solve this. (Gem::LoadError)
I saw some other solutions to this, all failed. Here are the solutions I tried:
Deleting my Gemfile.lock, and re bundle installing it. Going into the file and removing where it said rack. Running bundle install --binstubs. Restarting the unicorn service with bundle exec before it. The error remains the same.
I've had many different errors before, but I feel this is the closest I have gotten. If someone could explain this to me (I'm new to Rails and would like a thorough explanation) and possibly help me fix the error that would be fantastic and end this frustration.
Just a wild guess
gem "rack", "~> 1.4.5"
May work for you, then of course bundle install afterwards.
This solves the problem:
gem uninstall rack -v 1.5.2
Possibly reload your Ubuntu installation from the DigitalOcean control panel, then try and install Ruby on Rails with Apache and Passenger?
Install RoR
Install Passenger (skip to passenger installation)
You will have errors when first creating your site with rails new as it will try and use SQL when it won't be installed, if you wish to use MongoDB
I have a Ubuntu 12.04 server and several rails 3.2.14 sites on it. Every time I do a new site deployment (via capistrano) the first install takes 20 - 30 minutes because it does a full install of libv8, even though I have already installed the libv8 gem on the machine (and see it when I do a gem list).
I've tried the binary version and tried changing versions of therubyracer.
Here's therubyracer part of my Gemfile
group :assets do
gem 'sass-rails', '~> 3.2.6'
gem 'coffee-rails', '~> 3.2.2'
gem 'uglifier', '>= 1.0.3'
gem 'therubyracer', '~> 0.12.0'
end
I've turned on verbose output in Capistrano and here's where it hangs up for ~20 minutes
** [out :: 198.58.99.7] Installing libv8 (3.16.14.3)
Any suggestions? Really tired of new sites taking this long to deploy.
As I said in my comment, bundle with the --deployment flag (as Capistrano does) installs gems into a your_app/shared/bundle. One of the reasons for this isolation and location is because the user you're deploying with may not have access to install gems to a system location, and more reasons described here (under the Deploying Your Application heading).
I believe there are ways to force bundler to use the system gems but I don't have any first hand experience of it; see here.
There's probably a conflict in dependencies in your Gemfile.
Remove the version constraint for therubyracer in your Gemfile and bundling should be much faster.
gem 'therubyracer'
I´m totally lost so i will try to explain my problem.
Actually im reading the book Ruby on Rails tutorial. I´m actually installing all the environment to start learning this language.
The book asks me to update the Gemfile, and add this
group :assets do
gem 'sass-rails', '3.2.4'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end
So i delete my old gem sass-rails, my old gem coffee-rails and my old gem uglifier.
After doing this the book asks me to save it and run Bundle install on my console.
After doing this i get this message:
You have requested:
coffee-rails = 3.2.2
The bundle currently has coffee-rails locked at 4.0.1.
Try running `bundle update coffee-rails`
So i´m totally lost, and i have no idea what i´m doing cause im only following the steps from the book. Someone could help me and tell me what i should do here? Why the book is asking me to do all this if then it does´t work?
Sounds like you have already done a bundle install on a newer (probably without the version requirement) of coffee-rails and that is currently locked down in your Gemfile.lock file.
Do what it says and run bundle update coffee-rails to update your Gemfile.lock file to the version you specify
I'm using the rails devise gem. I noticed a case sensitivity bug which turns out is fixed in the latest version of devise so I'm thinking about upgrading.
In my gem file I have:
gem 'devise', '~> 1.1.3'
When I run bundle I get:
Using devise (1.1.9)
Why the difference. And what setting should I be using in my gem file to upgrade to the latest and greatest?
Thanks
The ~> in your Gem declaration says that Bundler can install any version up to the next major version, so in this case it could install any version of devise that is => 1.1.3 and < 1.2.0.
Including the ~> is good practice, as it means security updates are automatic if the gem is using versioning correctly; in a production environment, you'll probably want to drop this moniker, though, and just set your gem versions statically to avoid issues.
To update to the latest version of the gem, everytime, just use the following with no second version argument:
gem 'devise'
See more information on the Gemfile format at http://gembundler.com/gemfile.html.
Just use :
gem 'devise'
and you will be getting the latest stable gem :)
The difference is because you're telling to Bundler to use 1.1.3 or a major version of this gem in you system, if you want to use a specific version just put '1.1.9' in the version param.
use bundle update devise to update the devse gem and bundle update to update all the gems (which is not advisable)
http://jsbin.com/ihiqe4
if you know the version number you want, try this (assuming it's 1.2.3):
gem 'devise', '1.2.3'
or just leave out the version number
if it has not been released yet, you can point to it's github repository instead.