Skip to content

Commit

Permalink
Merge pull request #160 from fwininger/ruby-version
Browse files Browse the repository at this point in the history
Dependencies refactoring
  • Loading branch information
kjg authored Dec 14, 2017
2 parents 9052df1 + 9f0258c commit 071dd69
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 64 deletions.
54 changes: 5 additions & 49 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,19 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2016-02-10 17:06:30 +0100 using RuboCop version 0.37.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
inherit_from: .rubocop_todo.yml

# Offense count: 1
# Configuration parameters: AllowSafeAssignment.
Lint/AssignmentInCondition:
Exclude:
- 'lib/api_auth/base.rb'

# Offense count: 2
Metrics/AbcSize:
Max: 25

# Offense count: 2
Metrics/CyclomaticComplexity:
Max: 13

# Offense count: 74
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 137
Max: 140

# Offense count: 4
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 30

# Offense count: 1
Metrics/PerceivedComplexity:
Max: 8

# Offense count: 8
Style/AccessorMethodName:
Exclude:
- 'lib/api_auth/railtie.rb'
- 'lib/api_auth/request_drivers/action_controller.rb'
- 'lib/api_auth/request_drivers/curb.rb'
- 'lib/api_auth/request_drivers/faraday.rb'
- 'lib/api_auth/request_drivers/httpi.rb'
- 'lib/api_auth/request_drivers/net_http.rb'
- 'lib/api_auth/request_drivers/rack.rb'
- 'lib/api_auth/request_drivers/rest_client.rb'

# Offense count: 4
Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'lib/api_auth/railtie.rb'
- 'lib/api_auth/request_drivers/rest_client.rb'
Max: 40

# Offense count: 1
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts.
Style/FileName:
Naming/FileName:
Exclude:
- 'lib/api-auth.rb'
- 'Appraisals'
55 changes: 55 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2017-12-13 22:57:22 +0100 using RuboCop version 0.52.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# Configuration parameters: AllowSafeAssignment.
Lint/AssignmentInCondition:
Exclude:
- 'lib/api_auth/base.rb'

# Offense count: 8
Lint/Void:
Exclude:
- 'lib/api_auth/headers.rb'
- 'lib/api_auth/request_drivers/action_controller.rb'
- 'lib/api_auth/request_drivers/curb.rb'
- 'lib/api_auth/request_drivers/faraday.rb'
- 'lib/api_auth/request_drivers/httpi.rb'
- 'lib/api_auth/request_drivers/net_http.rb'
- 'lib/api_auth/request_drivers/rack.rb'
- 'lib/api_auth/request_drivers/rest_client.rb'

# Offense count: 1
Metrics/PerceivedComplexity:
Max: 8

# Offense count: 8
Naming/AccessorMethodName:
Exclude:
- 'lib/api_auth/railtie.rb'
- 'lib/api_auth/request_drivers/action_controller.rb'
- 'lib/api_auth/request_drivers/curb.rb'
- 'lib/api_auth/request_drivers/faraday.rb'
- 'lib/api_auth/request_drivers/httpi.rb'
- 'lib/api_auth/request_drivers/net_http.rb'
- 'lib/api_auth/request_drivers/rack.rb'
- 'lib/api_auth/request_drivers/rest_client.rb'

# Offense count: 9
Style/CommentedKeyword:
Exclude:
- 'lib/api_auth/base.rb'
- 'lib/api_auth/railtie.rb'

# Offense count: 4
Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'lib/api_auth/railtie.rb'
- 'lib/api_auth/request_drivers/rest_client.rb'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ minutes in order to avoid replay attacks.

## Requirement

v3.X require Ruby 2.X and if you use Rails at least Rails 4.0.
v3.X require Ruby >= 2.1 and Rails >= 4.0 if you use rails.

For older version of Ruby or Rails, please use ApiAuth v2.X.

Expand Down
18 changes: 10 additions & 8 deletions api_auth.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@ Gem::Specification.new do |s|
s.authors = ['Mauricio Gomes']
s.email = '[email protected]'

s.add_development_dependency 'appraisal'
s.add_development_dependency 'rake'
s.add_development_dependency 'amatch'
s.add_development_dependency 'rspec', '~> 3.4'
s.required_ruby_version = '>= 2.1.0'

s.add_development_dependency 'actionpack', '< 6.0', '> 4.0'
s.add_development_dependency 'activeresource', '>= 4.0'
s.add_development_dependency 'activesupport', '< 6.0', '> 4.0'
s.add_development_dependency 'activeresource', '~> 4.0'
s.add_development_dependency 'rest-client', '~> 1.6.0'
s.add_development_dependency 'curb', '~> 0.8.1'
s.add_development_dependency 'httpi'
s.add_development_dependency 'amatch'
s.add_development_dependency 'appraisal'
s.add_development_dependency 'curb', '~> 0.8'
s.add_development_dependency 'faraday', '>= 0.10'
s.add_development_dependency 'httpi'
s.add_development_dependency 'multipart-post', '~> 2.0'
s.add_development_dependency 'rake'
s.add_development_dependency 'rest-client', '~> 1.6.0'
s.add_development_dependency 'rspec', '~> 3.4'

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Expand Down
4 changes: 1 addition & 3 deletions lib/api_auth/headers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ def timestamp
def canonical_string(override_method = nil)
request_method = override_method || @request.http_method

if request_method.nil?
raise ArgumentError, 'unable to determine the http method from the request, please supply an override'
end
raise ArgumentError, 'unable to determine the http method from the request, please supply an override' if request_method.nil?

[request_method.upcase,
@request.content_type,
Expand Down
4 changes: 1 addition & 3 deletions lib/api_auth/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ def api_authenticated?(secret_key)
end
end

if defined?(ActionController::Base)
ActionController::Base.send(:include, ControllerMethods::InstanceMethods)
end
ActionController::Base.send(:include, ControllerMethods::InstanceMethods) if defined?(ActionController::Base)
end # ControllerMethods

module ActiveResourceExtension # :nodoc:
Expand Down

0 comments on commit 071dd69

Please sign in to comment.