devise_uid 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +12 -0
- data/Gemfile +12 -0
- data/README.md +11 -3
- data/devise_uid.gemspec +3 -5
- data/lib/devise_uid/version.rb +1 -1
- data/spec/devise_uid/model_spec.rb +3 -3
- metadata +9 -40
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -2,3 +2,15 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in devise_uid.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
group :test do
|
7
|
+
gem "activerecord"
|
8
|
+
|
9
|
+
platforms :jruby do
|
10
|
+
gem "activerecord-jdbcsqlite3-adapter"
|
11
|
+
end
|
12
|
+
|
13
|
+
platforms :ruby do
|
14
|
+
gem "sqlite3"
|
15
|
+
end
|
16
|
+
end
|
data/README.md
CHANGED
@@ -1,12 +1,20 @@
|
|
1
1
|
# devise_uid
|
2
2
|
|
3
|
-
|
3
|
+
[![Build
|
4
|
+
Status](https://travis-ci.org/jingweno/devise_uid.png?branch=master)](https://travis-ci.org/jingweno/devise_uid)
|
5
|
+
[![Code
|
6
|
+
Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/jingweno/devise_uid)
|
7
|
+
[![Dependency
|
8
|
+
Status](https://gemnasium.com/jingweno/devise_uid.png)](https://gemnasium.com/jingweno/devise_uid)
|
9
|
+
|
10
|
+
Add UID support to Devise. A lot of times, we want a unique ID
|
11
|
+
representing the user model instead of its incremental ID in the
|
12
|
+
database, for example, in API instead of exposing the primary key, we use a random generated unique string to indentify this user.
|
4
13
|
|
5
14
|
## Installation
|
6
15
|
|
7
16
|
Add this line to your application's Gemfile:
|
8
17
|
|
9
|
-
gem 'devise'
|
10
18
|
gem 'devise_uid'
|
11
19
|
|
12
20
|
And then execute:
|
@@ -50,7 +58,7 @@ An uid is generated when a Devise MODEL is created. Access it like this:
|
|
50
58
|
|
51
59
|
```ruby
|
52
60
|
user = User.create(email: "foo@bar.com")
|
53
|
-
puts user.uid
|
61
|
+
puts user.uid # => "V8aS9tucNzKyH39d4Bpq"
|
54
62
|
```
|
55
63
|
|
56
64
|
## Contributing
|
data/devise_uid.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.version = DeviseUid::VERSION
|
9
9
|
gem.authors = ["Jingwen Owen Ou"]
|
10
10
|
gem.email = ["jingweno@gmail.com"]
|
11
|
-
gem.description = %q{Add UID
|
12
|
-
gem.summary = %q{Add UID
|
11
|
+
gem.description = %q{Add UID support to Devise}
|
12
|
+
gem.summary = %q{Add UID support to Devise}
|
13
13
|
gem.homepage = "https://github.com/jingweno/devise_uid"
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split($/)
|
@@ -17,10 +17,8 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
|
-
gem.add_dependency("devise", "
|
20
|
+
gem.add_dependency("devise", ">= 2.1.2")
|
21
21
|
gem.add_dependency("railties", "~> 3.0")
|
22
22
|
|
23
23
|
gem.add_development_dependency "rspec", "~> 2.12"
|
24
|
-
gem.add_development_dependency "activerecord", "~> 3.0"
|
25
|
-
gem.add_development_dependency "sqlite3", "~> 1.3.6"
|
26
24
|
end
|
data/lib/devise_uid/version.rb
CHANGED
@@ -6,15 +6,15 @@ end
|
|
6
6
|
|
7
7
|
describe User do
|
8
8
|
it "generates uid before save" do
|
9
|
-
user = User.create!(email
|
9
|
+
user = User.create!(:email => "foo@bar.com")
|
10
10
|
user.uid.should be
|
11
11
|
end
|
12
12
|
|
13
13
|
it "doesn't generate uid if it has it" do
|
14
|
-
user = User.create!(email
|
14
|
+
user = User.create!(:email => "foo@bar.com")
|
15
15
|
uid = user.uid
|
16
16
|
|
17
|
-
user.update_attributes(email
|
17
|
+
user.update_attributes(:email =>"bar@baz.com")
|
18
18
|
user.uid.should == uid
|
19
19
|
end
|
20
20
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_uid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,14 +9,14 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: devise
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 2.1.2
|
22
22
|
type: :runtime
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 2.1.2
|
30
30
|
- !ruby/object:Gem::Dependency
|
@@ -59,39 +59,7 @@ dependencies:
|
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '2.12'
|
62
|
-
|
63
|
-
name: activerecord
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ~>
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '3.0'
|
70
|
-
type: :development
|
71
|
-
prerelease: false
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '3.0'
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: sqlite3
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ~>
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: 1.3.6
|
86
|
-
type: :development
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ~>
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: 1.3.6
|
94
|
-
description: Add UID stupport to Devise
|
62
|
+
description: Add UID support to Devise
|
95
63
|
email:
|
96
64
|
- jingweno@gmail.com
|
97
65
|
executables: []
|
@@ -99,6 +67,7 @@ extensions: []
|
|
99
67
|
extra_rdoc_files: []
|
100
68
|
files:
|
101
69
|
- .gitignore
|
70
|
+
- .travis.yml
|
102
71
|
- Gemfile
|
103
72
|
- LICENSE.txt
|
104
73
|
- README.md
|
@@ -127,7 +96,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
127
96
|
version: '0'
|
128
97
|
segments:
|
129
98
|
- 0
|
130
|
-
hash:
|
99
|
+
hash: 2354377832034281501
|
131
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
101
|
none: false
|
133
102
|
requirements:
|
@@ -136,13 +105,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
105
|
version: '0'
|
137
106
|
segments:
|
138
107
|
- 0
|
139
|
-
hash:
|
108
|
+
hash: 2354377832034281501
|
140
109
|
requirements: []
|
141
110
|
rubyforge_project:
|
142
111
|
rubygems_version: 1.8.24
|
143
112
|
signing_key:
|
144
113
|
specification_version: 3
|
145
|
-
summary: Add UID
|
114
|
+
summary: Add UID support to Devise
|
146
115
|
test_files:
|
147
116
|
- spec/db/migrate/20100401102949_create_tables.rb
|
148
117
|
- spec/devise_uid/model_spec.rb
|