solidus_social 1.0.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.circleci/config.yml +35 -0
- data/.gem_release.yml +5 -0
- data/.gitignore +6 -8
- data/.rspec +3 -3
- data/.rubocop.yml +3 -7
- data/.rubocop_todo.yml +42 -0
- data/CHANGELOG.md +34 -4
- data/Gemfile +23 -0
- data/{LICENSE.md → LICENSE} +2 -2
- data/README.md +133 -78
- data/Rakefile +4 -13
- data/app/controllers/spree/admin/authentication_methods_controller.rb +2 -12
- data/app/controllers/spree/omniauth_callbacks_controller.rb +46 -42
- data/app/controllers/spree/user_authentications_controller.rb +3 -1
- data/app/core/spree/permission_sets/authentication_method_display.rb +11 -0
- data/app/core/spree/permission_sets/authentication_method_management.rb +11 -0
- data/app/decorators/controllers/solidus_social/spree/user_registrations_controller_decorator.rb +27 -0
- data/app/decorators/models/solidus_social/spree/user_decorator.rb +28 -0
- data/app/helpers/spree/omniauth_callbacks_helper.rb +2 -0
- data/app/models/spree/authentication_method.rb +8 -2
- data/app/models/spree/social_configuration.rb +3 -0
- data/app/models/spree/user_authentication.rb +3 -1
- data/app/overrides/add_authentications_to_account_summary.rb +2 -0
- data/app/overrides/admin_configuration_decorator.rb +9 -2
- data/app/overrides/user_registrations_decorator.rb +2 -0
- data/app/views/spree/admin/authentication_methods/_form.html.erb +6 -22
- data/app/views/spree/admin/authentication_methods/edit.html.erb +5 -3
- data/app/views/spree/admin/authentication_methods/index.html.erb +22 -18
- data/app/views/spree/admin/authentication_methods/new.html.erb +5 -3
- data/app/views/spree/shared/_social.html.erb +5 -5
- data/app/views/spree/shared/_user_form.html.erb +3 -3
- data/app/views/spree/users/_new-customer.html.erb +2 -2
- data/app/views/spree/users/_social.html.erb +24 -22
- data/bin/console +17 -0
- data/bin/rails +15 -4
- data/bin/rake +7 -0
- data/bin/sandbox +72 -0
- data/bin/setup +8 -0
- data/config/locales/en.yml +1 -0
- data/config/locales/es-MX.yml +8 -4
- data/config/locales/es.yml +30 -0
- data/config/locales/it.yml +26 -0
- data/config/routes.rb +7 -5
- data/db/migrate/20120120163432_create_user_authentications.rb +3 -1
- data/db/migrate/20120123163222_create_authentication_methods.rb +3 -1
- data/lib/generators/solidus_social/install/install_generator.rb +13 -5
- data/lib/generators/solidus_social/install/templates/config/initializers/solidus_social.rb +50 -0
- data/lib/solidus_social.rb +24 -8
- data/lib/solidus_social/engine.rb +29 -55
- data/lib/solidus_social/facebook_omniauth_strategy_ext.rb +25 -0
- data/lib/solidus_social/factories.rb +4 -0
- data/lib/solidus_social/version.rb +3 -16
- data/solidus_social.gemspec +43 -46
- data/spec/controllers/spree/omniauth_callbacks_controller_spec.rb +42 -9
- data/spec/features/spree/admin/authentication_methods_configuration_spec.rb +21 -27
- data/spec/features/spree/sign_in_spec.rb +27 -19
- data/spec/lib/solidus_social/engine_spec.rb +9 -0
- data/spec/lib/solidus_social_speec.rb +25 -0
- data/spec/lib/spree/social_config_spec.rb +11 -0
- data/spec/models/spree/authentication_method_spec.rb +19 -0
- data/spec/models/spree/social_configuration_spec.rb +6 -0
- data/spec/models/spree/user_decorator_spec.rb +25 -2
- data/spec/spec_helper.rb +17 -29
- data/spec/support/omniauth.rb +4 -0
- metadata +71 -198
- data/.hound.yml +0 -26
- data/.travis.yml +0 -19
- data/Guardfile +0 -10
- data/app/assets/javascripts/spree/backend/solidus_social.js +0 -1
- data/app/assets/javascripts/spree/frontend/solidus_social.js +0 -1
- data/app/assets/stylesheets/spree/backend/solidus_social.css +0 -3
- data/app/controllers/spree/user_registrations_controller_decorator.rb +0 -15
- data/app/models/spree/user_decorator.rb +0 -16
- data/app/views/spree/admin/shared/_configurations_menu.html.erb +0 -4
- data/config/initializers/devise.rb +0 -13
- data/spec/lib/spree_social/engine_spec.rb +0 -16
- data/spec/support/capybara.rb +0 -18
- data/spec/support/database_cleaner.rb +0 -24
- data/spec/support/devise.rb +0 -3
- data/spec/support/factory_girl.rb +0 -7
- data/spec/support/spree.rb +0 -8
data/.hound.yml
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
---
|
2
|
-
# Too picky.
|
3
|
-
LineLength:
|
4
|
-
Enabled: false
|
5
|
-
|
6
|
-
# This should truly be on for well documented gems.
|
7
|
-
Documentation:
|
8
|
-
Enabled: false
|
9
|
-
|
10
|
-
# Neatly aligned code is too swell.
|
11
|
-
SingleSpaceBeforeFirstArg:
|
12
|
-
Enabled: false
|
13
|
-
|
14
|
-
# Don't mess with RSpec DSL.
|
15
|
-
Blocks:
|
16
|
-
Exclude:
|
17
|
-
- 'spec/**/*'
|
18
|
-
|
19
|
-
# We really like the readability with newline in beginning of classes.
|
20
|
-
EmptyLinesAroundBlockBody:
|
21
|
-
Enabled: false
|
22
|
-
|
23
|
-
# Use nested module/class definitions instead of compact style.
|
24
|
-
# Too high git impact to change this now.
|
25
|
-
ClassAndModuleChildren:
|
26
|
-
Enabled: false
|
data/.travis.yml
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
---
|
2
|
-
language: ruby
|
3
|
-
rvm:
|
4
|
-
- 2.1
|
5
|
-
- 2.2
|
6
|
-
- '2.3.0'
|
7
|
-
env:
|
8
|
-
matrix:
|
9
|
-
- SOLIDUS_BRANCH=master
|
10
|
-
- SOLIDUS_BRANCH=v1.2
|
11
|
-
- SOLIDUS_BRANCH=v1.1
|
12
|
-
- SOLIDUS_BRANCH=v1.0
|
13
|
-
sudo: false
|
14
|
-
before_script:
|
15
|
-
- sh -e /etc/init.d/xvfb start
|
16
|
-
- export DISPLAY=:99.0
|
17
|
-
- bundle exec rake test_app
|
18
|
-
script:
|
19
|
-
- bundle exec rspec spec
|
data/Guardfile
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
guard 'rspec', cmd: 'bundle exec rspec' do
|
2
|
-
watch('spec/spec_helper.rb') { 'spec' }
|
3
|
-
watch('config/routes.rb') { 'spec/controllers' }
|
4
|
-
watch(%r{^spec/(.+)_spec\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
5
|
-
watch(%r{^app/(.+)_decorator\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
6
|
-
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
7
|
-
watch(%r{^app/(.*)(\.erb)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
8
|
-
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
9
|
-
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb" }
|
10
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
//= require spree/backend
|
@@ -1 +0,0 @@
|
|
1
|
-
//= require spree/frontend
|
@@ -1,15 +0,0 @@
|
|
1
|
-
Spree::UserRegistrationsController.class_eval do
|
2
|
-
after_action :clear_omniauth, only: :create
|
3
|
-
|
4
|
-
private
|
5
|
-
|
6
|
-
def build_resource(*args)
|
7
|
-
super
|
8
|
-
@spree_user.apply_omniauth(session[:omniauth]) if session[:omniauth]
|
9
|
-
@spree_user
|
10
|
-
end
|
11
|
-
|
12
|
-
def clear_omniauth
|
13
|
-
session[:omniauth] = nil unless @spree_user.new_record?
|
14
|
-
end
|
15
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
Spree.user_class.class_eval do
|
2
|
-
has_many :user_authentications, dependent: :destroy
|
3
|
-
|
4
|
-
devise :omniauthable
|
5
|
-
|
6
|
-
def apply_omniauth(omniauth)
|
7
|
-
if %w(facebook google_oauth2).include? omniauth['provider']
|
8
|
-
self.email = omniauth['info']['email'] if email.blank?
|
9
|
-
end
|
10
|
-
user_authentications.build(provider: omniauth['provider'], uid: omniauth['uid'])
|
11
|
-
end
|
12
|
-
|
13
|
-
def password_required?
|
14
|
-
(user_authentications.empty? || !password.blank?) && super
|
15
|
-
end
|
16
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
SolidusSocial::OAUTH_PROVIDERS.each do |provider|
|
2
|
-
SolidusSocial.init_provider(provider[1])
|
3
|
-
end
|
4
|
-
|
5
|
-
OmniAuth.config.logger = Logger.new(STDOUT)
|
6
|
-
OmniAuth.logger.progname = 'omniauth'
|
7
|
-
|
8
|
-
OmniAuth.config.on_failure = proc do |env|
|
9
|
-
env['devise.mapping'] = Devise.mappings[Spree.user_class.table_name.singularize.to_sym]
|
10
|
-
controller_name = ActiveSupport::Inflector.camelize(env['devise.mapping'].controllers[:omniauth_callbacks])
|
11
|
-
controller_klass = ActiveSupport::Inflector.constantize("#{controller_name}Controller")
|
12
|
-
controller_klass.action(:failure).call(env)
|
13
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
RSpec.describe SolidusSocial do
|
2
|
-
context 'constants' do
|
3
|
-
it { is_expected.to be_const_defined(:OAUTH_PROVIDERS) }
|
4
|
-
|
5
|
-
it 'contain all providers' do
|
6
|
-
oauth_providers = [
|
7
|
-
%w(Amazon amazon),
|
8
|
-
%w(Facebook facebook),
|
9
|
-
%w(Twitter twitter),
|
10
|
-
%w(Github github),
|
11
|
-
%w(Google google_oauth2)
|
12
|
-
]
|
13
|
-
expect(described_class::OAUTH_PROVIDERS).to match_array oauth_providers
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
data/spec/support/capybara.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'capybara/rspec'
|
2
|
-
require 'capybara/rails'
|
3
|
-
require 'capybara/poltergeist'
|
4
|
-
|
5
|
-
RSpec.configure do |config|
|
6
|
-
config.include Rack::Test::Methods, type: :requests
|
7
|
-
|
8
|
-
Capybara.javascript_driver = :poltergeist
|
9
|
-
Capybara.register_driver(:poltergeist) do |app|
|
10
|
-
Capybara::Poltergeist::Driver.new app, js_errors: true, timeout: 60
|
11
|
-
end
|
12
|
-
|
13
|
-
config.before(:each, :js) do
|
14
|
-
if Capybara.javascript_driver == :selenium
|
15
|
-
page.driver.browser.manage.window.maximize
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'database_cleaner'
|
2
|
-
|
3
|
-
RSpec.configure do |config|
|
4
|
-
|
5
|
-
config.before(:suite) do
|
6
|
-
DatabaseCleaner.clean_with :truncation
|
7
|
-
end
|
8
|
-
|
9
|
-
config.before do
|
10
|
-
DatabaseCleaner.strategy = :transaction
|
11
|
-
end
|
12
|
-
|
13
|
-
config.before(:each, :js) do
|
14
|
-
DatabaseCleaner.strategy = :truncation
|
15
|
-
end
|
16
|
-
|
17
|
-
config.before do
|
18
|
-
DatabaseCleaner.start
|
19
|
-
end
|
20
|
-
|
21
|
-
config.after do
|
22
|
-
DatabaseCleaner.clean
|
23
|
-
end
|
24
|
-
end
|
data/spec/support/devise.rb
DELETED
data/spec/support/spree.rb
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
require 'spree/testing_support/factories'
|
2
|
-
require 'spree/testing_support/authorization_helpers'
|
3
|
-
require 'spree/testing_support/url_helpers'
|
4
|
-
require 'spree/testing_support/capybara_ext'
|
5
|
-
|
6
|
-
RSpec.configure do |config|
|
7
|
-
config.include Spree::TestingSupport::UrlHelpers
|
8
|
-
end
|