Giter Site home page Giter Site logo

refinerycms-contrib / spree-refinery-authentication Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dominiclovell/spree-refinery-authentication

12.0 2.0 8.0 43 KB

This gem is a Refinery CMS and Spree E-commerce connector.

License: MIT License

Ruby 97.87% HTML 2.13%

spree-refinery-authentication's Introduction

Spree Refinery CMS Authentication

Build Status Code Climate Test Coverage

This gem is a Refinery CMS and Spree E-commerce connector.

Key features

  • It provides tabs in Refinery CMS and Spree menus to easily switch between both backends
  • Shares admin sessions and user abilities between Refinery CMS and Spree.

Compatibility

Installation

Create a new Rails 4.2.x application:

gem install rails -v 4.2.3
gem install bundler

Add Spree and those gems to your Gemfile:

gem 'refinerycms', github: 'refinery/refinerycms', branch: 'master'
gem 'quiet_assets', :group => :development

# Add support for searching inside Refinery's admin interface.
gem 'refinerycms-acts-as-indexed', ['~> 2.0', '>= 2.0.0']

# Add support for Refinery's custom fork of the visual editor WYMeditor.
gem 'refinerycms-wymeditor', ['~> 1.0', '>= 1.0.6']

gem 'spree', github: 'spree/spree', branch: '3-0-stable'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '3-0-stable'
gem 'spree-refinerycms-authentication', github: 'bricesanchez/spree-refinery-authentication', branch: '3-0-stable'

Note: DON'T install the gem refinerycms-authentication-devise. The authentication will be provided by Spree and included in the gem spree_auth_devise.

Run bundler, then install Spree

bundle
rails g spree:install

Change the Spree.user_class in the initializer config/initializer/spree.rb

Spree.user_class = "Spree::User"

Run the migrations

rake db:migrate

Then, put those lines in config/routes.rb to use RefineryCMS and Spree together and remove routes conflicts

root :to => "refinery/pages#home"
mount Spree::Core::Engine, :at => '/shop'
mount Refinery::Core::Engine, at: '/'

Note: If you try to mount both engines at => '/', Refinery will try to display a page even if you request a Spree page. Every page load will be slow.

Create a Spree admin user

bundle exec rake spree_auth:admin:create

All done! Now start your application

rails server

You should now be able to access Refinery admin at http://localhost:3000/refinery and Spree admin at http://localhost:3000/shop/admin.

spree-refinery-authentication's People

Contributors

bricesanchez avatar amacneil avatar parndt avatar dominiclovell avatar obi-tob avatar dependabot-preview[bot] avatar

Stargazers

 avatar Mirzalazuardi Hermawan avatar Ezequiel Maraschio avatar Dream Boost me avatar Fred LASNIER avatar Damian Legawiec avatar Peterberwind avatar Nuno Silva avatar Mark Holmberg avatar  avatar Jared White avatar jonah.blossom avatar

Watchers

James Cloos avatar  avatar

spree-refinery-authentication's Issues

cannot load such file -- refinery/core/authorisation_adapter (LoadError)

Hello all,
When I run the server it keeps giving this error:
/home/nuno/.rvm/gems/ruby-2.1.6/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require': cannot load such file -- refinery/core/authorisation_adapter (LoadError)

perhaps my refinery / spree gem version is wrong??
I hope you can give me a hand here...
thank you
this is my gemfile:

gem 'spree', '3.0.2.beta', github: 'spree/spree', branch: '3-0-stable'
branch: '3-0-stable'
gem 'spree_shared', github: 'spree-contrib/spree_shared', branch: '3-0-stable'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '3-0-stable'
branch: '3-0-stable'
gem 'spree_i18n', github: 'spree-contrib/spree_i18n', branch: '3-0-stable'
gem 'spree_multi_currency', github: 'spree-contrib/spree_multi_currency', branch: '3-0-stable'
gem 'spree_mail_settings', github: 'spree-contrib/spree_mail_settings', branch: '3-0-stable'

refinery CMS

gem 'refinerycms', github: 'refinery/refinerycms', branch: 'master'
gem 'refinerycms-authentication-devise', github: 'refinery/refinerycms-authentication-devise', branch: '3-0-stable'
gem 'quiet_assets', :group => :development
gem 'refinerycms-acts-as-indexed', ['> 2.0', '>= 2.0.0']
gem 'refinerycms-wymeditor', ['
> 1.0', '>= 1.0.6']

Problem with Bootstrap-sprockets

Getting an error after installing as per instructions in readme.

 Sprockets::FileNotFound in Spree::Home#index 

couldn't find file 'bootstrap-sprockets' with type 'application/javascript'

/home/scallywag/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/bundler/gems/spree-2f7322cdd764/frontend/app/assets/javascripts/spree/frontend.js:1
sprockets (3.4.0) lib/sprockets/resolve.rb:64:in `resolve!'
sprockets (3.4.0) lib/sprockets/directive_processor.rb:399:in `resolve'
sprockets (3.4.0) lib/sprockets/directive_processor.rb:207:in `process_require_directive'
sprockets (3.4.0) lib/sprockets/directive_processor.rb:180:in `block in process_directives'
sprockets (3.4.0) lib/sprockets/directive_processor.rb:178:in `each'
sprockets (3.4.0) lib/sprockets/directive_processor.rb:178:in `process_directives'
sprockets (3.4.0) lib/sprockets/directive_processor.rb:83:in `_call'
sprockets (3.4.0) lib/sprockets/directive_processor.rb:68:in `call'
sprockets (3.4.0) lib/sprockets/processor_utils.rb:75:in `call_processor'
sprockets (3.4.0) lib/sprockets/processor_utils.rb:57:in `block in call_processors'
sprockets (3.4.0) lib/sprockets/processor_utils.rb:56:in `reverse_each'
sprockets (3.4.0) lib/sprockets/processor_utils.rb:56:in `call_processors'
sprockets (3.4.0) lib/sprockets/loader.rb:134:in `load_from_unloaded'
sprockets (3.4.0) lib/sprockets/loader.rb:60:in `block in load'
sprockets (3.4.0) lib/sprockets/loader.rb:318:in `fetch_asset_from_dependency_cache'
sprockets (3.4.0) lib/sprockets/loader.rb:44:in `load'
sprockets (3.4.0) lib/sprockets/cached_environment.rb:20:in `block in initialize'
sprockets (3.4.0) lib/sprockets/cached_environment.rb:47:in `yield'
sprockets (3.4.0) lib/sprockets/cached_environment.rb:47:in `load'
sprockets (3.4.0) lib/sprockets/bundle.rb:23:in `block in call'

Steps to reproduce on Rails 4.2.4:

rails new spreefiner
cd spreefinery

add to Gemfile:

gem 'refinerycms', github: 'refinery/refinerycms', branch: 'master'
gem 'quiet_assets', :group => :development

# Add support for searching inside Refinery's admin interface.
gem 'refinerycms-acts-as-indexed', ['~> 2.0', '>= 2.0.0']

# Add support for Refinery's custom fork of the visual editor WYMeditor.
gem 'refinerycms-wymeditor', ['~> 1.0', '>= 1.0.6']

gem 'spree', github: 'spree/spree', branch: '3-0-stable'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '3-0-stable'
gem 'spree-refinerycms-authentication', github: 'bricesanchez/spree-refinery-authentication', branch: '3-0-stable'
bundle install
rails g spree:install

Change spree user_class in initializer to

Spree.user_class = "Spree::User"

Add Routes

root :to => "refinery/pages#home"
mount Spree::Core::Engine, :at => '/shop'
mount Refinery::Core::Engine, at: '/'

And

rails s

Interestingly, this does not happen when running the generator before the spree-refinerycms-authentication gem has been added.

Compatiblity Issue with Spree 3.7 and 4

When I add this extension to a Spree version 3.7 app an run the command bundle, I get this:

โžœ bundle 
Fetching https://github.com/refinerycms-contrib/spree-refinery-authentication.git
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "deface":
  In snapshot (Gemfile.lock):
    deface (= 1.5.3)

  In Gemfile:
    spree-refinerycms-authentication was resolved to 3.0.0, which depends on
      deface (~> 1.0.0)

    spree_gateway (~> 3.4) was resolved to 3.6.7, which depends on
      spree_core (>= 3.1.0, < 5.0) was resolved to 3.7.10, which depends on
        deface (~> 1.0)

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

How can I solve this Issue?

Edit:
This is what I added in my Gemfile looks like:

gem 'refinerycms', '~> 3.0.0'
gem 'spree-refinerycms-authentication', github: 'refinerycms-contrib/spree-refinery-authentication', branch: '3-0-stable'

Rails version: 5.2.4.1
Ruby: 2.5.1

Implicit Load Order dependency

app/decorators/controllers/spree/user_sessions_controller_decorator.rb and
app/decorators/controllers/spree/amin/user_sessions_controller_decorator.rb

both require that
app/decorators/controllers/action_controller_base_decorator.rb
is loaded first.

This normally seems to happen, but not in all cases. However I have machines with the same project setup where the following exception occurs:

[...]
.rbenv/versions/2.5.1/gemsets/rails52/bundler/gems/spree-refinery-authentication-da83d4dbd36b/app/decorators/controllers/spree/admin/user_sessions_controller_decorator.rb:2:in 'block in <main>'
[...]
/.rbenv/versions/2.5.1/gemsets/rails52/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:701:in 'block (2 levels) in skip_callback': Before process_action callback :detect_spreefinery_single_sign_on! has not been defined (ArgumentError)

Not sure how the load order of the classes in a gem are defined in Rails, however an explicit reference
require_relative '../../action_controller_base_decorator.rb'
in
app/decorators/controllers/spree/admin/user_sessions_controller_decorator.rb resolves the issue.

I think this can be resolved better, however, if a PR helps let me know.

Wrong default user

When we are not connected, Refinery use NilUser instead of Spree user

--- !ruby/object:Refinery::Core::NilUser {}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.