omniauth-mlh 1.0.0 → 1.0.1

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: 622c9053382357ade0f161e78ed3f13ae01ae9f939b9bae87b43ff3281b618e2
4
- data.tar.gz: bc057ee83655fcac77978e15a21891013981853cebc8e7c235d08601468d8156
3
+ metadata.gz: a8a63e3530dc45956b6373c50995939ce8ea698a3118c473a0a5d497fb75ed55
4
+ data.tar.gz: 14a9fa6f3ee6eb9d26b4496fe0678f17aa805eaf1b15457cc13f172e698ada6e
5
5
  SHA512:
6
- metadata.gz: b4cd23553337c4dc6537a4c432c61d00f84334cd0d0372d7c3148b0c85bf175834a97ac9e213623e17541349f16b15e4489bfe0f8658302ae7fc01d71e4ad76f
7
- data.tar.gz: fb197ac156fb8a6ff76c8ce5b7e01ba016ff3859ad3741cd10da11932c274c7dc33c0f1dffbc766e0479cc4607d29621267e942ed1d26f22df37bdbb8f432050
6
+ metadata.gz: 525b5b9983beda5ed9c922e451430f7c6ead1d3ce508fddfd6f2616eab46de12772540d4252a1db6ed632b39a6b388ce35dbb3ba28ef108633f7e38bd3a73102
7
+ data.tar.gz: 9ec5f8644840ceeb01267be362bf26f7cec1e36853611c718ffe46b9a2e48fb9b6c0804c242c65f8612dfde7da80915bbd5d940bcee63c06e6dcf1a25c47ac12
@@ -0,0 +1,30 @@
1
+ name: Push Gem
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - v*
7
+
8
+ jobs:
9
+ build:
10
+ name: Build + Publish
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - uses: actions/checkout@v3
15
+ - name: Set up Ruby 3.2
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: '3.2'
19
+ bundler-cache: true
20
+
21
+ - name: Publish to RubyGems
22
+ run: |
23
+ mkdir -p $HOME/.gem
24
+ touch $HOME/.gem/credentials
25
+ chmod 0600 $HOME/.gem/credentials
26
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
27
+ gem build *.gemspec
28
+ gem push *.gem
29
+ env:
30
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"
@@ -0,0 +1,30 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - 'main'
7
+ pull_request:
8
+ branches:
9
+ - 'main'
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ ruby: ['2.7', '3.2']
17
+ steps:
18
+ - uses: actions/checkout@v2
19
+ - name: Set up Ruby ${{ matrix.ruby }}
20
+ uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby }}
23
+ - name: Install dependencies
24
+ run: |
25
+ gem install bundler
26
+ bundle install
27
+ - name: Run Spec
28
+ run: bundle exec rake spec
29
+ - name: Run Rubocop
30
+ run: bundle exec rake rubocop
data/.rubocop.yml CHANGED
@@ -1,12 +1,28 @@
1
- AllCops:
2
- TargetRubyVersion: '2.2.0'
1
+ require:
2
+ - rubocop-rspec
3
+ - rubocop-performance
3
4
 
4
- Naming/FileName:
5
+ AllCops:
6
+ # Ruby 2.7 is the MINIMUM Ruby version supported
7
+ TargetRubyVersion: '2.7.0'
5
8
  Exclude:
6
- - 'lib/omniauth-mlh.rb'
9
+ - vendor/**/*
7
10
 
8
- Metrics/BlockLength:
9
- Exclude:
10
- - 'Rakefile'
11
- - '**/*.rake'
12
- - 'spec/**/*'
11
+ Style/WordArray:
12
+ Description: Force arrays of words to use bracket notation instead of %w
13
+ EnforcedStyle: brackets
14
+ Enabled: true
15
+
16
+ Style/SymbolArray:
17
+ Description: Force symbol arrays to use bracket notation instead of %i
18
+ EnforcedStyle: brackets
19
+ Enabled: true
20
+
21
+ Style/RegexpLiteral:
22
+ Description: Allow forward slashes within regular expressions
23
+ AllowInnerSlashes: true
24
+ Enabled: true
25
+
26
+ RSpec/MultipleExpectations:
27
+ Description: Allow tests to contain multiple expectations
28
+ Enabled: false
data/.travis.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 3.0.5
3
+ - 2.2.0
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,27 @@
1
+ # Contributing Guidelines
2
+
3
+ Thank you for considering contributing to omniauth-mlh.
4
+
5
+ ## Contributor Checklist
6
+
7
+ - Fork the Repo ( https://github.com/mlh/omniauth-mlh/fork )
8
+ - Create your feature branch (`git checkout -b my-new-feature`)
9
+ - Commit your changes (`git commit -am 'Add some feature'`)
10
+ - Push to the branch (`git push origin my-new-feature`)
11
+ - Create a new Pull Request
12
+
13
+ ### Running tests
14
+
15
+ Following command can be used to run the test
16
+
17
+ ```bash
18
+ $ bundle exec rake spec
19
+ ```
20
+
21
+ ## Code quality tools
22
+
23
+ Code quality is enforced across the entire gem with Rubocop:
24
+
25
+ ```bash
26
+ $ bundle exec rubocop
27
+ ```
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in omniauth-mlh.gemspec
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # MLH/my-mlh-omniauth
1
+ # MLH/omniauth-mlh
2
2
 
3
- [![Build Status](https://travis-ci.org/MLH/my-mlh-omniauth.svg?branch=master)](https://travis-ci.org/MLH/my-mlh-omniauth)
3
+ [![Test](https://github.com/MLH/omniauth-mlh/actions/workflows/test.yml/badge.svg)](https://github.com/MLH/omniauth-mlh/actions/workflows/test.yml)
4
4
 
5
5
  This is the official [OmniAuth](https://github.com/omniauth/omniauth) strategy for
6
6
  authenticating with [MyMLH](https://my.mlh.io). To use it, you'll need to
@@ -12,7 +12,8 @@ Once you have done so, you can follow the instructions below:
12
12
 
13
13
  ## Requirements
14
14
 
15
- You need to have at least Ruby 3.0.5 to use this gem.
15
+ This Gem requires your Ruby version to be at least `2.2.0`, which is set
16
+ downstream by [Omniauth](https://github.com/omniauth/omniauth/blob/master/omniauth.gemspec#L22).
16
17
 
17
18
  ## Installation
18
19
 
@@ -50,11 +51,7 @@ end
50
51
 
51
52
  ## Contributing
52
53
 
53
- 1. Fork it ( https://github.com/mlh/my-mlh-omniauth/fork )
54
- 2. Create your feature branch (`git checkout -b my-new-feature`)
55
- 3. Commit your changes (`git commit -am 'Add some feature'`)
56
- 4. Push to the branch (`git push origin my-new-feature`)
57
- 5. Create a new Pull Request
54
+ For guidance on setting up a development environment and how to make a contribution to omniauth-mlh, see the [contributing guidelines](https://github.com/MLH/omniauth-mlh/blob/main/CONTRIBUTING.md).
58
55
 
59
56
  ## Credit
60
57
 
data/Rakefile CHANGED
@@ -1,8 +1,12 @@
1
1
  #!/usr/bin/env rake
2
+ # frozen_string_literal: true
3
+
2
4
  require 'bundler/gem_tasks'
3
5
  require 'rspec/core/rake_task'
6
+ require 'rubocop/rake_task'
4
7
 
5
8
  RSpec::Core::RakeTask.new
9
+ RuboCop::RakeTask.new
6
10
 
7
11
  desc 'Run specs'
8
12
  task default: :spec
@@ -48,5 +48,5 @@ module OmniAuth
48
48
  end
49
49
 
50
50
  OmniAuth.config.add_camelization 'mlh', 'MLH'
51
- OmniAuth.config.allowed_request_methods = %i[post get]
51
+ OmniAuth.config.allowed_request_methods = [:post, :get]
52
52
  OmniAuth.config.silence_get_warning = true
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module MLH
5
- VERSION = '1.0.0'
5
+ VERSION = '1.0.1'
6
6
  end
7
7
  end
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support'
4
3
  require 'omniauth-mlh/version'
5
4
  require 'omniauth/strategies/mlh'
data/omniauth-mlh.gemspec CHANGED
@@ -8,15 +8,15 @@ require 'omniauth-mlh/version'
8
8
  Gem::Specification.new do |spec|
9
9
  spec.name = 'omniauth-mlh'
10
10
  spec.version = OmniAuth::MLH::VERSION
11
- spec.authors = ['Swift']
12
- spec.email = ['swift@mlh.io']
11
+ spec.authors = ['Major League Hacking (MLH)']
12
+ spec.email = ['hi@mlh.io']
13
13
 
14
14
  spec.summary = 'Official OmniAuth strategy for MyMLH.'
15
15
  spec.description = 'Official OmniAuth strategy for MyMLH.'
16
16
  spec.homepage = 'http://github.com/mlh/omniauth-mlh'
17
17
  spec.license = 'MIT'
18
18
 
19
- spec.required_ruby_version = '>= 2.2.0'
19
+ spec.required_ruby_version = '>= 2.7.0'
20
20
 
21
21
  spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
22
22
  spec.files = `git ls-files`.split("\n")
@@ -26,13 +26,13 @@ Gem::Specification.new do |spec|
26
26
  spec.add_dependency 'oauth2', '~> 2.0.9'
27
27
  spec.add_dependency 'omniauth', '~> 2.1.1'
28
28
  spec.add_dependency 'omniauth-oauth2', '~> 1.8.0'
29
- spec.add_dependency 'omniauth-rails_csrf_protection', '~> 1.0.1'
30
-
31
- spec.add_dependency 'activesupport'
32
29
 
33
30
  spec.add_development_dependency 'rack-test'
34
- spec.add_development_dependency 'rake', '~> 10.5'
35
- spec.add_development_dependency 'rspec', '~> 2.7'
31
+ spec.add_development_dependency 'rake', '~> 12.3.3'
32
+ spec.add_development_dependency 'rspec', '~> 3.10'
33
+ spec.add_development_dependency 'rubocop', '~> 1.0'
34
+ spec.add_development_dependency 'rubocop-performance'
35
+ spec.add_development_dependency 'rubocop-rspec'
36
36
  spec.add_development_dependency 'simplecov'
37
37
  spec.add_development_dependency 'webmock'
38
38
  end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe OmniAuth::MLH do
6
+ subject(:omniauth_mlh) do
7
+ # The instance variable @options is being used to pass options to the subject of the shared examples
8
+ OmniAuth::Strategies::MLH.new(nil, @options || {}) # rubocop:disable RSpec/InstanceVariable
9
+ end
10
+
11
+ it_behaves_like 'an oauth2 strategy'
12
+
13
+ describe '#client' do
14
+ it 'has correct MyMLH site' do
15
+ expect(omniauth_mlh.client.site).to eq('https://my.mlh.io')
16
+ end
17
+
18
+ it 'has correct authorize url' do
19
+ expect(omniauth_mlh.client.options[:authorize_url]).to eq('oauth/authorize')
20
+ end
21
+
22
+ it 'has correct token url' do
23
+ expect(omniauth_mlh.client.options[:token_url]).to eq('oauth/token')
24
+ end
25
+
26
+ it 'runs the setup block if passed one' do
27
+ counter = ''
28
+ @options = { setup: proc { |_env| counter = 'ok' } }
29
+ omniauth_mlh.setup_phase
30
+ expect(counter).to eq('ok')
31
+ end
32
+ end
33
+
34
+ describe '#callback_path' do
35
+ it 'has the correct callback path' do
36
+ expect(omniauth_mlh.callback_path).to eq('/auth/mlh/callback')
37
+ end
38
+ end
39
+ end
data/spec/spec_helper.rb CHANGED
@@ -10,7 +10,7 @@ require 'rspec'
10
10
  require 'rack/test'
11
11
  require 'webmock/rspec'
12
12
  require 'omniauth'
13
- require 'omniauth-mlh'
13
+ require 'omniauth_mlh'
14
14
 
15
15
  Dir[File.expand_path('support/**/*', __dir__)].sort.each { |f| require f }
16
16
 
@@ -5,35 +5,40 @@
5
5
 
6
6
  shared_examples 'an oauth2 strategy' do
7
7
  describe '#client' do
8
- it 'should be initialized with symbolized client_options' do
8
+ it 'is initialized with symbolized client_options' do
9
9
  @options = { client_options: { 'authorize_url' => 'https://example.com' } }
10
+
10
11
  expect(subject.client.options[:authorize_url]).to eq('https://example.com')
11
12
  end
12
13
  end
13
14
 
14
15
  describe '#authorize_params' do
15
- it 'should include any authorize params passed in the :authorize_params option' do
16
+ it 'includes any authorize params passed in the :authorize_params option' do
16
17
  @options = { authorize_params: { foo: 'bar', baz: 'zip' } }
18
+
17
19
  expect(subject.authorize_params['foo']).to eq('bar')
18
20
  expect(subject.authorize_params['baz']).to eq('zip')
19
21
  end
20
22
 
21
- it 'should include top-level options that are marked as :authorize_options' do
22
- @options = { authorize_options: %i[scope foo], scope: 'bar', foo: 'baz' }
23
+ it 'includes top-level options that are marked as :authorize_options' do
24
+ @options = { authorize_options: ['scope', 'foo'], scope: 'bar', foo: 'baz' }
25
+
23
26
  expect(subject.authorize_params['scope']).to eq('bar')
24
27
  expect(subject.authorize_params['foo']).to eq('baz')
25
28
  end
26
29
  end
27
30
 
28
31
  describe '#token_params' do
29
- it 'should include any token params passed in the :token_params option' do
32
+ it 'includes any token params passed in the :token_params option' do
30
33
  @options = { token_params: { foo: 'bar', baz: 'zip' } }
34
+
31
35
  expect(subject.token_params['foo']).to eq('bar')
32
36
  expect(subject.token_params['baz']).to eq('zip')
33
37
  end
34
38
 
35
- it 'should include top-level options that are marked as :token_options' do
36
- @options = { token_options: %i[scope foo], scope: 'bar', foo: 'baz' }
39
+ it 'includes top-level options that are marked as :token_options' do
40
+ @options = { token_options: [:scope, :foo], scope: 'bar', foo: 'baz' }
41
+
37
42
  expect(subject.token_params['scope']).to eq('bar')
38
43
  expect(subject.token_params['foo']).to eq('baz')
39
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-mlh
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
- - Swift
8
- autorequire:
7
+ - Major League Hacking (MLH)
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-30 00:00:00.000000000 Z
11
+ date: 2023-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -53,75 +53,89 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.8.0
55
55
  - !ruby/object:Gem::Dependency
56
- name: omniauth-rails_csrf_protection
56
+ name: rack-test
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 1.0.1
62
- type: :runtime
61
+ version: '0'
62
+ type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 1.0.1
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: activesupport
70
+ name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :runtime
75
+ version: 12.3.3
76
+ type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 12.3.3
83
83
  - !ruby/object:Gem::Dependency
84
- name: rack-test
84
+ name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: '3.10'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: '3.10'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rake
98
+ name: rubocop
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '10.5'
103
+ version: '1.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '10.5'
110
+ version: '1.0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rspec
112
+ name: rubocop-performance
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '2.7'
117
+ version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
123
137
  - !ruby/object:Gem::Version
124
- version: '2.7'
138
+ version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: simplecov
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -152,31 +166,34 @@ dependencies:
152
166
  version: '0'
153
167
  description: Official OmniAuth strategy for MyMLH.
154
168
  email:
155
- - swift@mlh.io
169
+ - hi@mlh.io
156
170
  executables: []
157
171
  extensions: []
158
172
  extra_rdoc_files: []
159
173
  files:
174
+ - ".github/workflows/gem-push.yml"
175
+ - ".github/workflows/test.yml"
160
176
  - ".gitignore"
161
177
  - ".rspec"
162
178
  - ".rubocop.yml"
163
179
  - ".travis.yml"
180
+ - CONTRIBUTING.md
164
181
  - Gemfile
165
182
  - LICENSE.txt
166
183
  - README.md
167
184
  - Rakefile
168
- - lib/omniauth-mlh.rb
169
185
  - lib/omniauth-mlh/version.rb
170
186
  - lib/omniauth/strategies/mlh.rb
187
+ - lib/omniauth_mlh.rb
171
188
  - omniauth-mlh.gemspec
172
- - spec/omniauth/mlh_spec.rb
189
+ - spec/omni_auth/mlh_spec.rb
173
190
  - spec/spec_helper.rb
174
191
  - spec/support/shared_examples.rb
175
192
  homepage: http://github.com/mlh/omniauth-mlh
176
193
  licenses:
177
194
  - MIT
178
195
  metadata: {}
179
- post_install_message:
196
+ post_install_message:
180
197
  rdoc_options: []
181
198
  require_paths:
182
199
  - lib
@@ -184,18 +201,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
201
  requirements:
185
202
  - - ">="
186
203
  - !ruby/object:Gem::Version
187
- version: 2.2.0
204
+ version: 2.7.0
188
205
  required_rubygems_version: !ruby/object:Gem::Requirement
189
206
  requirements:
190
207
  - - ">="
191
208
  - !ruby/object:Gem::Version
192
209
  version: '0'
193
210
  requirements: []
194
- rubygems_version: 3.2.33
195
- signing_key:
211
+ rubygems_version: 3.4.10
212
+ signing_key:
196
213
  specification_version: 4
197
214
  summary: Official OmniAuth strategy for MyMLH.
198
- test_files:
199
- - spec/omniauth/mlh_spec.rb
200
- - spec/spec_helper.rb
201
- - spec/support/shared_examples.rb
215
+ test_files: []
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe OmniAuth::MLH do
6
- subject do
7
- OmniAuth::Strategies::MLH.new(nil, @options || {})
8
- end
9
-
10
- it_should_behave_like 'an oauth2 strategy'
11
-
12
- describe '#client' do
13
- it 'has correct MyMLH site' do
14
- expect(subject.client.site).to eq('https://my.mlh.io')
15
- end
16
-
17
- it 'has correct authorize url' do
18
- expect(subject.client.options[:authorize_url]).to eq('oauth/authorize')
19
- end
20
-
21
- it 'has correct token url' do
22
- expect(subject.client.options[:token_url]).to eq('oauth/token')
23
- end
24
-
25
- it 'runs the setup block if passed one' do
26
- counter = ''
27
- @options = { setup: proc { |_env| counter = 'ok' } }
28
- subject.setup_phase
29
- expect(counter).to eq('ok')
30
- end
31
- end
32
-
33
- describe '#callback_path' do
34
- it 'has the correct callback path' do
35
- expect(subject.callback_path).to eq('/auth/mlh/callback')
36
- end
37
- end
38
- end