public_uid 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +144 -0
- data/Rakefile +11 -0
- data/lib/public_uid.rb +29 -0
- data/lib/public_uid/generators/number_random.rb +13 -0
- data/lib/public_uid/generators/range_string.rb +14 -0
- data/lib/public_uid/set_public_uid.rb +37 -0
- data/lib/public_uid/version.rb +3 -0
- data/public_uid.gemspec +26 -0
- data/test/lib/generators/number_random_test.rb +28 -0
- data/test/lib/generators/range_string_test.rb +31 -0
- data/test/lib/set_public_uid_test.rb +75 -0
- data/test/models/custom_public_uid_column_test.rb +30 -0
- data/test/models/model_with_custom_generator_test.rb +40 -0
- data/test/models/model_with_generator_defaults_test.rb +31 -0
- data/test/test_helper.rb +14 -0
- metadata +139 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 032aafb0e5f3992c4ea4197a2eb9e78585d60eee
|
4
|
+
data.tar.gz: d39558dc338f02cd9355fc618660f4cfcd70c57a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 42e863949ee643c5d3b88315b7d7cac6a1d93b870c00f79f47be4a78300d7a8b2ffd45046525bad14bd50433d3cb5ccc6fd743b98ca206b5c974f7c4210af380
|
7
|
+
data.tar.gz: 72cb950c7a4b950fa1c6cb7ff070cdecbd5b34e855dceafc1b41a91094efad682db57b3fb63d87002fc75e8bdf612a60b1adca9bda2c0673f9603644de17d79f
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Tomas Valent
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
# PublicUid
|
2
|
+
|
3
|
+
Generates random string (or random number) to represent public unique
|
4
|
+
record identifier.
|
5
|
+
|
6
|
+
### `public_uid` vs `record.id`
|
7
|
+
|
8
|
+
Let say you're building social network or business dashboard.
|
9
|
+
|
10
|
+
If you publicly display your *record ids* as an unique identificator for
|
11
|
+
accessing your records (as a part of HTML url or in JSON) it's easy to
|
12
|
+
estimate how many records (users, clients, messages, orders,...) you have
|
13
|
+
in the database. Marketing of rival companies may use this information
|
14
|
+
against you.
|
15
|
+
|
16
|
+
This is bad:
|
17
|
+
|
18
|
+
http://eq8.eu/orders/12/edit
|
19
|
+
http://eq8.eu/orders/12-order-for-mouse-and-keyboard/edit
|
20
|
+
|
21
|
+
However if you generate random unique identifier and use that as a public
|
22
|
+
identifier, you won't have to worry about that.
|
23
|
+
|
24
|
+
This is how it should be:
|
25
|
+
|
26
|
+
http://eq8.eu/orders/8395820/edit
|
27
|
+
http://eq8.eu/orders/abaoeule/edit
|
28
|
+
http://eq8.eu/orders/aZc3/edit
|
29
|
+
|
30
|
+
So keep `record.id` for your internal relationships and show `public_id`
|
31
|
+
to the world :smile:
|
32
|
+
|
33
|
+
## Installation
|
34
|
+
|
35
|
+
Add this line to your application's Gemfile:
|
36
|
+
|
37
|
+
gem 'public_uid'
|
38
|
+
|
39
|
+
And then execute:
|
40
|
+
|
41
|
+
$ bundle
|
42
|
+
|
43
|
+
|
44
|
+
## Usage
|
45
|
+
|
46
|
+
Create database column for public unique id
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
class AddPublicUidToUsers < ActiveRecord::Migration
|
50
|
+
def change
|
51
|
+
add_column :users, :public_uid, :string
|
52
|
+
end
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
56
|
+
Tell your model to generate the public identifier
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
class User < ActiveRecord::Base
|
60
|
+
generate_public_uid
|
61
|
+
end
|
62
|
+
```
|
63
|
+
|
64
|
+
This will automatically generate 7 digit random unique number for
|
65
|
+
column `public_uid`.
|
66
|
+
|
67
|
+
|
68
|
+
```irb
|
69
|
+
u = User.new
|
70
|
+
u.public_uid #=> nil
|
71
|
+
u.save! #=> true
|
72
|
+
u.public_uid #=> 9392049
|
73
|
+
```
|
74
|
+
|
75
|
+
If you want to use different column just specify column option:
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
class User < ActiveRecord::Base
|
79
|
+
generate_public_uid column: :guid
|
80
|
+
end
|
81
|
+
```
|
82
|
+
|
83
|
+
```irb
|
84
|
+
u = User.new
|
85
|
+
u.guid #=> nil
|
86
|
+
u.save! #=> true
|
87
|
+
u.guid #=> 8392049
|
88
|
+
```
|
89
|
+
|
90
|
+
If you want to generate random string you can use built-in string
|
91
|
+
generator:
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
class User < ActiveRecord::Base
|
95
|
+
generate_public_uid generator: PublicUid::Generators::RangeString.new
|
96
|
+
end
|
97
|
+
```
|
98
|
+
|
99
|
+
```irb
|
100
|
+
u = User.new
|
101
|
+
u.public_uid #=> nil
|
102
|
+
u.save! #=> true
|
103
|
+
u.public_uid #=> "azuberdc"
|
104
|
+
```
|
105
|
+
|
106
|
+
### Customizing generated string
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
class User < ActiveRecord::Base
|
110
|
+
UID_RANGE = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a
|
111
|
+
generate_public_uid generator: PublicUid::Generators::RangeString.new(4, UID_RANGE)
|
112
|
+
end
|
113
|
+
```
|
114
|
+
|
115
|
+
```irb
|
116
|
+
u = User.new
|
117
|
+
u.public_uid #=> nil
|
118
|
+
u.save! #=> true
|
119
|
+
u.public_uid #=> "aZ3e"
|
120
|
+
```
|
121
|
+
|
122
|
+
### Customizing randomized number
|
123
|
+
|
124
|
+
```ruby
|
125
|
+
class User < ActiveRecord::Base
|
126
|
+
UID_RANGE = 1_000..4_000
|
127
|
+
generate_public_uid generator: PublicUid::Generators::NumberRandom.new(UID_RANGE)
|
128
|
+
end
|
129
|
+
```
|
130
|
+
|
131
|
+
```irb
|
132
|
+
u = User.new
|
133
|
+
u.public_uid #=> nil
|
134
|
+
u.save! #=> true
|
135
|
+
u.public_uid #=> 2398
|
136
|
+
```
|
137
|
+
|
138
|
+
## Contributing
|
139
|
+
|
140
|
+
1. Fork it
|
141
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
142
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
143
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
144
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/public_uid.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require "public_uid/version"
|
2
|
+
require "public_uid/set_public_uid"
|
3
|
+
require "public_uid/generators/number_random"
|
4
|
+
require "public_uid/generators/range_string"
|
5
|
+
|
6
|
+
module PublicUid
|
7
|
+
|
8
|
+
def self.included(base)
|
9
|
+
base.extend(ClassMethods)
|
10
|
+
end
|
11
|
+
|
12
|
+
def generate_uid
|
13
|
+
pub_uid = SetPublicUid.new(record: self, column: self.class.public_uid_column)
|
14
|
+
pub_uid.generate self.class.public_uid_generator
|
15
|
+
pub_uid.set
|
16
|
+
end
|
17
|
+
|
18
|
+
module ClassMethods
|
19
|
+
attr_reader :public_uid_column
|
20
|
+
attr_reader :public_uid_generator
|
21
|
+
|
22
|
+
def generate_public_uid(options={})
|
23
|
+
@public_uid_column = options[:column] || :public_uid
|
24
|
+
@public_uid_generator = options[:generator] || Generators::NumberRandom.new
|
25
|
+
before_create :generate_uid, unless: @public_uid_column
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module PublicUid
|
2
|
+
class SetPublicUid
|
3
|
+
attr_reader :new_uid
|
4
|
+
|
5
|
+
def initialize(options)
|
6
|
+
@record = options[:record] || raise(NoRecordSpecified)
|
7
|
+
@column = options[:column] || raise(NoPublicUidColumnSpecified)
|
8
|
+
@klass = @record.class
|
9
|
+
@new_uid = nil
|
10
|
+
check_column_existance
|
11
|
+
end
|
12
|
+
|
13
|
+
def generate(generator)
|
14
|
+
begin
|
15
|
+
@new_uid= generator.generate
|
16
|
+
end while similar_uid_exist?
|
17
|
+
end
|
18
|
+
|
19
|
+
def set
|
20
|
+
@record.send("#{@column}=", @new_uid || raise(NewUidNotSetYet))
|
21
|
+
end
|
22
|
+
private
|
23
|
+
|
24
|
+
def similar_uid_exist?
|
25
|
+
@klass.where(public_uid: @new_uid).count > 0
|
26
|
+
end
|
27
|
+
|
28
|
+
def check_column_existance
|
29
|
+
raise PublicUidColumnDoesNotExist if @klass.column_names.include?(@column)
|
30
|
+
end
|
31
|
+
|
32
|
+
class NewUidNotSetYet < StandardError; end
|
33
|
+
class PublicUidColumnDoesNotExist < StandardError; end
|
34
|
+
class NoPublicUidColumnSpecified < StandardError; end
|
35
|
+
class NoRecordSpecified < StandardError; end
|
36
|
+
end
|
37
|
+
end
|
data/public_uid.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'public_uid/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "public_uid"
|
8
|
+
spec.version = PublicUid::VERSION
|
9
|
+
spec.authors = ["Tomas Valent"]
|
10
|
+
spec.email = ["equivalent@eq8.eu"]
|
11
|
+
spec.description = %q{Automatic generates public unique identifier for model}
|
12
|
+
spec.summary = %q{Automatic generates public UID column}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "activerecord", "~> 3.2"
|
24
|
+
spec.add_development_dependency "minitest", "~> 5"
|
25
|
+
spec.add_development_dependency "sqlite3"
|
26
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe 'NumberRandom' do
|
4
|
+
|
5
|
+
describe "#generate" do
|
6
|
+
subject{ instance.generate }
|
7
|
+
|
8
|
+
context 'by default' do
|
9
|
+
let(:instance){ PublicUid::Generators::NumberRandom.new }
|
10
|
+
it 'generates 7 digits' do
|
11
|
+
subject.to_i.to_s.length.must_equal 7
|
12
|
+
subject.must_be_kind_of Integer
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'when specifying number between 20 - 21' do
|
17
|
+
let(:instance){ PublicUid::Generators::NumberRandom.new(20..21) }
|
18
|
+
it 'generates 2 digits' do
|
19
|
+
subject.to_i.to_s.length.must_equal 2
|
20
|
+
subject.must_be_kind_of Integer
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'generates string containing chars x,y,z' do
|
24
|
+
[20, 21].must_include subject
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe 'RangeString' do
|
4
|
+
|
5
|
+
describe "#generate" do
|
6
|
+
subject{ instance.generate }
|
7
|
+
|
8
|
+
context 'by default' do
|
9
|
+
let(:instance){ PublicUid::Generators::RangeString.new }
|
10
|
+
it 'generates 8 chars string' do
|
11
|
+
subject.length.must_equal 8
|
12
|
+
subject.must_be_kind_of String
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'generates downcase chars' do
|
16
|
+
subject.must_match(/^[a-z]*$/)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'when 10 chars x-y' do
|
21
|
+
let(:instance){ PublicUid::Generators::RangeString.new(3, ('x'..'z')) }
|
22
|
+
it 'generates 10 chars string' do
|
23
|
+
subject.length.must_equal 3
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'generates string containing chars x,y,z' do
|
27
|
+
subject.must_match(/^[x-z]*$/)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class User < ActiveRecord::Base
|
4
|
+
self.table_name = 'users'
|
5
|
+
end
|
6
|
+
|
7
|
+
class DummyGenerator
|
8
|
+
def initialize
|
9
|
+
@counter = 0
|
10
|
+
end
|
11
|
+
|
12
|
+
def generate
|
13
|
+
if @counter > 1
|
14
|
+
'second try'
|
15
|
+
else
|
16
|
+
'first try'
|
17
|
+
end.tap { @counter = @counter + 1 }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'PublicUid::SetPublicUid' do
|
22
|
+
let(:options) { {record: record, column: :public_uid} }
|
23
|
+
let(:instance){ PublicUid::SetPublicUid.new options }
|
24
|
+
|
25
|
+
let(:record){ User.new }
|
26
|
+
|
27
|
+
describe 'initialization' do
|
28
|
+
context 'when column not specified' do
|
29
|
+
let(:options) { {record: record} }
|
30
|
+
it{ ->{ instance }.must_raise(PublicUid::SetPublicUid::NoPublicUidColumnSpecified) }
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'when record not specified' do
|
34
|
+
let(:options) { {column: :foo} }
|
35
|
+
it{ ->{ instance }.must_raise(PublicUid::SetPublicUid::NoRecordSpecified) }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "#generate" do
|
40
|
+
subject{ instance.new_uid }
|
41
|
+
|
42
|
+
it "should ask generator to generate random string" do
|
43
|
+
instance.generate(DummyGenerator.new)
|
44
|
+
subject.must_equal 'first try'
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'when record match random' do
|
48
|
+
before{ User.create public_uid: 'first try' }
|
49
|
+
after { User.destroy_all }
|
50
|
+
|
51
|
+
it "should generate string once again" do
|
52
|
+
instance.generate(DummyGenerator.new)
|
53
|
+
subject.must_equal 'second try'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe '#set' do
|
59
|
+
subject{ instance.new_uid }
|
60
|
+
|
61
|
+
context 'when @new id is not set' do
|
62
|
+
it{ ->{ instance.set }.must_raise(PublicUid::SetPublicUid::NewUidNotSetYet) }
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'when @new id is set' do
|
66
|
+
before{ instance.instance_variable_set '@new_uid', '123' }
|
67
|
+
|
68
|
+
it 'must set new_uid for record pubilc_uid column' do
|
69
|
+
instance.set
|
70
|
+
subject.must_equal '123'
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class CustomPublicUidColumnModel < ActiveRecord::Base
|
4
|
+
self.table_name = "users"
|
5
|
+
include PublicUid
|
6
|
+
generate_public_uid column: :custom_uid
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'CustomPublicUidColumnModel' do
|
10
|
+
let(:user){CustomPublicUidColumnModel.new}
|
11
|
+
|
12
|
+
describe '#custom_uid' do
|
13
|
+
subject{ user.custom_uid }
|
14
|
+
|
15
|
+
context 'in new record' do
|
16
|
+
it{ subject.must_be_nil }
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'after save' do
|
20
|
+
before do
|
21
|
+
user.save
|
22
|
+
user.reload
|
23
|
+
end
|
24
|
+
it{ subject.wont_be_nil }
|
25
|
+
it 'by default should generate 7 digit number string' do
|
26
|
+
subject.to_i.to_s.length.must_equal(7)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ModelWithCustomGererator < ActiveRecord::Base
|
4
|
+
self.table_name = "users"
|
5
|
+
include PublicUid
|
6
|
+
|
7
|
+
gener_range = ('a'..'z').to_a+('A'..'Z').to_a
|
8
|
+
|
9
|
+
generate_public_uid generator: PublicUid::Generators::RangeString.
|
10
|
+
new(10, gener_range)
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'ModelWithCustomGererator' do
|
14
|
+
let(:user){ModelWithCustomGererator.new}
|
15
|
+
|
16
|
+
describe '#public_uid' do
|
17
|
+
subject{ user.public_uid }
|
18
|
+
|
19
|
+
context 'in new record' do
|
20
|
+
it{ subject.must_be_nil }
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'after save' do
|
24
|
+
before do
|
25
|
+
user.save
|
26
|
+
user.reload
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should generate 10 chars' do
|
30
|
+
subject.must_be_kind_of String
|
31
|
+
subject.length.must_equal(10)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'string including up & down case' do
|
35
|
+
subject.must_match(/^[a-zA-Z]+$/)
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ModelWithGeneratorDefaults < ActiveRecord::Base
|
4
|
+
self.table_name = "users"
|
5
|
+
include PublicUid
|
6
|
+
generate_public_uid
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'ModelWithGeneratorDefaults' do
|
10
|
+
let(:user){ModelWithGeneratorDefaults.new}
|
11
|
+
|
12
|
+
describe '#public_uid' do
|
13
|
+
subject{ user.public_uid }
|
14
|
+
|
15
|
+
context 'in new record' do
|
16
|
+
it{ subject.must_be_nil }
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'after save' do
|
20
|
+
before do
|
21
|
+
user.save
|
22
|
+
user.reload
|
23
|
+
end
|
24
|
+
it{ subject.wont_be_nil }
|
25
|
+
it 'by default should generate 7 digit number string' do
|
26
|
+
subject.to_i.to_s.length.must_equal(7)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'public_uid'
|
3
|
+
require 'minitest/autorun'
|
4
|
+
require 'active_record'
|
5
|
+
|
6
|
+
class Minitest::Spec
|
7
|
+
class << self
|
8
|
+
alias :context :describe
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
ActiveRecord::Base::establish_connection(adapter: 'sqlite3', database: ':memory:')
|
13
|
+
ActiveRecord::Base.connection.execute(%{CREATE TABLE users (id INTEGER PRIMARY KEY, public_uid VARCHAR, custom_uid INTEGER);})
|
14
|
+
|
metadata
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: public_uid
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tomas Valent
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: activerecord
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '5'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sqlite3
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Automatic generates public unique identifier for model
|
84
|
+
email:
|
85
|
+
- equivalent@eq8.eu
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- .gitignore
|
91
|
+
- Gemfile
|
92
|
+
- LICENSE.txt
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- lib/public_uid.rb
|
96
|
+
- lib/public_uid/generators/number_random.rb
|
97
|
+
- lib/public_uid/generators/range_string.rb
|
98
|
+
- lib/public_uid/set_public_uid.rb
|
99
|
+
- lib/public_uid/version.rb
|
100
|
+
- public_uid.gemspec
|
101
|
+
- test/lib/generators/number_random_test.rb
|
102
|
+
- test/lib/generators/range_string_test.rb
|
103
|
+
- test/lib/set_public_uid_test.rb
|
104
|
+
- test/models/custom_public_uid_column_test.rb
|
105
|
+
- test/models/model_with_custom_generator_test.rb
|
106
|
+
- test/models/model_with_generator_defaults_test.rb
|
107
|
+
- test/test_helper.rb
|
108
|
+
homepage: ''
|
109
|
+
licenses:
|
110
|
+
- MIT
|
111
|
+
metadata: {}
|
112
|
+
post_install_message:
|
113
|
+
rdoc_options: []
|
114
|
+
require_paths:
|
115
|
+
- lib
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
requirements: []
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 2.0.14
|
129
|
+
signing_key:
|
130
|
+
specification_version: 4
|
131
|
+
summary: Automatic generates public UID column
|
132
|
+
test_files:
|
133
|
+
- test/lib/generators/number_random_test.rb
|
134
|
+
- test/lib/generators/range_string_test.rb
|
135
|
+
- test/lib/set_public_uid_test.rb
|
136
|
+
- test/models/custom_public_uid_column_test.rb
|
137
|
+
- test/models/model_with_custom_generator_test.rb
|
138
|
+
- test/models/model_with_generator_defaults_test.rb
|
139
|
+
- test/test_helper.rb
|