userify 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -35,7 +35,7 @@ task :default => ['test:all', 'test:features']
35
35
 
36
36
  gem_spec = Gem::Specification.new do |gem_spec|
37
37
  gem_spec.name = "userify"
38
- gem_spec.version = "0.2.4"
38
+ gem_spec.version = "0.2.5"
39
39
  gem_spec.summary = "Super simple authentication system for Rails, using username, email and password."
40
40
  gem_spec.email = "kenn.ejima <at> gmail.com"
41
41
  gem_spec.homepage = "http://github.com/kenn/userify"
@@ -16,9 +16,6 @@ class UserifyGenerator < Rails::Generator::Base
16
16
  m.file "user.rb", user_model
17
17
  end
18
18
 
19
- m.directory File.join("lib", "userify")
20
- m.file "uid.rb", "lib/userify/uid.rb", :collision => :ask
21
-
22
19
  m.migration_template "migrations/create_users.rb",
23
20
  'db/migrate',
24
21
  :migration_file_name => "userify_create_users"
@@ -32,12 +32,16 @@ class UID
32
32
  def to_hex
33
33
  @value.to_s(16)
34
34
  end
35
+
36
+ def self.generate(n=6)
37
+ [*0..9,*?A..?Z,*?a..?z].sample(n).join
38
+ end
35
39
  end
36
40
 
37
41
  class String
38
42
  BASE62_PRIMITIVES = {}.tap do |h|
39
43
  (('0'..'9').to_a + ('A'..'Z').to_a + ('a'..'z').to_a).each_with_index {|e, i| h[e] = i }
40
- end
44
+ end unless defined?(BASE62_PRIMITIVES)
41
45
 
42
46
  def base62
43
47
  i = 0
@@ -53,7 +57,7 @@ end
53
57
 
54
58
 
55
59
  class Integer
56
- BASE62_PRIMITIVES = ('0'..'9').to_a + ('A'..'Z').to_a + ('a'..'z').to_a
60
+ BASE62_PRIMITIVES = ('0'..'9').to_a + ('A'..'Z').to_a + ('a'..'z').to_a unless defined?(BASE62_PRIMITIVES)
57
61
 
58
62
  def base62
59
63
  number = self
@@ -64,4 +68,4 @@ class Integer
64
68
  end
65
69
  result
66
70
  end
67
- end
71
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: userify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenn Ejima
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-05 00:00:00 -08:00
12
+ date: 2010-03-23 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -42,13 +42,13 @@ files:
42
42
  - generators/userify/lib/rake_commands.rb
43
43
  - generators/userify/templates/migrations/create_users.rb
44
44
  - generators/userify/templates/README
45
- - generators/userify/templates/uid.rb
46
45
  - generators/userify/templates/user.rb
47
46
  - generators/userify/USAGE
48
47
  - generators/userify/userify_generator.rb
49
48
  - lib/userify/authentication.rb
50
49
  - lib/userify/extensions/errors.rb
51
50
  - lib/userify/extensions/rescue.rb
51
+ - lib/userify/uid.rb
52
52
  - lib/userify/user.rb
53
53
  - lib/userify.rb
54
54
  - rails/init.rb