sinatra-authentication 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +6 -1
- data/lib/models/abstract_user.rb +39 -1
- data/lib/models/datamapper_user.rb +2 -1
- data/lib/models/dm_adapter.rb +15 -4
- data/lib/models/mm_adapter.rb +21 -9
- data/lib/models/mongoid_adapter.rb +67 -0
- data/lib/models/mongoid_user.rb +41 -0
- data/lib/models/mongomapper_user.rb +4 -8
- data/lib/models/rufus_tokyo_user.rb +48 -19
- data/lib/models/sequel_adapter.rb +68 -0
- data/lib/models/sequel_user.rb +53 -0
- data/lib/models/tc_adapter.rb +20 -2
- data/lib/sinatra-authentication.rb +35 -23
- data/lib/sinatra-authentication/models.rb +5 -0
- data/lib/views/edit.haml +1 -1
- data/lib/views/login.haml +3 -3
- data/lib/views/signup.haml +4 -4
- data/readme.markdown +53 -3
- data/sinatra-authentication-0.3.2.gem +0 -0
- data/sinatra-authentication.gemspec +86 -60
- data/spec/run_all_specs.rb +8 -0
- data/spec/unit/dm_model_spec.rb +3 -0
- data/spec/unit/mm_model_spec.rb +3 -0
- data/spec/unit/mongoid_model_spec.rb +3 -0
- data/spec/unit/sequel_model_spec.rb +10 -0
- data/spec/unit/tc_model_spec.rb +3 -0
- data/spec/unit/user_specs.rb +119 -0
- data/test/lib/dm_app.rb +1 -0
- data/test/lib/dm_extend_app.rb +1 -0
- data/test/lib/extend_views/edit.haml +4 -0
- data/test/lib/extend_views/signup.haml +4 -4
- data/test/lib/helper.rb +4 -0
- data/test/lib/mm_app.rb +16 -15
- data/test/lib/mongoid_app.rb +29 -0
- data/test/lib/sequel_app.rb +22 -0
- data/test/lib/tc_app.rb +2 -0
- data/test/mongoid_test.rb +5 -0
- data/test/mongomapper_test.rb +36 -35
- data/test/sequel_test.rb +5 -0
- metadata +40 -24
- data/.gitignore +0 -4
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'sinatra'
|
3
|
+
require 'haml'
|
4
|
+
require 'sequel'
|
5
|
+
require 'rack-flash'
|
6
|
+
|
7
|
+
#DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/test.db")
|
8
|
+
#DataMapper.auto_migrate!
|
9
|
+
DB = Sequel.sqlite(:database => 'test.db')
|
10
|
+
|
11
|
+
require File.join(File.dirname(__FILE__), '../../lib/sinatra-authentication')
|
12
|
+
|
13
|
+
use Rack::Session::Cookie, :secret => "heyhihello"
|
14
|
+
use Rack::Flash
|
15
|
+
|
16
|
+
set :environment, 'development'
|
17
|
+
set :public, 'public'
|
18
|
+
set :views, 'views'
|
19
|
+
|
20
|
+
get '/' do
|
21
|
+
haml "= render_login_logout", :layout => :layout
|
22
|
+
end
|
data/test/lib/tc_app.rb
CHANGED
@@ -2,9 +2,11 @@ require 'rubygems'
|
|
2
2
|
require 'sinatra'
|
3
3
|
require 'haml'
|
4
4
|
require 'rufus/tokyo'
|
5
|
+
require 'rack-flash'
|
5
6
|
require File.join(File.dirname(__FILE__), '../../lib/sinatra-authentication')
|
6
7
|
|
7
8
|
use Rack::Session::Cookie, :secret => "heyhihello"
|
9
|
+
use Rack::Flash
|
8
10
|
TcUserTable.cabinet_path = File.dirname(__FILE__)
|
9
11
|
|
10
12
|
set :environment, 'development'
|
data/test/mongomapper_test.rb
CHANGED
@@ -2,38 +2,39 @@ require 'lib/mm_app'
|
|
2
2
|
require 'lib/helper'
|
3
3
|
require 'test/unit'
|
4
4
|
require 'rack/test'
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
assert
|
28
|
-
assert
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
end
|
5
|
+
require 'route_tests'
|
6
|
+
|
7
|
+
#Test::Unit::TestCase.send :include, Rack::Test::Methods
|
8
|
+
|
9
|
+
#class SinatraAuthMongoMapperTest < Test::Unit::TestCase
|
10
|
+
# include Rack::Test::Methods
|
11
|
+
#
|
12
|
+
# def app
|
13
|
+
# TestApp
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# def setup
|
17
|
+
# post '/signup', TestHelper.gen_user
|
18
|
+
# follow_redirect!
|
19
|
+
# get '/logout'
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# def test_should_login
|
23
|
+
# post '/login', {'email' => TestHelper.gen_user['user[email]'], 'password' => TestHelper.gen_user['user[password]']}
|
24
|
+
# follow_redirect!
|
25
|
+
#
|
26
|
+
# assert_equal 'http://example.org/', last_request.url
|
27
|
+
# #assert cookie_jar['user']
|
28
|
+
# assert last_request.env['rack.session'][:user]
|
29
|
+
# assert last_response.ok?
|
30
|
+
# end
|
31
|
+
#
|
32
|
+
# def test_should_logout
|
33
|
+
# post '/login', {'email' => TestHelper.gen_user['user[email]'], 'password' => TestHelper.gen_user['user[password]']}
|
34
|
+
# get '/logout'
|
35
|
+
# follow_redirect!
|
36
|
+
#
|
37
|
+
# assert !last_request.env['rack.session'][:user]
|
38
|
+
# assert_equal 'http://example.org/', last_request.url
|
39
|
+
# end
|
40
|
+
#end
|
data/test/sequel_test.rb
ADDED
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-authentication
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 23
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
7
|
+
- 4
|
8
|
+
- 0
|
9
|
+
version: 0.4.0
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Max Justus Spransy
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-
|
17
|
+
date: 2010-12-13 00:00:00 -06:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
@@ -26,7 +25,6 @@ dependencies:
|
|
26
25
|
requirements:
|
27
26
|
- - ">="
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
28
|
segments:
|
31
29
|
- 0
|
32
30
|
version: "0"
|
@@ -40,7 +38,6 @@ dependencies:
|
|
40
38
|
requirements:
|
41
39
|
- - ">="
|
42
40
|
- !ruby/object:Gem::Version
|
43
|
-
hash: 3
|
44
41
|
segments:
|
45
42
|
- 0
|
46
43
|
version: "0"
|
@@ -54,7 +51,6 @@ dependencies:
|
|
54
51
|
requirements:
|
55
52
|
- - ">="
|
56
53
|
- !ruby/object:Gem::Version
|
57
|
-
hash: 3
|
58
54
|
segments:
|
59
55
|
- 0
|
60
56
|
version: "0"
|
@@ -68,7 +64,6 @@ dependencies:
|
|
68
64
|
requirements:
|
69
65
|
- - ">="
|
70
66
|
- !ruby/object:Gem::Version
|
71
|
-
hash: 3
|
72
67
|
segments:
|
73
68
|
- 0
|
74
69
|
version: "0"
|
@@ -82,7 +77,6 @@ dependencies:
|
|
82
77
|
requirements:
|
83
78
|
- - ">="
|
84
79
|
- !ruby/object:Gem::Version
|
85
|
-
hash: 3
|
86
80
|
segments:
|
87
81
|
- 0
|
88
82
|
version: "0"
|
@@ -96,7 +90,6 @@ dependencies:
|
|
96
90
|
requirements:
|
97
91
|
- - ">="
|
98
92
|
- !ruby/object:Gem::Version
|
99
|
-
hash: 3
|
100
93
|
segments:
|
101
94
|
- 0
|
102
95
|
version: "0"
|
@@ -110,7 +103,6 @@ dependencies:
|
|
110
103
|
requirements:
|
111
104
|
- - ">="
|
112
105
|
- !ruby/object:Gem::Version
|
113
|
-
hash: 3
|
114
106
|
segments:
|
115
107
|
- 0
|
116
108
|
version: "0"
|
@@ -124,7 +116,6 @@ dependencies:
|
|
124
116
|
requirements:
|
125
117
|
- - ">="
|
126
118
|
- !ruby/object:Gem::Version
|
127
|
-
hash: 3
|
128
119
|
segments:
|
129
120
|
- 0
|
130
121
|
version: "0"
|
@@ -139,7 +130,6 @@ extensions: []
|
|
139
130
|
extra_rdoc_files:
|
140
131
|
- TODO
|
141
132
|
files:
|
142
|
-
- .gitignore
|
143
133
|
- History.txt
|
144
134
|
- Manifest
|
145
135
|
- Rakefile
|
@@ -158,17 +148,30 @@ files:
|
|
158
148
|
- lib/models/datamapper_user.rb
|
159
149
|
- lib/models/dm_adapter.rb
|
160
150
|
- lib/models/mm_adapter.rb
|
151
|
+
- lib/models/mongoid_adapter.rb
|
152
|
+
- lib/models/mongoid_user.rb
|
161
153
|
- lib/models/mongomapper_user.rb
|
162
154
|
- lib/models/rufus_tokyo_user.rb
|
155
|
+
- lib/models/sequel_adapter.rb
|
156
|
+
- lib/models/sequel_user.rb
|
163
157
|
- lib/models/tc_adapter.rb
|
164
158
|
- lib/sinatra-authentication.rb
|
159
|
+
- lib/sinatra-authentication/models.rb
|
165
160
|
- lib/views/edit.haml
|
166
161
|
- lib/views/index.haml
|
167
162
|
- lib/views/login.haml
|
168
163
|
- lib/views/show.haml
|
169
164
|
- lib/views/signup.haml
|
170
165
|
- readme.markdown
|
166
|
+
- sinatra-authentication-0.3.2.gem
|
171
167
|
- sinatra-authentication.gemspec
|
168
|
+
- spec/run_all_specs.rb
|
169
|
+
- spec/unit/dm_model_spec.rb
|
170
|
+
- spec/unit/mm_model_spec.rb
|
171
|
+
- spec/unit/mongoid_model_spec.rb
|
172
|
+
- spec/unit/sequel_model_spec.rb
|
173
|
+
- spec/unit/tc_model_spec.rb
|
174
|
+
- spec/unit/user_specs.rb
|
172
175
|
- test/datamapper_test.rb
|
173
176
|
- test/lib/dm_app.rb
|
174
177
|
- test/lib/dm_extend_app.rb
|
@@ -180,18 +183,22 @@ files:
|
|
180
183
|
- test/lib/extend_views/signup.haml
|
181
184
|
- test/lib/helper.rb
|
182
185
|
- test/lib/mm_app.rb
|
186
|
+
- test/lib/mongoid_app.rb
|
187
|
+
- test/lib/sequel_app.rb
|
183
188
|
- test/lib/tc_app.rb
|
184
189
|
- test/lib/tc_sinbook.rb
|
190
|
+
- test/mongoid_test.rb
|
185
191
|
- test/mongomapper_test.rb
|
186
192
|
- test/route_tests.rb
|
187
193
|
- test/rufus_tokyo_test.rb
|
194
|
+
- test/sequel_test.rb
|
188
195
|
has_rdoc: true
|
189
196
|
homepage: http://github.com/maxjustus/sinatra-authentication
|
190
197
|
licenses: []
|
191
198
|
|
192
199
|
post_install_message:
|
193
|
-
rdoc_options:
|
194
|
-
|
200
|
+
rdoc_options: []
|
201
|
+
|
195
202
|
require_paths:
|
196
203
|
- lib
|
197
204
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -199,7 +206,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
199
206
|
requirements:
|
200
207
|
- - ">="
|
201
208
|
- !ruby/object:Gem::Version
|
202
|
-
hash: 3
|
203
209
|
segments:
|
204
210
|
- 0
|
205
211
|
version: "0"
|
@@ -208,7 +214,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
214
|
requirements:
|
209
215
|
- - ">="
|
210
216
|
- !ruby/object:Gem::Version
|
211
|
-
hash: 3
|
212
217
|
segments:
|
213
218
|
- 0
|
214
219
|
version: "0"
|
@@ -220,14 +225,25 @@ signing_key:
|
|
220
225
|
specification_version: 3
|
221
226
|
summary: Simple authentication plugin for sinatra.
|
222
227
|
test_files:
|
228
|
+
- spec/run_all_specs.rb
|
229
|
+
- spec/unit/dm_model_spec.rb
|
230
|
+
- spec/unit/mm_model_spec.rb
|
231
|
+
- spec/unit/mongoid_model_spec.rb
|
232
|
+
- spec/unit/sequel_model_spec.rb
|
233
|
+
- spec/unit/tc_model_spec.rb
|
234
|
+
- spec/unit/user_specs.rb
|
235
|
+
- test/datamapper_test.rb
|
236
|
+
- test/lib/dm_app.rb
|
237
|
+
- test/lib/dm_extend_app.rb
|
223
238
|
- test/lib/dm_sinbook.rb
|
224
|
-
- test/lib/
|
239
|
+
- test/lib/helper.rb
|
225
240
|
- test/lib/mm_app.rb
|
241
|
+
- test/lib/mongoid_app.rb
|
242
|
+
- test/lib/sequel_app.rb
|
243
|
+
- test/lib/tc_app.rb
|
226
244
|
- test/lib/tc_sinbook.rb
|
227
|
-
- test/
|
228
|
-
- test/lib/dm_extend_app.rb
|
229
|
-
- test/lib/dm_app.rb
|
230
|
-
- test/datamapper_test.rb
|
245
|
+
- test/mongoid_test.rb
|
231
246
|
- test/mongomapper_test.rb
|
232
|
-
- test/rufus_tokyo_test.rb
|
233
247
|
- test/route_tests.rb
|
248
|
+
- test/rufus_tokyo_test.rb
|
249
|
+
- test/sequel_test.rb
|
data/.gitignore
DELETED