Skip to content
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.

Remove the gem #226

Open
ghost opened this issue Jan 25, 2017 · 4 comments
Open

Remove the gem #226

ghost opened this issue Jan 25, 2017 · 4 comments

Comments

@ghost
Copy link

ghost commented Jan 25, 2017

Hi. I want to completely remove the spree_static_content from my application, how can I do it? I will remove it from gemfile and gemfile.lock but get the error, after bundle install:

Showing /home/d7na/.rvm/gems/ruby-2.2.5/gems/spree_frontend-3.1.3/app/views/spree/shared/_products.html.erb where line #28 raised:

couldn't find file 'spree/frontend/spree_static_content' with type 'text/css'

How can I delete it?

@madakopihub
Copy link

please check vendor directory, and remove the like related with the error @D7na

@xu4wang
Copy link

xu4wang commented Apr 13, 2020

Hello, is there a procedure to un-install the gem? Do we need to manually remove tables from database, or remove some .rb files? Thanks.

@weefunker
Copy link

We need a way of deleting this gem. It makes deployments take about five times as long and it leaves behind a bunch of things that destroy migrations.

@ctsstc
Copy link

ctsstc commented Oct 14, 2020

To remove the Gem you will need to reverse some steps.

You can see what the current install task does here:
https://github.com/spree-contrib/spree_static_content/blob/master/lib/generators/spree_static_content/install/install_generator.rb

If you can find the commit when you added the gem that may be the best indicator. It's possible you may have updated the gem and more is required, than the initial commit.

Removing the Spree Static Content Plugin

  1. Remove the gem from Gemfile
  2. Run bundler to update the Gemfile.lock
  3. Remove *= require spree/frontend/spree_static_content from: vendor/assets/stylesheets/spree/frontend/all.css
  4. Create a new migration bin/rails g migration RemoveSpreeStaticContentPlugin
  5. Add the following to the migration
class RemoveSpreeStaticContentPlugin < ActiveRecord::Migration[6.0]
  def up
    drop_table :spree_pages
    drop_table :spree_pages_stores
  end

  def down
    raise ActiveRecord::IrreversibleMigration
  end
end
  1. Run migrations bin/rails db:migrate, make sure everything still works, commit, push up. NOTE: this is irreversible as the code shows above.

Note:

Currently these are the two tables that are being created.
You could add this to a fresh project to see what is added, or find the commit that you added the plugin to your project and what changed at the time; it's possible updates changed it from there out.
You can also see what migrations were ran here ideally too:
https://github.com/spree-contrib/spree_static_content/tree/master/db/migrate

Note to self for private repo, commit that added the plugin:
https://github.com/Utiliti-USA/utiliti-rails-spree-v4/commit/38b31fe1e02319ae99eb57129f2add050b0249fd

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants