sorcery 0.7.4 → 0.8.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.
Files changed (70) hide show
  1. data/.travis.yml +3 -0
  2. data/Gemfile +9 -4
  3. data/Gemfile.lock +103 -62
  4. data/README.rdoc +33 -8
  5. data/Rakefile +6 -7
  6. data/VERSION +1 -1
  7. data/lib/generators/sorcery/install_generator.rb +15 -10
  8. data/lib/generators/sorcery/templates/initializer.rb +343 -125
  9. data/lib/generators/sorcery/templates/migration/brute_force_protection.rb +2 -0
  10. data/lib/generators/sorcery/templates/migration/reset_password.rb +1 -1
  11. data/lib/sorcery/controller/submodules/activity_logging.rb +3 -3
  12. data/lib/sorcery/controller/submodules/brute_force_protection.rb +1 -2
  13. data/lib/sorcery/controller/submodules/external/protocols/oauth2.rb +19 -19
  14. data/lib/sorcery/controller/submodules/external/providers/facebook.rb +20 -5
  15. data/lib/sorcery/controller/submodules/external/providers/github.rb +15 -4
  16. data/lib/sorcery/controller/submodules/external/providers/google.rb +90 -0
  17. data/lib/sorcery/controller/submodules/external/providers/linkedin.rb +101 -0
  18. data/lib/sorcery/controller/submodules/external/providers/liveid.rb +91 -0
  19. data/lib/sorcery/controller/submodules/external/providers/twitter.rb +2 -1
  20. data/lib/sorcery/controller/submodules/external/providers/vkontakte.rb +94 -0
  21. data/lib/sorcery/controller/submodules/external.rb +89 -15
  22. data/lib/sorcery/controller/submodules/http_basic_auth.rb +1 -1
  23. data/lib/sorcery/controller/submodules/remember_me.rb +11 -2
  24. data/lib/sorcery/controller.rb +14 -6
  25. data/lib/sorcery/crypto_providers/bcrypt.rb +1 -0
  26. data/lib/sorcery/model/adapters/active_record.rb +21 -1
  27. data/lib/sorcery/model/adapters/mongo_mapper.rb +22 -15
  28. data/lib/sorcery/model/adapters/mongoid.rb +20 -3
  29. data/lib/sorcery/model/submodules/activity_logging.rb +4 -4
  30. data/lib/sorcery/model/submodules/brute_force_protection.rb +46 -15
  31. data/lib/sorcery/model/submodules/remember_me.rb +4 -6
  32. data/lib/sorcery/model/submodules/reset_password.rb +18 -12
  33. data/lib/sorcery/model/submodules/user_activation.rb +15 -8
  34. data/lib/sorcery/model.rb +57 -43
  35. data/lib/sorcery/railties/tasks.rake +2 -0
  36. data/lib/sorcery.rb +5 -1
  37. data/sorcery.gemspec +33 -21
  38. data/spec/Gemfile +1 -1
  39. data/spec/Gemfile.lock +22 -21
  40. data/spec/README.md +8 -8
  41. data/spec/rails3/Gemfile +3 -3
  42. data/spec/rails3/Gemfile.lock +55 -33
  43. data/spec/rails3/app/controllers/application_controller.rb +85 -2
  44. data/spec/rails3/app/mailers/sorcery_mailer.rb +7 -0
  45. data/spec/rails3/app/views/sorcery_mailer/send_unlock_token_email.text.erb +1 -0
  46. data/spec/rails3/config/environments/in_memory.rb +35 -0
  47. data/spec/rails3/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb +2 -0
  48. data/spec/rails3/spec/controller_activity_logging_spec.rb +10 -0
  49. data/spec/rails3/spec/controller_brute_force_protection_spec.rb +23 -1
  50. data/spec/rails3/spec/controller_oauth2_spec.rb +260 -22
  51. data/spec/rails3/spec/controller_oauth_spec.rb +111 -6
  52. data/spec/rails3/spec/controller_spec.rb +37 -2
  53. data/spec/rails3/spec/integration_spec.rb +15 -15
  54. data/spec/rails3/spec/spec_helper.rb +1 -1
  55. data/spec/rails3_mongo_mapper/Gemfile +2 -1
  56. data/spec/rails3_mongo_mapper/Gemfile.lock +40 -42
  57. data/spec/rails3_mongo_mapper/app/controllers/application_controller.rb +14 -0
  58. data/spec/rails3_mongo_mapper/spec/controller_spec.rb +41 -1
  59. data/spec/rails3_mongoid/Gemfile +1 -0
  60. data/spec/rails3_mongoid/Gemfile.lock +30 -27
  61. data/spec/rails3_mongoid/app/controllers/application_controller.rb +19 -0
  62. data/spec/rails3_mongoid/config/mongoid.yml +1 -1
  63. data/spec/rails3_mongoid/spec/controller_activity_logging_spec.rb +18 -11
  64. data/spec/rails3_mongoid/spec/controller_spec.rb +41 -1
  65. data/spec/shared_examples/controller_oauth2_shared_examples.rb +20 -1
  66. data/spec/shared_examples/controller_oauth_shared_examples.rb +18 -0
  67. data/spec/shared_examples/user_activation_shared_examples.rb +71 -41
  68. data/spec/shared_examples/user_reset_password_shared_examples.rb +80 -27
  69. data/spec/sorcery_crypto_providers_spec.rb +14 -1
  70. metadata +74 -46
data/lib/sorcery/model.rb CHANGED
@@ -17,39 +17,39 @@ module Sorcery
17
17
  include InstanceMethods
18
18
  include TemporaryToken
19
19
  end
20
-
20
+
21
21
  include_required_submodules!
22
22
 
23
23
  # This runs the options block set in the initializer on the model class.
24
24
  ::Sorcery::Controller::Config.user_config.tap{|blk| blk.call(@sorcery_config) if blk}
25
-
25
+
26
26
  init_mongoid_support! if defined?(Mongoid) and self.ancestors.include?(Mongoid::Document)
27
27
  init_mongo_mapper_support! if defined?(MongoMapper) and self.ancestors.include?(MongoMapper::Document)
28
28
 
29
29
  init_orm_hooks!
30
-
30
+
31
31
  @sorcery_config.after_config << :add_config_inheritance if @sorcery_config.subclasses_inherit_config
32
32
  @sorcery_config.after_config.each { |c| send(c) }
33
33
  end
34
-
34
+
35
35
  protected
36
-
37
- # includes required submodules into the model class,
36
+
37
+ # includes required submodules into the model class,
38
38
  # which usually is called User.
39
39
  def include_required_submodules!
40
40
  self.class_eval do
41
41
  @sorcery_config.submodules = ::Sorcery::Controller::Config.submodules
42
42
  @sorcery_config.submodules.each do |mod|
43
43
  begin
44
- include Submodules.const_get(mod.to_s.split("_").map {|p| p.capitalize}.join(""))
44
+ include Submodules.const_get(mod.to_s.split("_").map {|p| p.capitalize}.join(""))
45
45
  rescue NameError
46
- # don't stop on a missing submodule. Needed because some submodules are only defined
46
+ # don't stop on a missing submodule. Needed because some submodules are only defined
47
47
  # in the controller side.
48
48
  end
49
49
  end
50
50
  end
51
51
  end
52
-
52
+
53
53
  # defines mongoid fields on the model class,
54
54
  # using 1.8.x hash syntax to perserve compatibility.
55
55
  def init_mongoid_support!
@@ -62,7 +62,7 @@ module Sorcery
62
62
  field sorcery_config.salt_attribute_name, :type => String
63
63
  end
64
64
  end
65
-
65
+
66
66
  # defines mongo_mapper fields on the model class,
67
67
  def init_mongo_mapper_support!
68
68
  self.class_eval do
@@ -91,42 +91,51 @@ module Sorcery
91
91
  end
92
92
  end
93
93
  end
94
-
94
+
95
95
  module ClassMethods
96
96
  # Returns the class instance variable for configuration, when called by the class itself.
97
97
  def sorcery_config
98
98
  @sorcery_config
99
99
  end
100
-
100
+
101
101
  # The default authentication method.
102
102
  # Takes a username and password,
103
103
  # Finds the user by the username and compares the user's password to the one supplied to the method.
104
104
  # returns the user if success, nil otherwise.
105
105
  def authenticate(*credentials)
106
106
  raise ArgumentError, "at least 2 arguments required" if credentials.size < 2
107
+ credentials[0].downcase! if @sorcery_config.downcase_username_before_authenticating
107
108
  user = find_by_credentials(credentials)
109
+
110
+ set_encryption_attributes()
111
+
108
112
  _salt = user.send(@sorcery_config.salt_attribute_name) if user && !@sorcery_config.salt_attribute_name.nil? && !@sorcery_config.encryption_provider.nil?
109
113
  user if user && @sorcery_config.before_authenticate.all? {|c| user.send(c)} && credentials_match?(user.send(@sorcery_config.crypted_password_attribute_name),credentials[1],_salt)
110
114
  end
111
-
115
+
112
116
  # encrypt tokens using current encryption_provider.
113
117
  def encrypt(*tokens)
114
118
  return tokens.first if @sorcery_config.encryption_provider.nil?
115
-
116
- @sorcery_config.encryption_provider.stretches = @sorcery_config.stretches if @sorcery_config.encryption_provider.respond_to?(:stretches) && @sorcery_config.stretches
117
- @sorcery_config.encryption_provider.join_token = @sorcery_config.salt_join_token if @sorcery_config.encryption_provider.respond_to?(:join_token) && @sorcery_config.salt_join_token
119
+
120
+ set_encryption_attributes()
121
+
118
122
  CryptoProviders::AES256.key = @sorcery_config.encryption_key
119
123
  @sorcery_config.encryption_provider.encrypt(*tokens)
120
124
  end
121
-
125
+
122
126
  protected
123
-
127
+
128
+ def set_encryption_attributes()
129
+ @sorcery_config.encryption_provider.stretches = @sorcery_config.stretches if @sorcery_config.encryption_provider.respond_to?(:stretches) && @sorcery_config.stretches
130
+ @sorcery_config.encryption_provider.join_token = @sorcery_config.salt_join_token if @sorcery_config.encryption_provider.respond_to?(:join_token) && @sorcery_config.salt_join_token
131
+ end
132
+
124
133
  # Calls the configured encryption provider to compare the supplied password with the encrypted one.
125
134
  def credentials_match?(crypted, *tokens)
126
135
  return crypted == tokens.join if @sorcery_config.encryption_provider.nil?
127
136
  @sorcery_config.encryption_provider.matches?(crypted, *tokens)
128
137
  end
129
-
138
+
130
139
  def add_config_inheritance
131
140
  self.class_eval do
132
141
  def self.inherited(subclass)
@@ -140,23 +149,23 @@ module Sorcery
140
149
  end
141
150
  end
142
151
  end
143
-
152
+
144
153
  end
145
-
154
+
146
155
  module InstanceMethods
147
156
  # Returns the class instance variable for configuration, when called by an instance.
148
157
  def sorcery_config
149
158
  self.class.sorcery_config
150
159
  end
151
-
160
+
152
161
  # identifies whether this user is regular, i.e. we hold his credentials in our db,
153
162
  # or that he is external, and his credentials are saved elsewhere (twitter/facebook etc.).
154
163
  def external?
155
164
  send(sorcery_config.crypted_password_attribute_name).nil?
156
165
  end
157
-
166
+
158
167
  protected
159
-
168
+
160
169
  # creates new salt and saves it.
161
170
  # encrypts password with salt and saves it.
162
171
  def encrypt_password
@@ -169,47 +178,50 @@ module Sorcery
169
178
  config = sorcery_config
170
179
  self.send(:"#{config.password_attribute_name}=", nil)
171
180
  end
172
-
181
+
173
182
  # calls the requested email method on the configured mailer
174
183
  # supports both the ActionMailer 3 way of calling, and the plain old Ruby object way.
175
184
  def generic_send_email(method, mailer)
176
185
  config = sorcery_config
177
186
  mail = config.send(mailer).send(config.send(method),self)
178
- if defined?(ActionMailer) and config.send(mailer).superclass == ActionMailer::Base
187
+ if defined?(ActionMailer) and config.send(mailer).kind_of?(Class) and config.send(mailer) < ActionMailer::Base
179
188
  mail.deliver
180
189
  end
181
190
  end
182
191
  end
183
192
 
184
193
  # Each class which calls 'activate_sorcery!' receives an instance of this class.
185
- # Every submodule which gets loaded may add accessors to this class so that all
194
+ # Every submodule which gets loaded may add accessors to this class so that all
186
195
  # options will be configured from a single place.
187
196
  class Config
188
197
 
189
198
  attr_accessor :username_attribute_names, # change default username attribute, for example, to use :email
190
199
  # as the login.
191
-
200
+
192
201
  :password_attribute_name, # change *virtual* password attribute, the one which is used
193
202
  # until an encrypted one is generated.
194
-
203
+
195
204
  :email_attribute_name, # change default email attribute.
205
+
206
+ :downcase_username_before_authenticating, # downcase the username before trying to authenticate, default is false
207
+
196
208
  :crypted_password_attribute_name, # change default crypted_password attribute.
197
209
  :salt_join_token, # what pattern to use to join the password with the salt
198
210
  :salt_attribute_name, # change default salt attribute.
199
211
  :stretches, # how many times to apply encryption to the password.
200
212
  :encryption_key, # encryption key used to encrypt reversible encryptions such as
201
213
  # AES256.
202
-
214
+
203
215
  :subclasses_inherit_config, # make this configuration inheritable for subclasses. Useful for
204
216
  # ActiveRecord's STI.
205
-
217
+
206
218
  :submodules, # configured in config/application.rb
207
219
  :before_authenticate, # an array of method names to call before authentication
208
220
  # completes. used internally.
209
-
221
+
210
222
  :after_config # an array of method names to call after configuration by user.
211
223
  # used internally.
212
-
224
+
213
225
  attr_reader :encryption_provider, # change default encryption_provider.
214
226
  :custom_encryption_provider, # use an external encryption class.
215
227
  :encryption_algorithm # encryption algorithm name. See 'encryption_algorithm=' below
@@ -220,6 +232,7 @@ module Sorcery
220
232
  :@submodules => [],
221
233
  :@username_attribute_names => [:username],
222
234
  :@password_attribute_name => :password,
235
+ :@downcase_username_before_authenticating => false,
223
236
  :@email_attribute_name => :email,
224
237
  :@crypted_password_attribute_name => :crypted_password,
225
238
  :@encryption_algorithm => :bcrypt,
@@ -234,26 +247,26 @@ module Sorcery
234
247
  :@after_config => []
235
248
  }
236
249
  reset!
237
- end
238
-
250
+ end
251
+
239
252
  # Resets all configuration options to their default values.
240
253
  def reset!
241
254
  @defaults.each do |k,v|
242
255
  instance_variable_set(k,v)
243
- end
256
+ end
244
257
  end
245
-
258
+
246
259
  def username_attribute_names=(fields)
247
260
  @username_attribute_names = fields.kind_of?(Array) ? fields : [fields]
248
261
  end
249
-
262
+
250
263
  def custom_encryption_provider=(provider)
251
264
  @custom_encryption_provider = @encryption_provider = provider
252
265
  end
253
-
266
+
254
267
  def encryption_algorithm=(algo)
255
268
  @encryption_algorithm = algo
256
- @encryption_provider = case @encryption_algorithm
269
+ @encryption_provider = case @encryption_algorithm.to_sym
257
270
  when :none then nil
258
271
  when :md5 then CryptoProviders::MD5
259
272
  when :sha1 then CryptoProviders::SHA1
@@ -262,10 +275,11 @@ module Sorcery
262
275
  when :aes256 then CryptoProviders::AES256
263
276
  when :bcrypt then CryptoProviders::BCrypt
264
277
  when :custom then @custom_encryption_provider
278
+ else raise ArgumentError.new("Encryption algorithm supplied, #{algo}, is invalid")
265
279
  end
266
280
  end
267
-
281
+
268
282
  end
269
-
283
+
270
284
  end
271
- end
285
+ end
@@ -3,6 +3,8 @@ require 'fileutils'
3
3
  namespace :sorcery do
4
4
  desc "Adds sorcery's initializer file"
5
5
  task :bootstrap do
6
+ warn "This task is obsolete.\nUse \"rails g sorcery:install\" now.\nSee README for more information."
7
+
6
8
  src = File.join(File.dirname(__FILE__), '..', 'initializers', 'initializer.rb')
7
9
  target = File.join(Rails.root, "config", "initializers", "sorcery.rb")
8
10
  FileUtils.cp(src, target)
data/lib/sorcery.rb CHANGED
@@ -34,6 +34,10 @@ module Sorcery
34
34
  autoload :Twitter, 'sorcery/controller/submodules/external/providers/twitter'
35
35
  autoload :Facebook, 'sorcery/controller/submodules/external/providers/facebook'
36
36
  autoload :Github, 'sorcery/controller/submodules/external/providers/github'
37
+ autoload :Google, 'sorcery/controller/submodules/external/providers/google'
38
+ autoload :Liveid, 'sorcery/controller/submodules/external/providers/liveid'
39
+ autoload :Linkedin, 'sorcery/controller/submodules/external/providers/linkedin'
40
+ autoload :Vkontakte, 'sorcery/controller/submodules/external/providers/vkontakte'
37
41
  end
38
42
  end
39
43
  end
@@ -76,5 +80,5 @@ module Sorcery
76
80
  MongoMapper::Document.send(:plugin, Sorcery::Model::Adapters::MongoMapper)
77
81
  end
78
82
 
79
- require 'sorcery/engine' if defined?(Rails) && Rails::VERSION::MAJOR == 3
83
+ require 'sorcery/engine' if defined?(Rails) && Rails::VERSION::MAJOR >= 3
80
84
  end
data/sorcery.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "sorcery"
8
- s.version = "0.7.4"
8
+ s.version = "0.8.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Noam Ben Ari"]
12
- s.date = "2011-10-29"
12
+ s.date = "2013-01-12"
13
13
  s.description = "Provides common authentication needs such as signing in/out, activating by email and resetting password."
14
14
  s.email = "nbenari@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.files = [
20
20
  ".document",
21
21
  ".rspec",
22
+ ".travis.yml",
22
23
  "Gemfile",
23
24
  "Gemfile.lock",
24
25
  "LICENSE.txt",
@@ -45,7 +46,11 @@ Gem::Specification.new do |s|
45
46
  "lib/sorcery/controller/submodules/external/protocols/oauth2.rb",
46
47
  "lib/sorcery/controller/submodules/external/providers/facebook.rb",
47
48
  "lib/sorcery/controller/submodules/external/providers/github.rb",
49
+ "lib/sorcery/controller/submodules/external/providers/google.rb",
50
+ "lib/sorcery/controller/submodules/external/providers/linkedin.rb",
51
+ "lib/sorcery/controller/submodules/external/providers/liveid.rb",
48
52
  "lib/sorcery/controller/submodules/external/providers/twitter.rb",
53
+ "lib/sorcery/controller/submodules/external/providers/vkontakte.rb",
49
54
  "lib/sorcery/controller/submodules/http_basic_auth.rb",
50
55
  "lib/sorcery/controller/submodules/remember_me.rb",
51
56
  "lib/sorcery/controller/submodules/session_timeout.rb",
@@ -97,6 +102,7 @@ Gem::Specification.new do |s|
97
102
  "spec/rails3/app/views/sorcery_mailer/activation_success_email.text.erb",
98
103
  "spec/rails3/app/views/sorcery_mailer/reset_password_email.html.erb",
99
104
  "spec/rails3/app/views/sorcery_mailer/reset_password_email.text.erb",
105
+ "spec/rails3/app/views/sorcery_mailer/send_unlock_token_email.text.erb",
100
106
  "spec/rails3/config.ru",
101
107
  "spec/rails3/config/application.rb",
102
108
  "spec/rails3/config/boot.rb",
@@ -298,7 +304,7 @@ Gem::Specification.new do |s|
298
304
  s.homepage = "http://github.com/NoamB/sorcery"
299
305
  s.licenses = ["MIT"]
300
306
  s.require_paths = ["lib"]
301
- s.rubygems_version = "1.8.11"
307
+ s.rubygems_version = "1.8.21"
302
308
  s.summary = "Magical authentication for Rails 3 applications"
303
309
 
304
310
  if s.respond_to? :specification_version then
@@ -306,7 +312,9 @@ Gem::Specification.new do |s|
306
312
 
307
313
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
308
314
  s.add_runtime_dependency(%q<oauth>, ["~> 0.4.4"])
309
- s.add_runtime_dependency(%q<oauth2>, ["~> 0.4.1"])
315
+ s.add_runtime_dependency(%q<oauth2>, ["~> 0.8.0"])
316
+ s.add_runtime_dependency(%q<bcrypt-ruby>, ["~> 3.0.0"])
317
+ s.add_development_dependency(%q<abstract>, [">= 1.0.0"])
310
318
  s.add_development_dependency(%q<rails>, [">= 3.0.0"])
311
319
  s.add_development_dependency(%q<json>, [">= 1.5.1"])
312
320
  s.add_development_dependency(%q<rspec>, ["~> 2.5.0"])
@@ -314,16 +322,18 @@ Gem::Specification.new do |s|
314
322
  s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
315
323
  s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
316
324
  s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
317
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
318
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
325
+ s.add_development_dependency(%q<bundler>, [">= 1.1.0"])
326
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
319
327
  s.add_development_dependency(%q<simplecov>, [">= 0.3.8"])
320
328
  s.add_development_dependency(%q<timecop>, [">= 0"])
321
- s.add_runtime_dependency(%q<bcrypt-ruby>, ["~> 3.0.0"])
322
- s.add_runtime_dependency(%q<oauth>, ["~> 0.4.4"])
323
- s.add_runtime_dependency(%q<oauth2>, ["~> 0.4.1"])
329
+ s.add_development_dependency(%q<capybara>, [">= 0"])
330
+ s.add_development_dependency(%q<mongo_mapper>, [">= 0"])
331
+ s.add_development_dependency(%q<mongoid>, ["~> 2.4.4"])
324
332
  else
325
333
  s.add_dependency(%q<oauth>, ["~> 0.4.4"])
326
- s.add_dependency(%q<oauth2>, ["~> 0.4.1"])
334
+ s.add_dependency(%q<oauth2>, ["~> 0.8.0"])
335
+ s.add_dependency(%q<bcrypt-ruby>, ["~> 3.0.0"])
336
+ s.add_dependency(%q<abstract>, [">= 1.0.0"])
327
337
  s.add_dependency(%q<rails>, [">= 3.0.0"])
328
338
  s.add_dependency(%q<json>, [">= 1.5.1"])
329
339
  s.add_dependency(%q<rspec>, ["~> 2.5.0"])
@@ -331,17 +341,19 @@ Gem::Specification.new do |s|
331
341
  s.add_dependency(%q<ruby-debug19>, [">= 0"])
332
342
  s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
333
343
  s.add_dependency(%q<yard>, ["~> 0.6.0"])
334
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
335
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
344
+ s.add_dependency(%q<bundler>, [">= 1.1.0"])
345
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
336
346
  s.add_dependency(%q<simplecov>, [">= 0.3.8"])
337
347
  s.add_dependency(%q<timecop>, [">= 0"])
338
- s.add_dependency(%q<bcrypt-ruby>, ["~> 3.0.0"])
339
- s.add_dependency(%q<oauth>, ["~> 0.4.4"])
340
- s.add_dependency(%q<oauth2>, ["~> 0.4.1"])
348
+ s.add_dependency(%q<capybara>, [">= 0"])
349
+ s.add_dependency(%q<mongo_mapper>, [">= 0"])
350
+ s.add_dependency(%q<mongoid>, ["~> 2.4.4"])
341
351
  end
342
352
  else
343
353
  s.add_dependency(%q<oauth>, ["~> 0.4.4"])
344
- s.add_dependency(%q<oauth2>, ["~> 0.4.1"])
354
+ s.add_dependency(%q<oauth2>, ["~> 0.8.0"])
355
+ s.add_dependency(%q<bcrypt-ruby>, ["~> 3.0.0"])
356
+ s.add_dependency(%q<abstract>, [">= 1.0.0"])
345
357
  s.add_dependency(%q<rails>, [">= 3.0.0"])
346
358
  s.add_dependency(%q<json>, [">= 1.5.1"])
347
359
  s.add_dependency(%q<rspec>, ["~> 2.5.0"])
@@ -349,13 +361,13 @@ Gem::Specification.new do |s|
349
361
  s.add_dependency(%q<ruby-debug19>, [">= 0"])
350
362
  s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
351
363
  s.add_dependency(%q<yard>, ["~> 0.6.0"])
352
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
353
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
364
+ s.add_dependency(%q<bundler>, [">= 1.1.0"])
365
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
354
366
  s.add_dependency(%q<simplecov>, [">= 0.3.8"])
355
367
  s.add_dependency(%q<timecop>, [">= 0"])
356
- s.add_dependency(%q<bcrypt-ruby>, ["~> 3.0.0"])
357
- s.add_dependency(%q<oauth>, ["~> 0.4.4"])
358
- s.add_dependency(%q<oauth2>, ["~> 0.4.1"])
368
+ s.add_dependency(%q<capybara>, [">= 0"])
369
+ s.add_dependency(%q<mongo_mapper>, [">= 0"])
370
+ s.add_dependency(%q<mongoid>, ["~> 2.4.4"])
359
371
  end
360
372
  end
361
373
 
data/spec/Gemfile CHANGED
@@ -4,7 +4,7 @@ gem "rails", '3.0.3'
4
4
  gem 'bcrypt-ruby', :require => 'bcrypt'
5
5
  gem "sorcery", '>= 0.1.0', :path => '../'
6
6
  gem 'oauth', "~> 0.4.4"
7
- gem 'oauth2', "~> 0.4.1"
7
+ gem 'oauth2', "~> 0.8.0"
8
8
  group :development do
9
9
  gem "rspec", "~> 2.5.0"
10
10
  gem 'ruby-debug19'
data/spec/Gemfile.lock CHANGED
@@ -1,12 +1,10 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- sorcery (0.7.2)
4
+ sorcery (0.7.13)
5
5
  bcrypt-ruby (~> 3.0.0)
6
6
  oauth (~> 0.4.4)
7
- oauth (~> 0.4.4)
8
- oauth2 (~> 0.4.1)
9
- oauth2 (~> 0.4.1)
7
+ oauth2 (~> 0.8.0)
10
8
 
11
9
  GEM
12
10
  remote: http://rubygems.org/
@@ -38,20 +36,20 @@ GEM
38
36
  activemodel (= 3.0.3)
39
37
  activesupport (= 3.0.3)
40
38
  activesupport (3.0.3)
41
- addressable (2.2.6)
42
39
  archive-tar-minitar (0.5.2)
43
40
  arel (2.0.10)
44
41
  bcrypt-ruby (3.0.1)
45
42
  builder (2.1.2)
46
- columnize (0.3.4)
43
+ columnize (0.3.6)
47
44
  diff-lcs (1.1.3)
48
45
  erubis (2.6.6)
49
46
  abstract (>= 1.0.0)
50
- faraday (0.6.1)
51
- addressable (~> 2.2.4)
52
- multipart-post (~> 1.1.0)
53
- rack (>= 1.1.0, < 2)
47
+ faraday (0.8.4)
48
+ multipart-post (~> 1.1)
49
+ httpauth (0.2.0)
54
50
  i18n (0.6.0)
51
+ jwt (0.1.5)
52
+ multi_json (>= 1.0)
55
53
  linecache19 (0.5.12)
56
54
  ruby_core_source (>= 0.1.4)
57
55
  mail (2.2.19)
@@ -60,14 +58,17 @@ GEM
60
58
  mime-types (~> 1.16)
61
59
  treetop (~> 1.4.8)
62
60
  mime-types (1.17.2)
63
- multi_json (1.0.3)
64
- multipart-post (1.1.3)
61
+ multi_json (1.1.0)
62
+ multipart-post (1.1.5)
65
63
  oauth (0.4.5)
66
- oauth2 (0.4.1)
67
- faraday (~> 0.6.1)
68
- multi_json (>= 0.0.5)
69
- polyglot (0.3.2)
70
- rack (1.2.4)
64
+ oauth2 (0.8.0)
65
+ faraday (~> 0.8)
66
+ httpauth (~> 0.1)
67
+ jwt (~> 0.1.4)
68
+ multi_json (~> 1.0)
69
+ rack (~> 1.2)
70
+ polyglot (0.3.3)
71
+ rack (1.2.5)
71
72
  rack-mount (0.6.14)
72
73
  rack (>= 1.0.0)
73
74
  rack-test (0.5.7)
@@ -104,15 +105,15 @@ GEM
104
105
  ruby-debug-base19 (>= 0.11.19)
105
106
  ruby_core_source (0.1.5)
106
107
  archive-tar-minitar (>= 0.5.2)
107
- simplecov (0.5.4)
108
- multi_json (~> 1.0.3)
108
+ simplecov (0.6.1)
109
+ multi_json (~> 1.0)
109
110
  simplecov-html (~> 0.5.3)
110
111
  simplecov-html (0.5.3)
111
112
  thor (0.14.6)
112
113
  treetop (1.4.10)
113
114
  polyglot
114
115
  polyglot (>= 0.3.1)
115
- tzinfo (0.3.30)
116
+ tzinfo (0.3.31)
116
117
 
117
118
  PLATFORMS
118
119
  ruby
@@ -120,7 +121,7 @@ PLATFORMS
120
121
  DEPENDENCIES
121
122
  bcrypt-ruby
122
123
  oauth (~> 0.4.4)
123
- oauth2 (~> 0.4.1)
124
+ oauth2 (~> 0.8.0)
124
125
  rails (= 3.0.3)
125
126
  rspec (~> 2.5.0)
126
127
  ruby-debug19
data/spec/README.md CHANGED
@@ -7,25 +7,25 @@ Each sample app runs a set of shared specs ( `spec/shared_examples/*_example.rb`
7
7
  Sorcery has one set of specs (`sorcery_crypto_providers_spec.rb`) that can be run outside of any of the frameworks. To run it simply:
8
8
 
9
9
  cd spec/
10
- bundle install
11
- rake spec
10
+ bundle
11
+ bundle exec rake spec
12
12
 
13
13
  Running Framework Specs
14
14
  -----------------------
15
15
  To run framework specs, cd into each directory, bundle, and run the specs. For example, to run the rails3 specs you would:
16
16
 
17
17
  cd spec/rails3/
18
- bundle install
19
- rake spec
18
+ bundle
19
+ bundle exec rake spec
20
20
 
21
21
  **Note:** the rails3_mongoid and rails3_mongo_mapper sample apps do require, well, MongoDB. Installing MongoDB on mac osx is easy with homebrew. Seeing as you're reading the readme for running specs, I'll assume you can install MongoDB on your machine. For the purpose of running these tests, I put mongod in verbose mode and in the background so I can see it log to stdout.
22
22
 
23
23
  cd spec/rails3_mongoid
24
- bundle install
24
+ bundle
25
25
  mongod -v &
26
- rake spec
26
+ bundle exec rake spec
27
27
 
28
28
  cd spec/rails3_mongo_mapper
29
- bundle install
29
+ bundle
30
30
  mongod -v &
31
- rake spec
31
+ bundle exec rake spec
data/spec/rails3/Gemfile CHANGED
@@ -1,15 +1,15 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
+ gem 'bcrypt-ruby', '~> 3.0.0'
3
4
  gem 'rails', '3.0.3'
4
5
  gem 'sqlite3-ruby', :require => 'sqlite3'
5
6
  gem "sorcery", '>= 0.1.0', :path => '../../'
6
7
 
7
8
  group :development, :test do
8
- gem "rspec", "~> 2.5.0"
9
- gem 'rspec-rails', "~> 2.5.0"
9
+ gem 'rspec-rails', "~> 2.7.0"
10
10
  gem 'ruby-debug19'
11
11
  gem 'simplecov', '>= 0.3.8', :require => false # Will install simplecov-html as a dependency
12
12
  gem 'timecop'
13
- # gem 'capybara', '~> 1.1.1'
13
+ gem 'capybara', '~> 1.1.1'
14
14
  gem 'launchy', '~> 2.0.5'
15
15
  end