dailycred 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +14 -2
- data/Guardfile +15 -0
- data/README.md +159 -33
- data/Rakefile +30 -0
- data/app/controllers/sessions_controller.rb +31 -0
- data/app/views/sessions/info.html.erb +13 -0
- data/config/routes.rb +7 -0
- data/dailycred.gemspec +4 -3
- data/docs/lib/dailycred/acts_as_dailycred.html +42 -0
- data/docs/lib/dailycred/client.html +214 -0
- data/docs/lib/dailycred/engine.html +112 -0
- data/docs/lib/dailycred/helper.html +125 -0
- data/docs/lib/dailycred/middleware.html +42 -0
- data/docs/lib/dailycred/tests_helper.html +42 -0
- data/docs/lib/dailycred/user.html +133 -0
- data/docs/lib/dailycred.html +42 -0
- data/docs/lib/generators/dailycred_generator.html +42 -0
- data/docs/lib/generators/templates/migration_create_user.html +39 -0
- data/docs/lib/generators/templates/omniauth.html +71 -0
- data/docs/lib/generators/templates/sessions_controller.html +96 -0
- data/docs/lib/generators/templates/user.html +42 -0
- data/docs/lib/middleware/middleware.html +38 -0
- data/docs/lib/omniauth/strategies/dailycred.html +199 -0
- data/docs/lib/omniauth-dailycred/version.html +38 -0
- data/docs/lib/user/user.html +129 -0
- data/dummy/.gitignore +15 -0
- data/dummy/Gemfile +55 -0
- data/dummy/Guardfile +31 -0
- data/dummy/README.rdoc +261 -0
- data/dummy/Rakefile +7 -0
- data/dummy/app/assets/images/rails.png +0 -0
- data/dummy/app/assets/javascripts/application.js +15 -0
- data/dummy/app/assets/javascripts/posts.js.coffee +3 -0
- data/dummy/app/assets/stylesheets/application.css +13 -0
- data/dummy/app/assets/stylesheets/posts.css.scss +3 -0
- data/dummy/app/assets/stylesheets/scaffolds.css.scss +69 -0
- data/dummy/app/controllers/application_controller.rb +16 -0
- data/dummy/app/controllers/posts_controller.rb +85 -0
- data/dummy/app/helpers/application_helper.rb +2 -0
- data/dummy/app/helpers/posts_helper.rb +2 -0
- data/dummy/app/mailers/.gitkeep +0 -0
- data/dummy/app/models/.gitkeep +0 -0
- data/dummy/app/models/post.rb +3 -0
- data/dummy/app/models/user.rb +3 -0
- data/dummy/app/views/layouts/application.html.erb +14 -0
- data/dummy/app/views/posts/_form.html.erb +21 -0
- data/dummy/app/views/posts/edit.html.erb +6 -0
- data/dummy/app/views/posts/index.html.erb +23 -0
- data/dummy/app/views/posts/new.html.erb +5 -0
- data/dummy/app/views/posts/show.html.erb +10 -0
- data/dummy/config/application.rb +62 -0
- data/dummy/config/boot.rb +6 -0
- data/dummy/config/database.yml +25 -0
- data/dummy/config/environment.rb +5 -0
- data/dummy/config/environments/development.rb +37 -0
- data/dummy/config/environments/production.rb +67 -0
- data/dummy/config/environments/test.rb +37 -0
- data/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/dummy/config/initializers/inflections.rb +15 -0
- data/dummy/config/initializers/mime_types.rb +5 -0
- data/dummy/config/initializers/omniauth.rb +13 -0
- data/dummy/config/initializers/secret_token.rb +7 -0
- data/dummy/config/initializers/session_store.rb +8 -0
- data/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/dummy/config/locales/en.yml +5 -0
- data/dummy/config/routes.rb +61 -0
- data/dummy/config.ru +4 -0
- data/dummy/db/migrate/20120925172903_create_users.rb +68 -0
- data/dummy/db/migrate/20120926012555_create_posts.rb +9 -0
- data/dummy/db/migrate/20121002192037_update_users_2.rb +70 -0
- data/dummy/db/schema.rb +45 -0
- data/dummy/db/seeds.rb +7 -0
- data/dummy/lib/assets/.gitkeep +0 -0
- data/dummy/lib/tasks/.gitkeep +0 -0
- data/dummy/log/.gitkeep +0 -0
- data/dummy/public/404.html +26 -0
- data/dummy/public/422.html +26 -0
- data/dummy/public/500.html +25 -0
- data/dummy/public/favicon.ico +0 -0
- data/dummy/public/index.html +241 -0
- data/dummy/public/robots.txt +5 -0
- data/dummy/script/rails +6 -0
- data/dummy/test/fixtures/.gitkeep +0 -0
- data/dummy/test/fixtures/posts.yml +7 -0
- data/dummy/test/fixtures/users.yml +3 -0
- data/dummy/test/functional/.gitkeep +0 -0
- data/dummy/test/functional/posts_controller_test.rb +51 -0
- data/dummy/test/integration/.gitkeep +0 -0
- data/dummy/test/performance/browsing_test.rb +12 -0
- data/dummy/test/test_helper.rb +62 -0
- data/dummy/test/unit/.gitkeep +0 -0
- data/dummy/test/unit/helpers/posts_helper_test.rb +4 -0
- data/dummy/test/unit/post_test.rb +7 -0
- data/dummy/test/unit/user_test.rb +77 -0
- data/dummy/vendor/assets/javascripts/.gitkeep +0 -0
- data/dummy/vendor/assets/stylesheets/.gitkeep +0 -0
- data/dummy/vendor/plugins/.gitkeep +0 -0
- data/lib/dailycred/acts_as_dailycred.rb +87 -0
- data/lib/dailycred/client.rb +105 -0
- data/lib/dailycred/engine.rb +52 -0
- data/lib/dailycred/helper.rb +60 -0
- data/lib/{middleware → dailycred}/middleware.rb +25 -15
- data/lib/dailycred/tests_helper.rb +5 -0
- data/lib/dailycred/user.rb +63 -0
- data/lib/dailycred.rb +1 -79
- data/lib/generators/dailycred_generator.rb +94 -44
- data/lib/generators/templates/info.html.erb +1 -1
- data/lib/generators/templates/login.html.erb +13 -0
- data/lib/generators/templates/migration_create_user.rb +60 -10
- data/lib/generators/templates/omniauth.rb +6 -17
- data/lib/generators/templates/sessions_controller.rb +8 -2
- data/lib/generators/templates/user.rb +1 -23
- data/lib/omniauth/strategies/dailycred.rb +37 -20
- data/script/download_info.rb +11 -0
- data/spec/{spec_helper.rb → helper_spec.rb} +4 -2
- data/spec/omniauth/strategies/dailycred_spec.rb +52 -10
- data/spec/support/dailycred_spec.rb +72 -0
- data/spec/support/shared_examples.rb +40 -0
- data/test/generator_test.rb +85 -0
- data/test/test_helper.rb +6 -0
- metadata +116 -8
- data/lib/omniauth-dailycred/version.rb +0 -5
@@ -2,34 +2,43 @@ require 'omniauth-oauth2'
|
|
2
2
|
require 'faraday'
|
3
3
|
require 'net/https'
|
4
4
|
require 'json'
|
5
|
+
require 'pp'
|
5
6
|
|
7
|
+
# #The Dailycred Omniauth Strategy
|
6
8
|
module OmniAuth
|
7
9
|
module Strategies
|
8
10
|
class Dailycred < OmniAuth::Strategies::OAuth2
|
11
|
+
|
12
|
+
# default options
|
9
13
|
option :client_options, {
|
10
|
-
:site =>
|
11
|
-
:authorize_url => '/
|
14
|
+
:site => "https://www.dailycred.com",
|
15
|
+
:authorize_url => '/connect',
|
12
16
|
:token_url => '/oauth/access_token'
|
13
17
|
}
|
14
18
|
|
15
|
-
|
16
|
-
AUTH_PARAMS = ["action"]
|
19
|
+
# allows parameters to be passed through
|
20
|
+
AUTH_PARAMS = ["action","identity_provider","referrer", "access_token"]
|
17
21
|
|
18
22
|
option :authorize_options, OmniAuth::Strategies::Dailycred::AUTH_PARAMS
|
19
|
-
|
23
|
+
|
20
24
|
uid { user['id'] }
|
21
|
-
|
25
|
+
|
22
26
|
info do
|
23
|
-
|
24
|
-
OmniAuth::Strategies::Dailycred::ATTRIBUTES.each do |attribute|
|
25
|
-
infos[attribute] = user[attribute]
|
26
|
-
end
|
27
|
-
infos
|
27
|
+
user
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
alias :old_request_phase :request_phase
|
31
31
|
|
32
|
-
|
32
|
+
|
33
|
+
def authorize_params
|
34
|
+
super.tap do |params|
|
35
|
+
params[:state] ||= {}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# this step allows auth_params to be added to the url
|
40
|
+
def request_phase
|
41
|
+
p session['omniauth.state']
|
33
42
|
OmniAuth::Strategies::Dailycred::AUTH_PARAMS.each do |param|
|
34
43
|
val = session['omniauth.params'][param]
|
35
44
|
if val && !val.empty?
|
@@ -42,21 +51,29 @@ module OmniAuth
|
|
42
51
|
|
43
52
|
private
|
44
53
|
|
54
|
+
# This is the phase where the gem calls me.json, which returns information about the user
|
45
55
|
def user
|
46
56
|
return @duser if !@duser.nil?
|
47
|
-
connection = Faraday::Connection.new
|
48
|
-
:ca_file => "/opt/local/share/curl/curl-ca-bundle.crt"
|
49
|
-
}
|
57
|
+
connection = Faraday::Connection.new options.client_options[:site], :ssl => options.client_options[:ssl]
|
50
58
|
response = connection.get("/graph/me.json?access_token=#{access_token.token}")
|
51
59
|
json = JSON.parse(response.body)
|
52
|
-
|
53
|
-
|
54
|
-
|
60
|
+
pp json if options[:verbose]
|
61
|
+
@duser = {'token' => access_token.token}
|
62
|
+
@duser['provider'] = 'dailycred'
|
63
|
+
@duser['uid'] = json['id'] || json['user_id']
|
64
|
+
json.each do |k,v|
|
65
|
+
@duser[k] = v
|
55
66
|
end
|
67
|
+
json["identities"].each do |k, v|
|
68
|
+
@duser[k] = v
|
69
|
+
@duser[k][:access_token] = json["access_tokens"][k]
|
70
|
+
end if !json["identities"].nil?
|
71
|
+
pp @duser if options[:verbose]
|
72
|
+
@duser.delete("id")
|
56
73
|
|
57
74
|
@duser
|
58
75
|
end
|
59
|
-
|
76
|
+
|
60
77
|
end
|
61
78
|
end
|
62
79
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'gems'
|
2
|
+
require 'pp'
|
3
|
+
total = 0
|
4
|
+
Gems.versions('dailycred').reverse.each_with_index do |v,i|
|
5
|
+
p "version: #{v['number']}"
|
6
|
+
p "downloads: #{v['downloads_count']}"
|
7
|
+
total += v['downloads_count']
|
8
|
+
p "total: #{total}"
|
9
|
+
p "release date: #{Date.parse(v['built_at']).to_time.strftime('%m/%d/%Y')}"
|
10
|
+
p "----------"
|
11
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
$:.unshift File.expand_path('..', __FILE__)
|
2
|
-
$:.unshift File.expand_path('../../lib', __FILE__)
|
1
|
+
# $:.unshift File.expand_path('..', __FILE__)
|
2
|
+
# $:.unshift File.expand_path('../../lib', __FILE__)
|
3
3
|
require 'simplecov'
|
4
4
|
SimpleCov.start
|
5
5
|
require 'rspec'
|
@@ -9,6 +9,8 @@ require 'dailycred'
|
|
9
9
|
|
10
10
|
Dir[File.expand_path('../support/**/*', __FILE__)].each { |f| require f }
|
11
11
|
|
12
|
+
# require 'omniauth/strategies/dailycred_spec'
|
13
|
+
|
12
14
|
RSpec.configure do |config|
|
13
15
|
config.include Rack::Test::Methods
|
14
16
|
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
|
@@ -1,22 +1,64 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require_relative '../../helper_spec.rb'
|
2
|
+
require 'omniauth'
|
3
|
+
require 'dailycred'
|
3
4
|
describe OmniAuth::Strategies::Dailycred do
|
4
5
|
subject do
|
5
6
|
OmniAuth::Strategies::Dailycred.new(nil, @options || {})
|
6
7
|
end
|
7
|
-
|
8
|
-
|
8
|
+
|
9
|
+
OmniAuth.config.test_mode = true
|
10
|
+
OmniAuth.config.add_mock(:dailycred, {:id => '12345',
|
11
|
+
:email => 'Test@test.com',
|
12
|
+
:username => 'test',
|
13
|
+
:created => 45678,
|
14
|
+
:verified => false,
|
15
|
+
:admin => true,
|
16
|
+
:referred_by => 'dave' })
|
17
|
+
|
18
|
+
it_should_behave_like 'an oauth2 strategy'
|
19
|
+
|
20
|
+
|
9
21
|
describe '#client' do
|
10
|
-
it 'should have the correct
|
11
|
-
subject.client.site.should eq("https://
|
22
|
+
it 'should have the correct dailycred site' do
|
23
|
+
subject.client.site.should eq("https://www.dailycred.com")
|
12
24
|
end
|
13
25
|
it 'should have the correct authorization url' do
|
14
|
-
subject.client.options[:authorize_url].should eq("
|
26
|
+
subject.client.options[:authorize_url].should eq("/oauth/authorize")
|
15
27
|
end
|
16
|
-
|
28
|
+
|
17
29
|
it 'should have the correct token url' do
|
18
|
-
subject.client.options[:token_url].should eq('
|
30
|
+
subject.client.options[:token_url].should eq('/oauth/access_token')
|
19
31
|
end
|
20
32
|
end
|
21
|
-
|
33
|
+
|
34
|
+
# describe 'getting info' do
|
35
|
+
# before do
|
36
|
+
# @access_token = double("token" => 'test_token')
|
37
|
+
# @dailycred_user = double( :id => '12345',
|
38
|
+
# :email => 'test@test.com',
|
39
|
+
# :username => 'test',
|
40
|
+
# :id => 45678,
|
41
|
+
# :verified => false,
|
42
|
+
# :admin => true,
|
43
|
+
# :referred_by => 'dave' )
|
44
|
+
|
45
|
+
# subject.stub(:access_token) { @access_token }
|
46
|
+
|
47
|
+
# @dailycred_user.should_receive(:fetch).and_return(@dailycred_user)
|
48
|
+
# end
|
49
|
+
|
50
|
+
# it 'should set the correct info based on user' do
|
51
|
+
# subject.info.should == {:id => '12345',
|
52
|
+
# :email => 'test@test.com',
|
53
|
+
# :username => 'test',
|
54
|
+
# :created => 45678,
|
55
|
+
# :verified => false,
|
56
|
+
# :admin => true,
|
57
|
+
# :referred_by => 'dave' }
|
58
|
+
# end
|
59
|
+
|
60
|
+
# it 'set the correct uid based on user' do
|
61
|
+
# subject.id.should == '12345'
|
62
|
+
# end
|
63
|
+
# end
|
22
64
|
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'pp'
|
3
|
+
require 'dailycred'
|
4
|
+
describe Dailycred::Client do
|
5
|
+
subject do
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
site = "https://www.dailycred.com"
|
11
|
+
client_id = "f1fd998c-bc48-4e1b-bc88-98f9373ba60f"
|
12
|
+
secret = "6925d89e-d04d-469e-8fc9-3782af57bc29-c2340f1e-25a0-40af-b638-7429947a6cd7"
|
13
|
+
@user_id = "0c19c355-2a71-4c8e-805e-f7a6087ea84c"
|
14
|
+
|
15
|
+
# dev settings
|
16
|
+
# site = "http://localhost:9000"
|
17
|
+
# client_id = "4337ed55-aaca-4e38-8824-6c016c59dd5b"
|
18
|
+
# secret = "34f2ecc3-f955-4292-9747-39b876d91d8b-a4f7ad8e-f8a4-4573-b23d-686f6e28a820"
|
19
|
+
# @user_id = "97a85558-c5a6-47de-ab89-4e7de02c99bd"
|
20
|
+
|
21
|
+
dc_options = { :client_options => {
|
22
|
+
:site => site,
|
23
|
+
:authorize_url => '/oauth/authorize',
|
24
|
+
:token_url => '/oauth/access_token'
|
25
|
+
} }
|
26
|
+
|
27
|
+
if File.exists?('/etc/ssl/certs')
|
28
|
+
dc_options[:client_options][:ssl] = { :ca_path => '/etc/ssl/certs'}
|
29
|
+
end
|
30
|
+
|
31
|
+
if File.exists?('/opt/local/share/curl/curl-ca-bundle.crt')
|
32
|
+
dc_options[:client_options][:ssl] = { :ca_file => '/opt/local/share/curl/curl-ca-bundle.crt' }
|
33
|
+
end
|
34
|
+
|
35
|
+
@dc = Dailycred::Client.new client_id, secret, dc_options
|
36
|
+
end
|
37
|
+
|
38
|
+
it "tags a user" do
|
39
|
+
json = json_response @dc.tag(@user_id, "loser")
|
40
|
+
json["worked"].should == true
|
41
|
+
user = json["user"]
|
42
|
+
user["tags"].should include('loser') #will work in next push
|
43
|
+
end
|
44
|
+
|
45
|
+
it "untags a user" do
|
46
|
+
json = json_response @dc.untag(@user_id, "loser")
|
47
|
+
json["worked"].should == true
|
48
|
+
user = json["user"]
|
49
|
+
user["tags"].should == nil #will work in next push
|
50
|
+
end
|
51
|
+
|
52
|
+
it "fires an event" do
|
53
|
+
json = json_response @dc.event(@user_id, "became a loser")
|
54
|
+
json["worked"].should == true
|
55
|
+
end
|
56
|
+
|
57
|
+
it "resets a password" do
|
58
|
+
json = json_response @dc.reset_password("useruseruseruser@gmail.com")
|
59
|
+
json["worked"].should == true
|
60
|
+
end
|
61
|
+
|
62
|
+
# it "changes a password" do
|
63
|
+
# json = json_response @dc.changePass("0c19c355-2a71-4c8e-805e-f7a6087ea84c", "wrongPass", "newPass")
|
64
|
+
# json["worked"].should == false
|
65
|
+
# json["message"].should != nil
|
66
|
+
# end
|
67
|
+
|
68
|
+
|
69
|
+
def json_response response
|
70
|
+
JSON.parse response.body
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# NOTE it would be useful if this lived in omniauth-oauth2 eventually
|
2
|
+
# Thanks to Josh Ellithorpe for this file -Will
|
3
|
+
|
4
|
+
shared_examples 'an oauth2 strategy' do
|
5
|
+
describe '#client' do
|
6
|
+
it 'should be initialized with symbolized client_options' do
|
7
|
+
@options = { :client_options => { 'authorize_url' => 'https://example.com' } }
|
8
|
+
subject.client.options[:authorize_url].should == 'https://example.com'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '#authorize_params' do
|
13
|
+
# it 'should include any authorize params passed in the :authorize_params option' do
|
14
|
+
# @options = { :authorize_params => { :foo => 'bar', :baz => 'zip' } }
|
15
|
+
# p subject.authorize_params
|
16
|
+
# subject.authorize_params['foo'].should eq('bar')
|
17
|
+
# subject.authorize_params['baz'].should eq('zip')
|
18
|
+
# end
|
19
|
+
|
20
|
+
it 'should include top-level options that are marked as :authorize_options' do
|
21
|
+
@options = { :authorize_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
|
22
|
+
subject.authorize_params['scope'].should eq('bar')
|
23
|
+
subject.authorize_params['foo'].should eq('baz')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#token_params' do
|
28
|
+
it 'should include any token params passed in the :token_params option' do
|
29
|
+
@options = { :token_params => { :foo => 'bar', :baz => 'zip' } }
|
30
|
+
subject.token_params['foo'].should eq('bar')
|
31
|
+
subject.token_params['baz'].should eq('zip')
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should include top-level options that are marked as :token_options' do
|
35
|
+
@options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
|
36
|
+
subject.token_params['scope'].should eq('bar')
|
37
|
+
subject.token_params['foo'].should eq('baz')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
# require 'mocha'
|
3
|
+
require_relative "../lib/generators/dailycred_generator.rb"
|
4
|
+
class GeneratorTest < Rails::Generators::TestCase
|
5
|
+
tests DailycredGenerator
|
6
|
+
destination File.expand_path("./tmp/myproject", File.dirname(__FILE__))
|
7
|
+
|
8
|
+
setup :prepare_destination
|
9
|
+
|
10
|
+
setup do
|
11
|
+
# Must set before requiring generator libs.
|
12
|
+
TMP_ROOT = File.dirname(__FILE__) + "/tmp" unless defined?(TMP_ROOT)
|
13
|
+
PROJECT_NAME = "myproject" unless defined?(PROJECT_NAME)
|
14
|
+
app_root = File.join(TMP_ROOT, PROJECT_NAME)
|
15
|
+
if defined?(APP_ROOT)
|
16
|
+
APP_ROOT.replace(app_root)
|
17
|
+
else
|
18
|
+
APP_ROOT = app_root
|
19
|
+
end
|
20
|
+
if defined?(RAILS_ROOT)
|
21
|
+
RAILS_ROOT.replace(app_root)
|
22
|
+
else
|
23
|
+
RAILS_ROOT = app_root
|
24
|
+
end
|
25
|
+
Dir.mkdir("#{RAILS_ROOT}/config") unless File.exists?("#{RAILS_ROOT}/config")
|
26
|
+
File.open("#{RAILS_ROOT}/config/routes.rb", 'w') do |f|
|
27
|
+
f.puts "ActionController::Routing::Routes.draw do\n\nend"
|
28
|
+
end
|
29
|
+
Dir.mkdir("#{RAILS_ROOT}/app") unless File.exists?("#{RAILS_ROOT}/app")
|
30
|
+
Dir.mkdir("#{RAILS_ROOT}/app/controllers") unless File.exists?("#{RAILS_ROOT}/app/controllers")
|
31
|
+
File.open("#{RAILS_ROOT}/app/controllers/application_controller.rb", 'w') do |f|
|
32
|
+
f.puts "class ApplicationController < ActionController::Base\n\nend"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
teardown do
|
37
|
+
FileUtils.rm_rf "#{RAILS_ROOT}/app"
|
38
|
+
FileUtils.rm_rf "#{RAILS_ROOT}/config"
|
39
|
+
FileUtils.rm_rf "#{RAILS_ROOT}/db"
|
40
|
+
end
|
41
|
+
|
42
|
+
test "generator works with input" do
|
43
|
+
test_generator ["aaa","bbb"]
|
44
|
+
assert_credentials "aaa", "bbb"
|
45
|
+
end
|
46
|
+
|
47
|
+
test "generator works with login" do
|
48
|
+
generator_class.any_instance.stubs(:get_input).returns(["localtest@dailycred.com","password"])
|
49
|
+
test_generator
|
50
|
+
assert_credentials "e92e20bf-e0a4-49b4-8a82-ff1b65d80017", "9adf81a8-ce97-4bcb-9c1f-c09f5fc7b6b8-0d1a4553-496d-450e-80fd-9e8d0552a920"
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def test_generator args=[]
|
56
|
+
run_generator args
|
57
|
+
assert_file "config/initializers/omniauth.rb" do |config|
|
58
|
+
assert_true config.include? 'Rails.configuration.DAILYCRED_CLIENT_ID ='
|
59
|
+
assert_true config.include? 'Rails.configuration.DAILYCRED_SECRET_KEY ='
|
60
|
+
end
|
61
|
+
|
62
|
+
assert_file "config/routes.rb", /(#{Regexp.escape("mount Dailycred::Engine => '/auth', :as => 'dailycred_engine'")})/
|
63
|
+
|
64
|
+
assert_file "app/models/user.rb" do |model|
|
65
|
+
assert_true model.include? "acts_as_dailycred"
|
66
|
+
end
|
67
|
+
|
68
|
+
assert_file "app/controllers/application_controller.rb" do |controller|
|
69
|
+
end
|
70
|
+
|
71
|
+
assert_migration "db/migrate/create_users.rb" do |migration|
|
72
|
+
assert_true migration.include? ":twitter"
|
73
|
+
assert_true migration.include? ":github"
|
74
|
+
assert_true migration.include? ":google"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def assert_credentials client_id, client_secret
|
79
|
+
assert_file "config/initializers/omniauth.rb" do |config|
|
80
|
+
assert_true config.include? "Rails.configuration.DAILYCRED_CLIENT_ID = \"#{client_id}\""
|
81
|
+
assert_true config.include? "Rails.configuration.DAILYCRED_SECRET_KEY = \"#{client_secret}\""
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dailycred
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
-
description:
|
46
|
+
description: A Ruby on Rails engine for authentication with Dailycred.
|
47
47
|
email:
|
48
48
|
- hstove@gmail.com
|
49
49
|
executables: []
|
@@ -52,23 +52,127 @@ extra_rdoc_files: []
|
|
52
52
|
files:
|
53
53
|
- .gitignore
|
54
54
|
- Gemfile
|
55
|
+
- Guardfile
|
55
56
|
- LICENSE
|
56
57
|
- README.md
|
57
58
|
- Rakefile
|
59
|
+
- app/controllers/sessions_controller.rb
|
60
|
+
- app/views/sessions/info.html.erb
|
61
|
+
- config/routes.rb
|
58
62
|
- dailycred.gemspec
|
63
|
+
- docs/lib/dailycred.html
|
64
|
+
- docs/lib/dailycred/acts_as_dailycred.html
|
65
|
+
- docs/lib/dailycred/client.html
|
66
|
+
- docs/lib/dailycred/engine.html
|
67
|
+
- docs/lib/dailycred/helper.html
|
68
|
+
- docs/lib/dailycred/middleware.html
|
69
|
+
- docs/lib/dailycred/tests_helper.html
|
70
|
+
- docs/lib/dailycred/user.html
|
71
|
+
- docs/lib/generators/dailycred_generator.html
|
72
|
+
- docs/lib/generators/templates/migration_create_user.html
|
73
|
+
- docs/lib/generators/templates/omniauth.html
|
74
|
+
- docs/lib/generators/templates/sessions_controller.html
|
75
|
+
- docs/lib/generators/templates/user.html
|
76
|
+
- docs/lib/middleware/middleware.html
|
77
|
+
- docs/lib/omniauth-dailycred/version.html
|
78
|
+
- docs/lib/omniauth/strategies/dailycred.html
|
79
|
+
- docs/lib/user/user.html
|
80
|
+
- dummy/.gitignore
|
81
|
+
- dummy/Gemfile
|
82
|
+
- dummy/Guardfile
|
83
|
+
- dummy/README.rdoc
|
84
|
+
- dummy/Rakefile
|
85
|
+
- dummy/app/assets/images/rails.png
|
86
|
+
- dummy/app/assets/javascripts/application.js
|
87
|
+
- dummy/app/assets/javascripts/posts.js.coffee
|
88
|
+
- dummy/app/assets/stylesheets/application.css
|
89
|
+
- dummy/app/assets/stylesheets/posts.css.scss
|
90
|
+
- dummy/app/assets/stylesheets/scaffolds.css.scss
|
91
|
+
- dummy/app/controllers/application_controller.rb
|
92
|
+
- dummy/app/controllers/posts_controller.rb
|
93
|
+
- dummy/app/helpers/application_helper.rb
|
94
|
+
- dummy/app/helpers/posts_helper.rb
|
95
|
+
- dummy/app/mailers/.gitkeep
|
96
|
+
- dummy/app/models/.gitkeep
|
97
|
+
- dummy/app/models/post.rb
|
98
|
+
- dummy/app/models/user.rb
|
99
|
+
- dummy/app/views/layouts/application.html.erb
|
100
|
+
- dummy/app/views/posts/_form.html.erb
|
101
|
+
- dummy/app/views/posts/edit.html.erb
|
102
|
+
- dummy/app/views/posts/index.html.erb
|
103
|
+
- dummy/app/views/posts/new.html.erb
|
104
|
+
- dummy/app/views/posts/show.html.erb
|
105
|
+
- dummy/config.ru
|
106
|
+
- dummy/config/application.rb
|
107
|
+
- dummy/config/boot.rb
|
108
|
+
- dummy/config/database.yml
|
109
|
+
- dummy/config/environment.rb
|
110
|
+
- dummy/config/environments/development.rb
|
111
|
+
- dummy/config/environments/production.rb
|
112
|
+
- dummy/config/environments/test.rb
|
113
|
+
- dummy/config/initializers/backtrace_silencers.rb
|
114
|
+
- dummy/config/initializers/inflections.rb
|
115
|
+
- dummy/config/initializers/mime_types.rb
|
116
|
+
- dummy/config/initializers/omniauth.rb
|
117
|
+
- dummy/config/initializers/secret_token.rb
|
118
|
+
- dummy/config/initializers/session_store.rb
|
119
|
+
- dummy/config/initializers/wrap_parameters.rb
|
120
|
+
- dummy/config/locales/en.yml
|
121
|
+
- dummy/config/routes.rb
|
122
|
+
- dummy/db/migrate/20120925172903_create_users.rb
|
123
|
+
- dummy/db/migrate/20120926012555_create_posts.rb
|
124
|
+
- dummy/db/migrate/20121002192037_update_users_2.rb
|
125
|
+
- dummy/db/schema.rb
|
126
|
+
- dummy/db/seeds.rb
|
127
|
+
- dummy/lib/assets/.gitkeep
|
128
|
+
- dummy/lib/tasks/.gitkeep
|
129
|
+
- dummy/log/.gitkeep
|
130
|
+
- dummy/public/404.html
|
131
|
+
- dummy/public/422.html
|
132
|
+
- dummy/public/500.html
|
133
|
+
- dummy/public/favicon.ico
|
134
|
+
- dummy/public/index.html
|
135
|
+
- dummy/public/robots.txt
|
136
|
+
- dummy/script/rails
|
137
|
+
- dummy/test/fixtures/.gitkeep
|
138
|
+
- dummy/test/fixtures/posts.yml
|
139
|
+
- dummy/test/fixtures/users.yml
|
140
|
+
- dummy/test/functional/.gitkeep
|
141
|
+
- dummy/test/functional/posts_controller_test.rb
|
142
|
+
- dummy/test/integration/.gitkeep
|
143
|
+
- dummy/test/performance/browsing_test.rb
|
144
|
+
- dummy/test/test_helper.rb
|
145
|
+
- dummy/test/unit/.gitkeep
|
146
|
+
- dummy/test/unit/helpers/posts_helper_test.rb
|
147
|
+
- dummy/test/unit/post_test.rb
|
148
|
+
- dummy/test/unit/user_test.rb
|
149
|
+
- dummy/vendor/assets/javascripts/.gitkeep
|
150
|
+
- dummy/vendor/assets/stylesheets/.gitkeep
|
151
|
+
- dummy/vendor/plugins/.gitkeep
|
59
152
|
- lib/dailycred.rb
|
153
|
+
- lib/dailycred/acts_as_dailycred.rb
|
154
|
+
- lib/dailycred/client.rb
|
155
|
+
- lib/dailycred/engine.rb
|
156
|
+
- lib/dailycred/helper.rb
|
157
|
+
- lib/dailycred/middleware.rb
|
158
|
+
- lib/dailycred/tests_helper.rb
|
159
|
+
- lib/dailycred/user.rb
|
60
160
|
- lib/generators/USAGE
|
61
161
|
- lib/generators/dailycred_generator.rb
|
62
162
|
- lib/generators/templates/info.html.erb
|
163
|
+
- lib/generators/templates/login.html.erb
|
63
164
|
- lib/generators/templates/migration_create_user.rb
|
64
165
|
- lib/generators/templates/omniauth.rb
|
65
166
|
- lib/generators/templates/sessions_controller.rb
|
66
167
|
- lib/generators/templates/user.rb
|
67
|
-
- lib/middleware/middleware.rb
|
68
|
-
- lib/omniauth-dailycred/version.rb
|
69
168
|
- lib/omniauth/strategies/dailycred.rb
|
169
|
+
- script/download_info.rb
|
170
|
+
- spec/helper_spec.rb
|
70
171
|
- spec/omniauth/strategies/dailycred_spec.rb
|
71
|
-
- spec/
|
172
|
+
- spec/support/dailycred_spec.rb
|
173
|
+
- spec/support/shared_examples.rb
|
174
|
+
- test/generator_test.rb
|
175
|
+
- test/test_helper.rb
|
72
176
|
homepage: https://www.dailycred.com
|
73
177
|
licenses: []
|
74
178
|
post_install_message:
|
@@ -92,8 +196,12 @@ rubyforge_project:
|
|
92
196
|
rubygems_version: 1.8.24
|
93
197
|
signing_key:
|
94
198
|
specification_version: 3
|
95
|
-
summary:
|
199
|
+
summary: ''
|
96
200
|
test_files:
|
201
|
+
- spec/helper_spec.rb
|
97
202
|
- spec/omniauth/strategies/dailycred_spec.rb
|
98
|
-
- spec/
|
203
|
+
- spec/support/dailycred_spec.rb
|
204
|
+
- spec/support/shared_examples.rb
|
205
|
+
- test/generator_test.rb
|
206
|
+
- test/test_helper.rb
|
99
207
|
has_rdoc:
|