Skip to content

Commit e84bdf2

Browse files
committed
Cleaned up project structure.
- Updated gems - gemspec only has direct dependencies of the gem. - Dev and Test dependencies are in Gemfile - Removed tests (will write from scratch)
1 parent 61bf4f6 commit e84bdf2

File tree

9 files changed

+56
-210
lines changed

9 files changed

+56
-210
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.ruby-version
22
coverage
33
Gemfile.lock
4-
*.gem
4+
*.gem
5+
6+
.#*

.rspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--color
2+
--require spec_helper
3+
--format=progress

Gemfile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
source "http://rubygems.org"
22

33
# Specify your gem's dependencies in omniauth-auth0.gemspec
4-
gemspec
4+
gemspec
5+
6+
gem "gem-release"
7+
gem "rake"
8+
9+
group :test do
10+
gem "pry"
11+
gem "rack-test"
12+
gem "rspec", "~> 3.5"
13+
gem "rubocop", ">= 0.30", :platforms => [:ruby_19, :ruby_20, :ruby_21, :ruby_22]
14+
gem "simplecov"
15+
gem "webmock"
16+
end

Rakefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ require 'rspec/core/rake_task'
55
desc "Run specs"
66
RSpec::Core::RakeTask.new
77

8+
begin
9+
require 'rubocop/rake_task'
10+
RuboCop::RakeTask.new
11+
rescue LoadError
12+
task :rubocop do
13+
$stderr.puts 'Rubocop is disabled'
14+
end
15+
end
16+
817
desc 'Run specs'
9-
task :default => :spec
10-
task :test => :spec
18+
task :default => [:spec, :rubocop]
19+
task :test => :spec
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Rails.application.config.middleware.use OmniAuth::Builder do
22
provider(
33
:auth0,
4-
ENV["AUTH0_CLIENT_ID"],
5-
ENV["AUTH0_CLIENT_SECRET"],
6-
ENV["AUTH0_DOMAIN"],
4+
client_id: ENV["AUTH0_CLIENT_ID"],
5+
client_secret: ENV["AUTH0_CLIENT_SECRET"],
6+
namespace: ENV["AUTH0_DOMAIN"],
77
callback_path: "/auth/auth0/callback"
88
)
99
end

lib/omniauth/strategies/auth0.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
require "base64"
2-
require "omniauth-oauth2"
1+
require 'base64'
2+
require 'omniauth-oauth2'
33

4+
# Auth0 OmniAuth strategy
45
module OmniAuth
56
module Strategies
67
class Auth0 < OmniAuth::Strategies::OAuth2
@@ -15,9 +16,9 @@ class Auth0 < OmniAuth::Strategies::OAuth2
1516
option :connection
1617

1718
option :client_options, {
18-
authorize_url: "/authorize",
19-
token_url: "/oauth/token",
20-
userinfo_url: "/userinfo"
19+
authorize_url: '/authorize',
20+
token_url: '/oauth/token',
21+
userinfo_url: '/userinfo'
2122
}
2223

2324
args [:client_id, :client_secret, :namespace, :provider_ignores_state, :connection]
@@ -35,8 +36,7 @@ def initialize(app, *args, &block)
3536
"https://#{options[:namespace]}/authorize?#{self.class.client_info_querystring}"
3637
@options.client_options.token_url =
3738
"https://#{options[:namespace]}/oauth/token?#{self.class.client_info_querystring}"
38-
@options.client_options.userinfo_url =
39-
"https://#{options[:namespace]}/userinfo"
39+
@options.client_options.userinfo_url = "https://#{options[:namespace]}/userinfo"
4040
elsif !options[:setup]
4141
fail(ArgumentError.new("Received wrong number of arguments. #{args.inspect}"))
4242
end

omniauth-auth0.gemspec

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ require "omniauth-auth0/version"
55
Gem::Specification.new do |s|
66
s.name = "omniauth-auth0"
77
s.version = OmniAuth::Auth0::VERSION
8-
s.authors = ["Auth0", "Ezequiel Morito", "Jose Romaniello"]
9-
s.email = ["support@auth0.com"]
8+
s.authors = ["Auth0"]
9+
s.email = ["info@auth0.com"]
1010
s.homepage = "https://github.com/auth0/omniauth-auth0"
1111
s.summary = %q{Omniauth OAuth2 strategy for the Auth0 platform.}
1212
s.description = %q{Auth0 is an authentication broker that supports social identity providers as well as enterprise identity providers such as Active Directory, LDAP, Google Apps, Salesforce.
@@ -23,14 +23,9 @@ omniauth-auth0 is the omniauth strategy for Auth0.
2323
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
2424
s.require_paths = ["lib"]
2525

26-
s.add_runtime_dependency 'omniauth-oauth2', '~> 1.1'
26+
s.add_runtime_dependency 'omniauth-oauth2', '~> 1.4'
2727

28-
s.add_development_dependency 'rspec', '~> 2.7'
29-
s.add_development_dependency 'rack-test', '~> 0.6', '>= 0.6.3'
30-
s.add_development_dependency 'simplecov', '~> 0.9', '>= 0.9.1'
31-
s.add_development_dependency 'webmock', '~> 1.20', '>= 1.20.4'
32-
s.add_development_dependency 'rake', '~> 10.3', '>= 10.3.2'
33-
s.add_development_dependency 'gem-release', '~> 0.7'
28+
s.add_development_dependency 'bundler', '~> 1.9'
3429

3530
s.license = 'MIT'
3631
end

spec/omniauth/strategies/auth0_spec.rb

Lines changed: 0 additions & 177 deletions
This file was deleted.

spec/spec_helper.rb

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
$:.unshift File.expand_path('..', __FILE__)
2-
$:.unshift File.expand_path('../../lib', __FILE__)
3-
require 'simplecov'
4-
SimpleCov.start
1+
$LOAD_PATH.unshift File.expand_path("..", __FILE__)
2+
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
3+
require "simplecov"
4+
SimpleCov.start do
5+
minimum_coverage(89.8)
6+
end if ENV['COVERAGE']
57
require 'rspec'
68
require 'rack/test'
79
require 'webmock/rspec'
810
require 'omniauth'
911
require 'omniauth-auth0'
1012

1113
RSpec.configure do |config|
12-
config.include WebMock::API
13-
config.include Rack::Test::Methods
14-
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
15-
config.color = true
16-
config.formatter = 'documentation'
17-
end
14+
config.include WebMock::API
15+
config.include Rack::Test::Methods
16+
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
17+
end
18+
19+
OmniAuth.config.logger = Logger.new("/dev/null")

0 commit comments

Comments
 (0)