Gem update issue with ruby 2.2.2 - ruby-on-rails

I was trying to update my ruby 1.9.3 to 2.2.2, and when i test in local that all was working fine, but when i try to push to heroku i got the raindrops issue version and then i update the rain drops by command
bundle update raindrops
but after that when i was checking this Gemfile.lock it shows
GEM
remote: https://rubygems.org/
specs:
raindrops (0.17.0)
unicorn (4.6.3)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
Here the raindrops under the unicorn didn't change, the other one only changed, it push successfully, will it be make any issue for unicorn at any time in production?

Read you Gemfile.lock like this:
GEM
remote: https://rubygems.org/
specs:
raindrops (0.17.0) # <- This is the installed version (0.17.0 is the latest)
unicorn (4.6.3)
kgio (~> 2.6)
rack
raindrops (~> 0.7) # <- This is the version unicorn depends on
You have the latest version of that gem installed (see raindrops page on RubyGems). unicorn itself depends on a raindrops version between 0.7 and < 1.0, the version 0.17.0 fulfills this requirements.
All good!

Related

elastic beanstalk `bundle exec rails c` can't find gems, rake and other commands can

I am testing a new deploy on Elastic Beanstalk of a Rails application that is currently deployed on a different provider. The application deploys successfully, and can be browsed without issue.
However, if I attempt to start a console (bundle exec rails c) after ssh'ing to the environment, I get the following:
Could not find rake-12.3.1 in any of the sources
Run `bundle install` to install missing gems.
bundle list gives me all of the installed gems:
* CFPropertyList (2.3.3)
* RedCloth (4.2.9)
.
. (removed to allow it to fit into the question character limit)
.
* will_paginate-bootstrap (1.0.1)
* xml-simple (1.1.5)
* xpath (2.0.0)
bundle env gives me the following:
```
Bundler 1.16.2
Platforms ruby, x86_64-linux
Ruby 2.3.8p459 (2018-10-18 revision 65136) [x86_64-linux]
Full Path /opt/rubies/ruby-2.3.8/bin/ruby
Config Dir /opt/rubies/ruby-2.3.8/etc
RubyGems 2.7.7
Gem Home /home/ec2-user/.gem/ruby/2.3.8
Gem Path /home/ec2-user/.gem/ruby/2.3.8:/opt/rubies/ruby-2.3.8/lib/ruby/gems/2.3.0
User Path /home/ec2-user/.gem/ruby/2.3.0
Bin Dir /home/ec2-user/.gem/ruby/2.3.8/bin
Tools
Git 2.14.5
RVM not installed
rbenv not installed
chruby 0.3.9
```
## Bundler Build Metadata
```
Built At 2019-01-19
Git SHA
Released Version false
```
## Bundler settings
```
without
Set for your local app (/var/app/current/.bundle/config): [:test, :development]
Set via BUNDLE_WITHOUT: [:test, :development]
disable_shared_gems
Set via BUNDLE_DISABLE_SHARED_GEMS: true
path
Set via BUNDLE_PATH: "vendor/bundle"
```
## Gemfile
### Gemfile
```ruby
source 'https://rubygems.org'
gem 'rails', '~> 4.2.0'
gem 'rails-i18n', '~> 4.0.0'
gem 'sprockets-es6', '~> 0.9.2'
.
. (removed to allow it to fit into the question character limit)
.
PLATFORMS
ruby
DEPENDENCIES
RedCloth (~> 4.2.3)
active_scaffold!
activemodel
activerecord-session_store
acts-as-taggable-on (~> 4.0)
awesomemailer!
axlsx!
better_errors
binding_of_caller
bootstrap-editable-rails
bootstrap-growl-rails
bundler (>= 1.13.6)
byebug
calendar_date_select
capybara
carrierwave
coffee-rails
cucumber-rails
daemons (= 1.1.0)
database_cleaner
decent_exposure
delayed_job_active_record
delayed_job_groups_plugin
dynamic_form
email_spec
exception_notification
factory_girl
factory_girl_rails
faker
fog
font-awesome-rails (~> 4.5)
geokit-rails
haml-rails
html2haml
icalendar
inky-rb
intercom-rails
jquery-rails
jquery-ui-rails
less-rails (~> 3.0.0)
less-rails-bootstrap!
letter_opener
mini_magick
mocha
mysql2 (~> 0.3.0)
name_splitter
newrelic_rpm
omniauth-stripe-connect
page_title_helper
paperclip (~> 4.3)
pickle
plivo
powder
premailer-rails
protected_attributes
puma
rack (= 1.6.10)
rails (~> 4.2.0)
rails-dom-testing
rails-i18n (~> 4.0.0)
rails-jquery-autocomplete
rails-observers
rails_autolink
rake
rb-readline
recaptcha
redactor2_rails
responders
rmagick
rspec-collection_matchers
rspec-expectations
rspec-html-matchers
rspec-rails (~> 3.1)
rspec-rails-mocha!
rspec-retry
rspec_junit_formatter
rubyzip
sanitize_email
sass-rails
search_cop!
selenium-webdriver
sendgrid
sendgrid-ruby
shoulda
shoulda-matchers
simple_form
skylight
spring
spring-commands-rspec
sprockets-es6 (~> 0.9.2)
squeel
stripe
stripe-ruby-mock (~> 2.5.0)
syntax
therubyracer
thin
timecop (= 0.3.5)
truncate_html
uglifier
unicorn
validates_timeliness (~> 3.0.2)
will_paginate (~> 3.0)
will_paginate-bootstrap
xray-rails
BUNDLED WITH
1.16.1
```
And I can successfully run rake tasks: bundle exec rake cron:create_remittance_records
Using the same Gemfile and Gemfile.lock and a new rails 4.2.11 deployed using the same settings at AWS I am able to run bundle exec rails c, so it must be something in my application, but I am at a loss as to what could be effecting rails ability to load gems.
AWS support has also not been able to figure out the issue.
Any help is greatly appreciated.

Bundler on linux doesn't accept rcx versions?

During my capistrano deployment, I run into this error
Bundler could not find compatible versions for gem "nokogiri":
In snapshot (Gemfile.lock):
nokogiri (= 1.6.8.rc3)
In Gemfile:
nokogiri (>= 1.6.8.rc3) x64-mingw32
nokogiri (>= 1.6.8.rc3)
rails-dom-testing x64-mingw32 was resolved to 1.0.7, which depends on
nokogiri (~> 1.6.0) x64-mingw32
rails-dom-testing x64-mingw32 was resolved to 1.0.7, which depends on
nokogiri (~> 1.6.0)
I don't understand, shouldn't ~> 1.6.0 accept my locked version 1.6.8.rc3 ? I am running the Rails app locally perfectly after calling bundle (and I'm on Windows, lol), but the deployment fails on a Ubuntu machine.
Is it caused by the nokogiri (1.6.8.rc3-x64-mingw32) in the GEM>specs of my Gemfile.lock ? I updated this guy so I could use Ruby 2.3 on Windows, but I have to sacrifice Linux for that ?
In your Gemfile.lock, just remove any lines and tree branches with mingw32. For example, if your gemfile.lock contains the lines:
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
nokogiri (1.6.6.2-x86-mingw32)
mini_portile (~> 0.6.0)
Remove the mingw32 section and it should become like this:
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
Then the Gemfile.lock generated on Windows should work for Ubuntu.
You may want always to commit the Gemfile.lock with no occurrences of mingw32.
Alternatively just remove the Gemfile.lock and execute bundle install directly on the Ubuntu machine.

Heroku Ruby version won't upgrade?

I am struggling changing Ruby versions on Heroku.
I use Ruby 2.0.0 with rails 4.
My Gemfile has:
source 'https://rubygems.org'
ruby '2.0.0'
...
The path in Heroku points to:
$ heroku config -s | grep PATH
PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
When I pushed my app, I could see:
Fetching repository, done.
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 431 bytes | 0 bytes/s, done.
Total 4 (delta 3), reused 0 (delta 0)
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
Using rake (10.1.1)
Using i18n (0.6.9)
Using minitest (4.7.5)
Using multi_json (1.8.2)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.38)
Using activesupport (4.0.0.rc1)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0.rc1)
Using mime-types (1.25.1)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0.rc1)
Using activemodel (4.0.0.rc1)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.1)
Using activerecord (4.0.0.rc1)
Using addressable (2.3.5)
Using bcrypt-ruby (3.1.2)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0.rc1)
Using coffee-rails (4.0.0)
Using orm_adapter (0.5.0)
Using warden (1.2.3)
Using devise (3.0.4)
Using excon (0.25.3)
Using geocoder (1.1.9)
Using gmapsjs (0.2.30.1)
Using heroku-api (0.3.15)
Using launchy (2.4.2)
Using netrc (0.7.7)
Using rest-client (1.6.7)
Using rubyzip (1.1.0)
Using heroku (3.2.1)
Using hike (1.2.3)
Using jbuilder (1.0.2)
Using jquery-rails (3.0.4)
Using jquery-ui-rails (4.1.1)
Using json (1.8.1)
Using libv8 (3.16.14.3)
Using nifty-generators (0.4.6)
Using pg (0.17.1)
Using bundler (1.3.2)
Using tilt (1.4.1)
Using sprockets (2.10.1)
Using sprockets-rails (2.0.1)
Using rails (4.0.0.rc1)
Using rails_serve_static_assets (0.0.2)
Using rails_stdout_logging (0.0.3)
Using rails_12factor (0.0.2)
Using rdoc (3.12.2)
Using ref (1.0.5)
Using sass (3.2.13)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using therubyracer (0.12.0)
Using turbolinks (2.1.0)
Using uglifier (2.4.0)
Using will_paginate (3.0.5)
Your bundle is complete! It was installed into ./vendor/bundle
Bundle completed (0.46s)
Cleaning up the bundler cache.
Removing rails_log_stdout (01b5bcc572e3)
Removing rails3_serve_static_assets (84910ceb4ca2)
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
Asset precompilation completed (3.59s)
Cleaning assets
-----> Discovering process types
Procfile declares types -> (none)
Default types for Ruby -> console, rake, web, worker
-----> Compressing... done, 33.3MB
-----> Launching... done, v17
http://rocky-shore-1207.herokuapp.com deployed to Heroku
To git#heroku.com:rocky-shore-1207.git
05cf948..73b6cfa master -> master
Since Heroku said Using Ruby version: ruby-2.0.0, it detected my Ruby version.
However, when I run $ heroku run rake db:migrate or heroku run 'ruby -v'
it returned:
Your Ruby version is 1.9.2, but your Gemfile specified 2.0.0
How can I change the Ruby version to 2.0.0 on Heroku?
Conclusion:
I noticed my rails app had .bash_profile file but it had a wrong path. The path disturbed my heroku path for the ruby version.
Thank you for the help everyone :)
Did you execute: bundle update locally and then committed the file Gemfile.lock?
The server is using Ruby 2, but the app is still configured to use the old version if the new lock file is not pushed.
Review the running version:
$ heroku run console
> RUBY_VERSION
If the version is correct, the one you specified, then you have a bundler problem. Just reinstall it.
gem install bundler
I recommend a full and clean build:
bundle clean --force
gem install bundler
bundle install
you are using Bundler version 1.3.2
Make sure you upgrade to version Bundler 2.0+
Then bundle one last time and push your changes to Heroku
I hope that helps..
This is a hopeful long shot, but maybe try run heroku ps:restart and hope it picks up the new Ruby version.

Heroku push rejected due to failure to install gems

C:\documents\projects\AJP\app>bundle update
Fetching gem metadata from http://rubygems.org/.......
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.7)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.7)
Using erubis (2.6.6)
Using rack (1.2.5)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.33)
Using actionpack (3.0.7)
Using mime-types (1.18)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.2.19)
Using actionmailer (3.0.7)
Using arel (2.0.10)
Using activerecord (3.0.7)
Using activeresource (3.0.7)
Using bundler (1.1.4)
Using thor (0.14.6)
Using railties (3.0.7)
Using rails (3.0.7)
Using acts-as-taggable-on (2.3.1)
Using annotate (2.4.0)
Using diff-lcs (1.1.3)
Using factory_girl (1.3.3)
Using factory_girl_rails (1.0)
Using faker (0.3.1)
Using gravatar_image_tag (1.0.0.pre2)
Using jquery-rails (1.0.19)
Using nested_form (0.2.0)
Using nokogiri (1.5.2)
Using pg (0.11.0)
Using rspec-core (2.5.2)
Using rspec-expectations (2.5.0)
Using rspec-mocks (2.5.0)
Using rspec (2.5.0)
Using rspec-rails (2.5.0)
Using webrat (0.7.1)
Using will_paginate (3.0.3)
Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is installed.
C:\documents\projects\AJP\app>git st
# On branch master
nothing to commit (working directory clean)
C:\documents\projects\AJP\app>git ls-files
.gitignore
.settings/org.eclipse.core.resources.prefs
Gemfile
Gemfile.lock
README
...
Have run both bundle install and bundle update. Note also that Gemfile and Gemfile.lock files are in the committed files.
But then:
C:\documents\projects\AJP\app>git push heroku master
Enter passphrase for key '/c/Users/AJames/.ssh/id_rsa':
Counting objects: 46, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (31/31), done.
Writing objects: 100% (31/31), 4.46 KiB, done.
Total 31 (delta 24), reused 0 (delta 0)
-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Detected Rails is not set to serve static_assets
Installing rails3_serve_static_assets... done
-----> Configure Rails 3 to disable x-sendfile
Installing rails3_disable_x_sendfile... done
-----> Configure Rails to log to stdout
Installing rails_log_stdout... done
-----> Gemfile detected, running Bundler version 1.0.7
Unresolved dependencies detected; Installing...
Using --without development:test
Windows Gemfile.lock detected, ignoring it.
You have modified your Gemfile in development but did not check
the resulting snapshot (Gemfile.lock) into version control
You have added to the Gemfile:
* source: rubygems repository http://rubygems.org/
* rails (= 3.0.7)
* pg (= 0.11.0)
* gravatar_image_tag (= 1.0.0.pre2)
* will_paginate
* rake (= 0.8.7)
* jquery-rails
* nested_form
* acts-as-taggable-on
* rspec-rails (= 2.5.0)
* annotate (= 2.4.0)
* faker (= 0.3.1)
* rspec (= 2.5.0)
* webrat (= 0.7.1)
* factory_girl_rails (= 1.0)
FAILED: http://devcenter.heroku.com/articles/bundler
! Heroku push rejected, failed to install gems via Bundler
To git#heroku.com:ajpxvb.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:ajpxvb.git'
Any ideas please? Thanks.
One thing I noticed in the Heroku output is this:
"Windows Gemfile.lock detected, ignoring it."
I read a Heroku Dev Center Article on Bundler that notes the following regarding: Gemfile.lock
If the platforms section of your Gemfile contains Windows entries, such as mswin or mingw, then the Gemfile.lock file will be ignored.
By chance does your Gemfile contain the aforementioned sections and, if so, what happens if you remove/comment out the platform sections (just to test)?

Rolling back a gem

Ok, I changed my gem file
cucumber (1.0.6)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
gherkin (~> 2.4.18)
json (>= 1.4.6)
term-ansicolor (>= 1.0.6)
cucumber-rails (1.0.6)
capybara (>= 1.1.1)
cucumber (>= 1.0.6)
nokogiri (>= 1.5.0)
But a web_steps.rb file doesn't appear? Do I need to run anything in the command line to get it to show up?
Gemfile:
cucumber (1.1.7)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
gherkin (~> 2.8.0)
json (>= 1.4.6)
term-ansicolor (>= 1.0.6)
cucumber-rails (1.2.1)
capybara (>= 1.1.2)
cucumber (>= 1.1.3)
nokogiri (>= 1.5.0)
Thanks for the answers! But I am now getting the error?
You have requested:
cucumber = 1.0.6
The bundle currently has cucumber locked at 1.1.7.
Try running bundle update cucumber
You can install a specific version of a gem by using:
gem install <gem> -v=<version>
e.g.
gem install cucumber -v=1.1.4
Then you specify in your gemfile, that you want this specific version:
gem 'cucumber', '1.1.4'
This way your rails app should use the version you want.
Concerning your Gemfile.lock problem. Try using
bundle update
Or delete your Gemfile.lock (it will be rebuild automatically when you try to start your rails app).
Add to your Gemfile or chenge current entry to:
gem 'cucumber', '1.1.1'
where 1.1.1 is the cucumber version you want to use. Next run bundle.
Change it in your gem file. So assuming you want to use version 1.5, you would have
gem 'cucumber', '1.5'
The next thing would be to install the gem by running bundle install from the terminal
If this is because of the web_steps.rb file that got removed from cucumber, the you can add the following to your gemfile
gem "cucumber-rails-training-wheels", :group => :test
However make sure you read THIS

Resources