wag0325
wag0325

Reputation: 1028

How to destroy and reinstall a Gem after migration?

I would like to know how I can destroy a gem completely and reinstall it.

This is what I did to install a gem called 'spree_fancy':

$bundle install 
$bundle exec rails g spree_fancy:install

And resulted following:

bundle exec rails g spree_appa:install 

append  app/assets/javascripts/store/all.js
      append  app/assets/javascripts/admin/all.js
      insert  app/assets/stylesheets/store/all.css
      insert  app/assets/stylesheets/admin/all.css
         run  bundle exec rake railties:install:migrations FROM=spree_appa from "."
Copied migration 20140105025133_add_slider_taxons_and_apply_them.spree_appa.rb from spree_appa
Would you like to run the migrations now? [Y/n] y
         run  bundle exec rake db:migrate from "."

==  AddSliderTaxonsAndApplyThem: migrating ====================================
==  AddSliderTaxonsAndApplyThem: migrated (0.3630s) ===========================

I have tried couple of different methods but didn't work:

$ bundle exec rake db:rollback
$ rails destroy controller user_controller(controllerName)

I didn't destroy model, because the gem I'm using is a theme for Spree Commerce and doesn't include any model. I'm not sure how I can destroy a gem after I migrated bunch of files.

Upvotes: 4

Views: 1076

Answers (1)

Gjaldon
Gjaldon

Reputation: 5644

Here's what you need to do to remove all the changes of doing rails g spree_fancy:install:

$ bundle exec rake db:rollback
$ rails destroy spree_fancy:install

The commands above will rollback the latest migrations you did to your schema and then destroy all files generated by the spree_fancy:install command.

You could also remove gem 'spree_fancy' from your Gemfile and then do bundle install if you think it necessary.

To reinstall, just do the same commands you did before.

Upvotes: 1

Related Questions