Rolling back a gem - ruby-on-rails

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

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.

Update Avro Library in Ruby

Here is my Gemfile:
source "http://ci-stickler.com"
gemspec :name => "ci_canonical"
gemspec :name => "ci_canonical-serialization"
gem "rspec", "~> 3.0"
gem "rake", "~> 10.0"
When I am running bundle update, it is not updating the avro for ci_canonical-serialization. What am I missing here ?
I have updated the gem to 1.8.1 and installed the gem. My Gemfile.lock is generating as:
[ciuser#ci_canonical]$ head -n25 Gemfile.lock
PATH
remote: .
specs:
ci_canonical (11.0.5)
domain_model (~> 0.4)
enumerated_type (~> 0.4)
json (~> 1.6)
ci_canonical-serialization (11.0.5)
avro (~> 1.7)
ci_canonical (= 11.0.5)
GEM
remote: http://ci-stickler.com/
specs:
avro (1.8.1)
multi_json
diff-lcs (1.2.5)
docile (1.1.5)
domain_model (0.4.0)
enumerated_type (0.4.1)
json (1.8.3)
multi_json (1.12.1)
I have followed some posts but they didn't help. I am also not clear what we are specifying in Gemfile as gemspec.
Figured out answer myself. We might have multiple gems inside a single repository(could be git repository) and for all the gems, we have a .gemspec file associated which shall in turn tells about the dependencies.
So in my case, I was not modifying the second .gemspec file. Modifying it helped in resolving the problem.

Circular dependency on Gemfile

I'm having this error while running bundle install:
Your Gemfile requires gems that depend on each other, creating an infinite loop. Please remove gem 'casein' and try again.
The error started when I added the gem countries to Gemfile.
I think it's a weird bug, because countries and casein have very different dependencies:
Puelos-Macbook:ChataBackend paulo$ gem dependency countries
Gem countries-0.11.4
currencies (~> 0.4.2)
i18n_data (~> 0.7.0)
rspec (>= 3, development)
yard (>= 0, development)
Puelos-Macbook:ChataBackend paulo$ gem dependency casein
Gem casein-5.0.0.0
authlogic (= 3.4.2)
casein (>= 0)
jquery-rails (>= 0)
scrypt (= 1.2.1)
will_paginate (= 3.0.5)
edit:
Just to be sure, I removed all other gems from my Gemfile:
source 'https://rubygems.org'
gem 'countries'
gem 'casein', '5.0.0'
But the error persists
Oh, sorry, I didn’t get this at the first glance.
casein gem references itself:
Puelos-Macbook:ChataBackend paulo$ gem dependency casein
Gem casein-5.0.0.0
authlogic (= 3.4.2)
!! NB⇒ casein (>= 0)
jquery-rails (>= 0)
scrypt (= 1.2.1)
will_paginate (= 3.0.5)
It was allowed for bundle prior to 1.9, but disallowed now. You have two options:
downgrade bundler to 1.8 and re-run bundle install.
clone the casein gem, patch casein.gemspec by removing self-reference and submit a pull-request. https://github.com/spoiledmilk/casein3/blob/master/casein.gemspec#L103
NB Actually this was already done by community, e.g. https://github.com/russellquinn/casein
So, you might simply require that version explicitly via gem 'casein', git: 'github.com:russellquinn/casein'.
Hope it helps.

Rake abort error

OK, so I'm doing the following Ruby tutorial: https://github.com/alexch/learn_ruby
and I have saved all the files under c:/learn_ruby
When I run rake in the directory: "00_hello" I get the following error:
c:\learn_ruby\00_hello>rake
(in c:/learn_ruby)
rake aborted!
Could not find 'rspec' (~> 2) - did find: [rspec-3.0.0]
Checked in 'GEM_PATH=C:/Users/******/.gem/ruby/1.9.1;C:/Ruby193/lib/ruby/gems/1
.9.1', execute `gem env` for more information
my current gem list is:
bigdecimal (1.1.0)
diff-lcs (1.2.5)
io-console (0.3)
json (1.5.5)
minitest (2.5.1)
rake (0.9.2.2)
rdoc (3.9.5)
rspec (3.0.0)
rspec-core (3.0.2)
rspec-expectations (3.0.2)
rspec-mocks (3.0.2)
rspec-support (3.0.2)
rubygems-update (2.3.0)
I am new at Ruby, so can someone please help a noob out? I tried installing rspec 2.0.0, but got a different error.
The error message
Could not find 'rspec' (~> 2)
means that it is looking for rspec in the 2.x range. Usually this means you have a Gemfile which specifies gem 'rspec', '~> 2'. The ~> ties it to the same version "family"; see the bundler docs for more information.
Usually the solution is to type
bundle install
which will make sure your prerequisites are met.

RoR omniauth and facebooker2

In a new application Rails 3.1 with only in Gemfile:
gem "omniauth"
gem "facebooker2"
bundle install give the error:
Bundler could not find compatible versions for gem "hashie":
In Gemfile:
facebooker2 (= 0.0.16) ruby depends on
hashie (~> 1.1.0) ruby
omniauth (>= 0) ruby depends on
hashie (1.2.0)
How can I install facebooker2 with omniauth?
I just ran bundle with those 2 gems and it worked.
It did install facebooker2 0.0.12 however, and not 0.0.16
gem 'omniauth', '1.0.2'
gem 'facebooker2'
it also worked without specifying the omniauth version, but I highly recommend using the a 1.0.0 release as there are huge differences. The main one being all the providers are now in their own gems.
If bundle install doesn't work, run bundle update.
The relevant sections of my Gemfile.lock:
facebooker2 (0.0.12)
mogli (>= 0.0.12)
ruby-hmac
hashie (1.2.0)
hike (1.2.1)
httparty (0.8.1)
multi_json
multi_xml
...
mogli (0.0.28)
httparty (>= 0.4.3)
omniauth (1.0.2)
hashie (~> 1.2)
rack
The only way I have to solve the problem was to clone the mogli project and update the hashie dependence to 1.2:
https://github.com/davidsf/mogli/commit/bcee3dd815bab7c8eb68511ee0d7c2da39115e14

Resources