1
0
Fork 0
mirror of https://github.com/omniauth/omniauth.git synced 2022-11-09 12:31:49 -05:00

Fix Rubocop; Min Ruby version 2.2; Update Travis platforms

This commit is contained in:
Tom Milewski 2018-12-14 11:29:36 -05:00
parent 8179ba796a
commit ace4ba366a
No known key found for this signature in database
GPG key ID: 0C45B110F8B40F20
11 changed files with 30 additions and 11 deletions

View file

@ -1,6 +1,12 @@
AllCops:
TargetRubyVersion: 2.2
Layout/AccessModifierIndentation:
EnforcedStyle: outdent
Layout/AlignHash:
Enabled: false
Layout/DotPosition:
EnforcedStyle: trailing
@ -50,6 +56,9 @@ Style/EachWithObject:
Style/Encoding:
Enabled: false
Style/ExpandPathArguments:
Enabled: false
Style/HashSyntax:
EnforcedStyle: hash_rockets

View file

@ -9,11 +9,10 @@ env:
language: ruby
rvm:
- jruby-9000
- 2.1.10 # EOL Soon
- 2.2.6
- 2.3.3
- 2.4.0
- 2.5.0
- 2.2.9
- 2.3.5
- 2.4.4
- 2.5.3
- jruby-head
- ruby-head
matrix:

View file

@ -20,7 +20,7 @@ group :test do
gem 'rack-test'
gem 'rest-client', '~> 2.0.0', :platforms => [:jruby_18]
gem 'rspec', '~> 3.5.0'
gem 'rubocop', '>= 0.47', :platforms => %i[ruby_20 ruby_21 ruby_22 ruby_23 ruby_24]
gem 'rubocop', '>= 0.58.2', :platforms => %i[ruby_20 ruby_21 ruby_22 ruby_23 ruby_24]
gem 'tins', '~> 1.13.0', :platforms => %i[jruby_18 jruby_19 ruby_19]
end

View file

@ -30,6 +30,7 @@ namespace :perf do
def call_app(path = ENV['GET_PATH'] || '/')
result = @app.get(path)
raise "Did not succeed #{result.body}" unless result.status == 200
result
end
end

View file

@ -20,9 +20,7 @@ module OmniAuth
end
def regular_writer(key, value)
if key.to_s == 'info' && value.is_a?(::Hash) && !value.is_a?(InfoHash)
value = InfoHash.new(value)
end
value = InfoHash.new(value) if key.to_s == 'info' && value.is_a?(::Hash) && !value.is_a?(InfoHash)
super
end
@ -36,6 +34,7 @@ module OmniAuth
return "#{first_name} #{last_name}".strip if first_name? || last_name?
return nickname if nickname?
return email if email?
nil
end

View file

@ -41,6 +41,7 @@ module OmniAuth
def options(options = false)
return @options || {} if options == false
@options = options
end

View file

@ -33,11 +33,13 @@ module OmniAuth
def strategy_name_query_param
return '' unless env['omniauth.error.strategy']
"&strategy=#{env['omniauth.error.strategy'].name}"
end
def origin_query_param
return '' unless env['omniauth.origin']
"&origin=#{Rack::Utils.escape(env['omniauth.origin'])}"
end
end

View file

@ -82,6 +82,7 @@ module OmniAuth
def footer
return self if @footer
@html << "\n<button type='submit'>Connect</button>" unless @with_custom_button
@html << <<-HTML
</form>

View file

@ -140,6 +140,7 @@ module OmniAuth
self.class.args.each do |arg|
break if args.empty?
options[arg] = args.shift
end
@ -187,6 +188,7 @@ module OmniAuth
return request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
return callback_call if on_callback_path?
return other_phase if respond_to?(:other_phase)
@app.call(env)
end
@ -268,6 +270,7 @@ module OmniAuth
def mock_call!(*)
return mock_request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
return mock_callback_call if on_callback_path?
call_app!
end
@ -361,6 +364,7 @@ module OmniAuth
def skip_info?
return false unless options.skip_info?
return true unless options.skip_info.respond_to?(:call)
options.skip_info.call(uid)
end
@ -377,6 +381,7 @@ module OmniAuth
if options[kind].respond_to?(:call)
result = options[kind].call(env)
return nil unless result.is_a?(String)
result
else
options[kind]
@ -401,7 +406,7 @@ module OmniAuth
options[:setup_path] || "#{path_prefix}/#{name}/setup"
end
CURRENT_PATH_REGEX = %r{/$}
CURRENT_PATH_REGEX = %r{/$}.freeze
EMPTY_STRING = ''.freeze
def current_path
@current_path ||= request.path_info.downcase.sub(CURRENT_PATH_REGEX, EMPTY_STRING)

View file

@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
spec.name = 'omniauth'
spec.require_paths = %w[lib]
spec.required_rubygems_version = '>= 1.3.5'
spec.required_ruby_version = '>= 2.1.9'
spec.required_ruby_version = '>= 2.2'
spec.summary = spec.description
spec.version = OmniAuth::VERSION
end

View file

@ -48,6 +48,7 @@ class ExampleStrategy
@fail = fail!(options[:failure]) if options[:failure]
@last_env = env
return @fail if @fail
raise('Request Phase')
end
@ -56,6 +57,7 @@ class ExampleStrategy
@fail = fail!(options[:failure]) if options[:failure]
@last_env = env
return @fail if @fail
raise('Callback Phase')
end
end