solidus_social 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1877be6601ecd77f99eb28f6bb0ddf0b6b702cb80a7ca163f5472f5a34a3937f
4
- data.tar.gz: 9ac2438fad599892a90abde85e1d20bed50641e0a5661c906e8950436fa52041
3
+ metadata.gz: 8f6748bb52dec9c0adf020256d086ea0d55190ed7922d3a6d2def8061763ef5f
4
+ data.tar.gz: 13ea181f254b90bbbdf1c0c100e738cc28a1621f40a3843cd1ca929877f59cee
5
5
  SHA512:
6
- metadata.gz: c3c7b24eee76fbe4a361c6da83ad7e3f4d88e78b4686db243b6ec995a48454929ef9bb00e92d987994a0b7bbb6cae1e10598f75cb10a82ec30225c5c16208c22
7
- data.tar.gz: e96864533c0a6d567afef96682601126ce50591f99d179205e9e8420ab6942b0e58ffb9e2b39eccdbc7de119cbbc182cb3366d290e025e42c051c15298b70e85
6
+ metadata.gz: d1c34977fa94f9bfed99c58ab509f891fe2e3b47c10a8ac1a8acce57fdd235c615428a475d5d0c8083828887ca53fd5fdd4bc4341b1b40a47e8af5358b9d52e5
7
+ data.tar.gz: 4a8f38b3f9ec00f1c742425d25d6004586aeca3f7577d971cd3cf107fa6e534b6a466788771571824828b951024dfded8d55fddff43de7e22cd00b45853d384d
data/.circleci/config.yml CHANGED
@@ -1,7 +1,6 @@
1
1
  version: 2.1
2
2
 
3
3
  orbs:
4
- browser-tools: circleci/browser-tools@1.4
5
4
  # Always take the latest version of the orb, this allows us to
6
5
  # run specs against Solidus supported versions only without the need
7
6
  # to change this configuration every time a Solidus version is released
@@ -9,30 +8,55 @@ orbs:
9
8
  solidusio_extensions: solidusio/extensions@volatile
10
9
 
11
10
  jobs:
12
- run-specs-with-postgres:
13
- executor: solidusio_extensions/postgres
11
+ run-specs:
12
+ parameters:
13
+ solidus:
14
+ type: string
15
+ default: main
16
+ db:
17
+ type: string
18
+ default: "postgres"
19
+ ruby:
20
+ type: string
21
+ default: "3.2"
22
+ executor:
23
+ name: solidusio_extensions/<< parameters.db >>
24
+ ruby_version: << parameters.ruby >>
14
25
  steps:
15
- - browser-tools/install-browser-tools
16
- - solidusio_extensions/run-tests
17
- run-specs-with-mysql:
18
- executor: solidusio_extensions/mysql
19
- steps:
20
- - browser-tools/install-browser-tools
21
- - solidusio_extensions/run-tests
26
+ - checkout
27
+ - solidusio_extensions/run-tests-solidus-<< parameters.solidus >>
22
28
 
23
29
  workflows:
24
30
  "Run specs on supported Solidus versions":
25
31
  jobs:
26
- - run-specs-with-postgres
27
- - run-specs-with-mysql
28
- "Weekly run specs against master":
32
+ - run-specs:
33
+ name: &name "run-specs-solidus-<< matrix.solidus >>-ruby-<< matrix.ruby >>-db-<< matrix.db >>"
34
+ matrix:
35
+ parameters: { solidus: ["main"], ruby: ["3.2"], db: ["postgres"] }
36
+ - run-specs:
37
+ name: *name
38
+ matrix:
39
+ parameters: { solidus: ["current"], ruby: ["3.1"], db: ["mysql"] }
40
+ - run-specs:
41
+ name: *name
42
+ matrix:
43
+ parameters: { solidus: ["older"], ruby: ["3.0"], db: ["sqlite"] }
44
+
45
+ "Weekly run specs against main":
29
46
  triggers:
30
47
  - schedule:
31
48
  cron: "0 0 * * 4" # every Thursday
32
49
  filters:
33
50
  branches:
34
51
  only:
35
- - master
52
+ - main
36
53
  jobs:
37
- - run-specs-with-postgres
38
- - run-specs-with-mysql
54
+ - run-specs:
55
+ name: *name
56
+ matrix:
57
+ parameters: { solidus: ["main"], ruby: ["3.2"], db: ["postgres"] }
58
+ - run-specs:
59
+ name: *name
60
+ matrix:
61
+ parameters: { solidus: ["current"], ruby: ["3.1"], db: ["mysql"] }
62
+
data/CHANGELOG.md CHANGED
@@ -1,35 +1 @@
1
- ## Unreleased
2
-
3
- ## v1.3.0
4
-
5
- - Migrated factories from FactoryGirl to FactoryBot
6
- - Add support for Solidus 2.4+
7
- - Reduced compatible versions of `solidus_core` to 2.x
8
- - Removed the deprecated `icon:` argument from admin buttons
9
- - Fixed an issue when using Safari to authenticate
10
- - `Spree::UserRegistrationsController` and `Spree.user_class` are now decorated by
11
- prepending modules in the `SolidusSocial::Spree` namespace instead of using `class_eval`
12
- - Development of the extension is not relying on `solidus_dev_support` and CircleCI
13
- - Moved the Facebook strategy patch to it's own prepended module
14
-
15
- ## v1.2.0
16
-
17
- - Switched to using the install generator to import the solidus social
18
- initializer into apps. **Please run `bin/rails generate solidus_social:install`
19
- in order to upgrade.**
20
- - Removed the `SolidusSocial::OAUTH_PROVIDERS` constant in favour of
21
- the `Spree::AuthenticationMethod.providers_options` class
22
- method. This is populated using the `Spree::SocialConfig#providers` Hash.
23
- - Added support for Rails 5.1.
24
- - Added Italian translations
25
-
26
- ## v1.1.0
27
-
28
- - Added support for Solidus 2/Rails 5
29
- - Bugfixes
30
-
31
- ## v1.0.0
32
-
33
- - Renamed SpreeSocial to SolidusSocial
34
- - Relaxed versions to support solidus 1.0+
35
- - Port of https://github.com/DynamoMTL/spree_social's solidus branch
1
+ See https://github.com/solidusio-contrib/solidus_social/releases or [OLD_CHANGELOG.md](OLD_CHANGELOG.md) for older versions.
data/Gemfile CHANGED
@@ -3,14 +3,17 @@
3
3
  source 'https://rubygems.org'
4
4
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
5
5
 
6
- branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
7
- solidus_git, solidus_frontend_git = if (branch == 'master') || (branch >= 'v3.2')
8
- %w[solidusio/solidus solidusio/solidus_frontend]
9
- else
10
- %w[solidusio/solidus] * 2
11
- end
12
- gem 'solidus', github: solidus_git, branch: branch
13
- gem 'solidus_frontend', github: solidus_frontend_git, branch: branch
6
+ branch = ENV.fetch('SOLIDUS_BRANCH', 'main')
7
+ gem 'solidus', github: 'solidusio/solidus', branch: branch
8
+
9
+ # The solidus_frontend gem has been pulled out since v3.2
10
+ if branch >= 'v3.2'
11
+ gem 'solidus_frontend'
12
+ elsif branch == 'main'
13
+ gem 'solidus_frontend', github: 'solidusio/solidus_frontend'
14
+ else
15
+ gem 'solidus_frontend', github: 'solidusio/solidus', branch: branch
16
+ end
14
17
 
15
18
  # Needed to help Bundler figure out how to resolve dependencies,
16
19
  # otherwise it takes forever to resolve them.
data/OLD_CHANGELOG.md ADDED
@@ -0,0 +1,35 @@
1
+ ## Unreleased
2
+
3
+ ## v1.3.0
4
+
5
+ - Migrated factories from FactoryGirl to FactoryBot
6
+ - Add support for Solidus 2.4+
7
+ - Reduced compatible versions of `solidus_core` to 2.x
8
+ - Removed the deprecated `icon:` argument from admin buttons
9
+ - Fixed an issue when using Safari to authenticate
10
+ - `Spree::UserRegistrationsController` and `Spree.user_class` are now decorated by
11
+ prepending modules in the `SolidusSocial::Spree` namespace instead of using `class_eval`
12
+ - Development of the extension is not relying on `solidus_dev_support` and CircleCI
13
+ - Moved the Facebook strategy patch to it's own prepended module
14
+
15
+ ## v1.2.0
16
+
17
+ - Switched to using the install generator to import the solidus social
18
+ initializer into apps. **Please run `bin/rails generate solidus_social:install`
19
+ in order to upgrade.**
20
+ - Removed the `SolidusSocial::OAUTH_PROVIDERS` constant in favour of
21
+ the `Spree::AuthenticationMethod.providers_options` class
22
+ method. This is populated using the `Spree::SocialConfig#providers` Hash.
23
+ - Added support for Rails 5.1.
24
+ - Added Italian translations
25
+
26
+ ## v1.1.0
27
+
28
+ - Added support for Solidus 2/Rails 5
29
+ - Bugfixes
30
+
31
+ ## v1.0.0
32
+
33
+ - Renamed SpreeSocial to SolidusSocial
34
+ - Relaxed versions to support solidus 1.0+
35
+ - Port of https://github.com/DynamoMTL/spree_social's solidus branch
data/Rakefile CHANGED
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'bundler/gem_tasks'
4
+
3
5
  require 'solidus_dev_support/rake_tasks'
4
6
  SolidusDevSupport::RakeTasks.install
5
7
 
@@ -1,5 +1,5 @@
1
1
  <div data-hook="admin_social_methods_form_fields" class="row">
2
- <div class="alpha five columns">
2
+ <div class="col-4">
3
3
  <div data-hook="environment" class="field">
4
4
  <%= f.field_container :environment do %>
5
5
  <%= label_tag nil, Spree::AuthenticationMethod.human_attribute_name(:environment) %>
@@ -7,7 +7,7 @@
7
7
  <% end %>
8
8
  </div>
9
9
  </div>
10
- <div class="alpha five columns">
10
+ <div class="col-4">
11
11
  <div data-hook="environment" class="field">
12
12
  <%= f.field_container :provider do %>
13
13
  <%= f.label :provider, I18n.t('spree.social_provider') %>
@@ -15,14 +15,12 @@
15
15
  <% end %>
16
16
  </div>
17
17
  </div>
18
- <div class="alpha five columns">
18
+ <div class="col-4">
19
19
  <div data-hook="environment" class="field">
20
20
  <%= f.field_container :active do %>
21
- <span style="padding:0 10px 2px;"><%= f.label :active, I18n.t('spree.active') %></span>
22
- <%= f.radio_button :active, :true %>
23
- <span style="padding:0 2px;"><%= I18n.t('spree.say_yes') %></span>
24
- <%= f.radio_button :active, :false %>
25
- <span style="padding:0 2px"><%= I18n.t('spree.say_no') %></span>
21
+ <%= f.label :active, I18n.t('spree.active') %><br>
22
+ <%= f.radio_button :active, :true %><span style="padding:0 2px;"><%= I18n.t('spree.say_yes') %></span>
23
+ <%= f.radio_button :active, :false %><span style="padding:0 2px"><%= I18n.t('spree.say_no') %></span>
26
24
  <% end %>
27
25
  </div>
28
26
  </div>
@@ -1,13 +1,11 @@
1
1
  <%= render 'spree/admin/shared/configuration_menu' %>
2
2
 
3
+ <% admin_breadcrumb(link_to I18n.t('spree.social_authentication_methods'), spree.admin_authentication_methods_path) %>
4
+
3
5
  <% content_for :page_title do %>
4
6
  <%= I18n.t('spree.edit_social_method') %>
5
7
  <% end %>
6
8
 
7
- <% content_for :page_actions do %>
8
- <li><%= link_to_with_icon 'icon-arrow-left', I18n.t('spree.back_to_authentication_methods_list'), admin_authentication_methods_path, class: 'button' %></li>
9
- <% end %>
10
-
11
9
  <%= render 'spree/shared/error_messages', target: @authentication_method %>
12
10
 
13
11
  <%= form_for [:admin, @authentication_method] do |f| %>
@@ -8,7 +8,7 @@
8
8
  <% if can? :manage, Spree::AuthenticationMethod %>
9
9
  <ul class="actions inline-menu">
10
10
  <li>
11
- <%= link_to I18n.t('spree.new_social_method'), new_object_url, id: 'admin_new_slide_link' %>
11
+ <%= link_to I18n.t('spree.new_social_method'), new_object_url, id: 'admin_new_slide_link', class: "btn btn-primary" %>
12
12
  </li>
13
13
  </ul>
14
14
  <% end %>
@@ -29,17 +29,17 @@
29
29
  <th><%= I18n.t('spree.social_api_key') %></th>
30
30
  <th><%= I18n.t('spree.social_api_secret') %></th>
31
31
  <th><%= I18n.t('spree.environment') %></th>
32
- <th><%= I18n.t('spree.active') %></th>
32
+ <th class="align-right"><%= I18n.t('spree.active') %></th>
33
33
  <th data-hook="admin_social_methods_index_header_actions" class="actions"></th>
34
34
  </thead>
35
35
  <tbody>
36
36
  <% @authentication_methods.each do |method|%>
37
37
  <tr id="<%= dom_id method %>" data-hook="admin_trackers_index_rows">
38
- <td class="align-center"><%= method.provider %></td>
39
- <td class="align-center"><%= truncate method.api_key, length: 10 %></td>
40
- <td class="align-center"><%= truncate method.api_secret, length: 10 %></td>
41
- <td class="align-center"><%= method.environment.to_s.titleize %></td>
42
- <td class="align-center"><%= method.active ? I18n.t('spree.yes') : I18n.t('spree.no') %></td>
38
+ <td><%= method.provider %></td>
39
+ <td><%= truncate method.api_key, length: 10 %></td>
40
+ <td><%= truncate method.api_secret, length: 10 %></td>
41
+ <td><%= method.environment.to_s.titleize %></td>
42
+ <td class="align-right"><%= method.active ? I18n.t('spree.say_yes') : I18n.t('spree.say_no') %></td>
43
43
  <td class="actions">
44
44
  <% if can? :manage, Spree::AuthenticationMethod %>
45
45
  <%= link_to_edit method, no_text: true %>
@@ -1,13 +1,11 @@
1
1
  <%= render 'spree/admin/shared/configuration_menu' %>
2
2
 
3
+ <% admin_breadcrumb(link_to I18n.t('spree.social_authentication_methods'), spree.admin_authentication_methods_path) %>
4
+
3
5
  <% content_for :page_title do %>
4
6
  <%= I18n.t('spree.new_social_method') %>
5
7
  <% end %>
6
8
 
7
- <% content_for :page_actions do %>
8
- <li><%= link_to_with_icon 'icon-arrow-left', I18n.t('spree.back_to_authentication_methods_list'), admin_authentication_methods_path, class: 'button' %></li>
9
- <% end %>
10
-
11
9
  <%= render 'spree/shared/error_messages', target: @authentication_method %>
12
10
 
13
11
  <%= form_for [:admin, @authentication_method] do |f| %>
@@ -8,7 +8,6 @@ en:
8
8
  add_another_service: "Add another service to sign in with:"
9
9
  authentications:
10
10
  destroy: 'Successfully destroyed authentication method.'
11
- back_to_authentication_methods_list: "Back To Authentication Methods List"
12
11
  edit_social_method: "Editing Social Authentication Method"
13
12
  environment: "Environment"
14
13
  new_social_method: "New Authentication Method"
@@ -25,6 +25,10 @@ Spree::SocialConfig.configure do |config|
25
25
  google_oauth2: {
26
26
  api_key: ENV['GOOGLE_OAUTH2_API_KEY'],
27
27
  api_secret: ENV['GOOGLE_OAUTH2_API_SECRET'],
28
+ },
29
+ twitter2: {
30
+ api_key: ENV['TWITTER_API_KEY'],
31
+ api_secret: ENV['TWITTER_API_SECRET']
28
32
  }
29
33
  }
30
34
  end
@@ -3,6 +3,7 @@
3
3
  require 'omniauth-facebook'
4
4
  require 'omniauth-github'
5
5
  require 'omniauth-google-oauth2'
6
+ require 'omniauth/twitter2'
6
7
  require 'omniauth/rails_csrf_protection'
7
8
  require 'deface'
8
9
  require 'spree/core'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusSocial
4
- VERSION = '1.5.0'
4
+ VERSION = '1.6.0'
5
5
  end
@@ -35,8 +35,9 @@ Gem::Specification.new do |spec|
35
35
  spec.add_dependency 'omniauth-github'
36
36
  spec.add_dependency 'omniauth-google-oauth2'
37
37
  spec.add_dependency 'omniauth-rails_csrf_protection'
38
+ spec.add_dependency 'omniauth-twitter2'
38
39
  spec.add_dependency 'solidus_auth_devise'
39
- spec.add_dependency 'solidus_core', ['>= 2.0.0', '< 4']
40
+ spec.add_dependency 'solidus_core', '>= 2.0.0', '< 5'
40
41
  spec.add_dependency 'solidus_support', '~> 0.5'
41
42
 
42
43
  spec.add_development_dependency 'solidus_dev_support'
@@ -22,7 +22,6 @@ RSpec.describe 'Admin Authentication Methods', :js do
22
22
  expect(page).to have_text 'No Authentication Methods Found, Add One!'
23
23
 
24
24
  click_link 'New Authentication Method'
25
- expect(page).to have_link 'Back To Authentication Methods List'
26
25
  select2 'Test', from: 'Environment'
27
26
  select2 'Github', from: 'Social Provider'
28
27
 
@@ -156,4 +156,38 @@ RSpec.describe 'Signing in using Omniauth', :js do
156
156
  expect(page).not_to have_selector 'div#social-signin-links'
157
157
  end
158
158
  end
159
+
160
+ context 'twitter' do
161
+ before do
162
+ Spree::AuthenticationMethod.create!(
163
+ provider: 'twitter2',
164
+ api_key: 'fake',
165
+ api_secret: 'fake',
166
+ environment: Rails.env,
167
+ active: true
168
+ )
169
+ OmniAuth.config.test_mode = true
170
+ OmniAuth.config.mock_auth[:twitter2] = {
171
+ 'provider' => 'twitter2',
172
+ 'uid' => '123545',
173
+ 'info' => {
174
+ 'name' => 'mockuser',
175
+ 'image' => 'mock_user_thumbnail_url'
176
+ },
177
+ 'credentials' => {
178
+ 'token' => 'mock_token',
179
+ 'secret' => 'mock_secret'
180
+ }
181
+ }
182
+ end
183
+
184
+ it 'going to sign in' do
185
+ visit spree.login_path
186
+ click_on 'Login with twitter'
187
+ expect(page).to have_text 'Please confirm your email address to continue'.upcase
188
+ fill_in 'Email', with: 'user@example.com'
189
+ click_button 'Create'
190
+ expect(page).to have_text 'Welcome! You have signed up successfully.'
191
+ end
192
+ end
159
193
  end
@@ -5,7 +5,8 @@ RSpec.describe Spree::SocialConfig do
5
5
  expect { subject.path_prefix = 'customer' }.not_to change(Spree::Preference, :count)
6
6
  end
7
7
 
8
- it "holds configuration for the five default providers" do
9
- expect(subject.providers.keys).to match_array([:facebook, :github, :google_oauth2])
8
+ it "holds configuration for default providers" do
9
+ providers = %i[facebook github google_oauth2 twitter2]
10
+ expect(subject.providers.keys).to match_array(providers)
10
11
  end
11
12
  end
@@ -8,7 +8,8 @@ RSpec.describe Spree::AuthenticationMethod do
8
8
  [
9
9
  %w(Facebook facebook),
10
10
  %w(Github github),
11
- %w(Google google_oauth2)
11
+ %w(Google google_oauth2),
12
+ %w(Twitter2 twitter2)
12
13
  ]
13
14
  end
14
15
 
data/spec/spec_helper.rb CHANGED
@@ -11,13 +11,12 @@ require File.expand_path('dummy/config/environment.rb', __dir__)
11
11
  # Requires factories and other useful helpers defined in spree_core.
12
12
  require 'solidus_dev_support/rspec/feature_helper'
13
13
 
14
+ SolidusDevSupport::TestingSupport::Factories.load_for(SolidusSocial::Engine, Spree::Auth::Engine)
15
+
14
16
  # Requires supporting ruby files with custom matchers and macros, etc,
15
17
  # in spec/support/ and its subdirectories.
16
18
  Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
17
19
 
18
- # Requires factories defined in lib/solidus_social/factories.rb
19
- require 'solidus_social/factories'
20
-
21
20
  RSpec.configure do |config|
22
21
  config.infer_spec_type_from_file_location!
23
22
  config.use_transactional_fixtures = false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_social
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Dyer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-30 00:00:00.000000000 Z
11
+ date: 2023-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: omniauth-twitter2
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: solidus_auth_devise
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -131,7 +145,7 @@ dependencies:
131
145
  version: 2.0.0
132
146
  - - "<"
133
147
  - !ruby/object:Gem::Version
134
- version: '4'
148
+ version: '5'
135
149
  type: :runtime
136
150
  prerelease: false
137
151
  version_requirements: !ruby/object:Gem::Requirement
@@ -141,7 +155,7 @@ dependencies:
141
155
  version: 2.0.0
142
156
  - - "<"
143
157
  - !ruby/object:Gem::Version
144
- version: '4'
158
+ version: '5'
145
159
  - !ruby/object:Gem::Dependency
146
160
  name: solidus_support
147
161
  requirement: !ruby/object:Gem::Requirement
@@ -187,6 +201,7 @@ files:
187
201
  - CONTRIBUTING.md
188
202
  - Gemfile
189
203
  - LICENSE
204
+ - OLD_CHANGELOG.md
190
205
  - README.md
191
206
  - Rakefile
192
207
  - app/assets/stylesheets/spree/frontend/fontello.css
@@ -271,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
286
  - !ruby/object:Gem::Version
272
287
  version: '0'
273
288
  requirements: []
274
- rubygems_version: 3.3.17
289
+ rubygems_version: 3.4.20
275
290
  signing_key:
276
291
  specification_version: 4
277
292
  summary: Adds social network login services (OAuth) to Solidus