sequenced 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +1 -0
- data/.travis.yml +4 -0
- data/CHANGELOG.md +7 -0
- data/MIT-LICENSE +1 -1
- data/README.md +11 -2
- data/lib/sequenced.rb +1 -0
- data/lib/sequenced/acts_as_sequenced.rb +6 -113
- data/lib/sequenced/generator.rb +70 -0
- data/lib/sequenced/version.rb +1 -1
- data/sequenced.gemspec +1 -0
- data/test/{sequenced_test.rb → acts_as_sequenced_test.rb} +39 -24
- data/test/dummy/app/models/monster.rb +3 -0
- data/test/dummy/app/models/product.rb +8 -0
- data/test/dummy/app/models/werewolf.rb +2 -0
- data/test/dummy/app/models/zombie.rb +2 -0
- data/test/dummy/db/migrate/20130730004055_create_products.rb +9 -0
- data/test/dummy/db/migrate/20131226000000_create_monsters.rb +9 -0
- metadata +23 -18
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YjQwMmU1NzFiNzlmNDk3NDczOGJhOWY4NDhjODZhNmZjNjQ0NTllMA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MGQ5Y2M4MjVkMGMzZWQ2MzA0MmE4Zjg4OTk2NzJmZTIyNDgwYTYwMQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NjA5OGJkMDc5MTM3MTY0Y2EwNDY2YTBkODk4YzA3YTY4MjUxNTdiNWQ2YzI5
|
10
|
+
ZjhjNjFkM2JlZWRhODc2ODc0MDEwZDFlMzQ1ZGZmODRkNWYzZWQyMWM5NDlm
|
11
|
+
NDIxMTA5ZDNhMmIwYjdhYzMyZWI2YTc2NzNjZWU2NmVkNjRmZWY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OGU4MjNkMWY5Y2ZmMzRmNTY5NGQwOGQwNjE3YzhlYzg2YTZkNTUxOTVjMmFl
|
14
|
+
OWYzZjUxNmFhMzI3NGEwNTUzMzZjODgzNmNmZmFkMTRiNDIxNjU3NDgzYTBl
|
15
|
+
Mzc0MWQ2MjIxOTc4ZWE0Y2MyNDIyMGViMDM0Yzc1OWIwMTYzMTI=
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
1.5.0 (December 26, 2013)
|
2
|
+
-------------------------
|
3
|
+
|
4
|
+
* Add the ability to pass a lambda for the start_at option (Bobby Uhlenbrock)
|
5
|
+
* Major internal refactor for cleaner, more modular code
|
6
|
+
* Scope by base class when single table inheritance is being used (Adam Becker)
|
7
|
+
|
1
8
|
1.4.0 (July 15, 2013)
|
2
9
|
---------------------
|
3
10
|
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Sequenced
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/djreimer/sequenced.png)](https://travis-ci.org/djreimer/sequenced)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/djreimer/sequenced.png)](https://codeclimate.com/github/djreimer/sequenced)
|
5
|
+
|
3
6
|
Sequenced is a simple gem that generates scoped sequential IDs for
|
4
7
|
ActiveRecord models. This gem provides an `acts_as_sequenced` macro that
|
5
8
|
automatically assigns a unique, sequential ID to each record. The sequential ID is
|
@@ -87,6 +90,12 @@ integer, simply set the `start_at` option:
|
|
87
90
|
acts_as_sequenced start_at: 1000
|
88
91
|
```
|
89
92
|
|
93
|
+
You may also pass a lambda to the `start_at` option:
|
94
|
+
|
95
|
+
```ruby
|
96
|
+
acts_as_sequenced start_at: lambda { |r| r.computed_start_value }
|
97
|
+
```
|
98
|
+
|
90
99
|
### Indexing the sequential ID column
|
91
100
|
|
92
101
|
For optimal performance, it's a good idea to index the sequential ID column
|
@@ -125,7 +134,7 @@ class Answer < ActiveRecord::Base
|
|
125
134
|
end
|
126
135
|
|
127
136
|
# config/routes.rb
|
128
|
-
resources :questions
|
137
|
+
resources :questions do
|
129
138
|
resources :answers
|
130
139
|
end
|
131
140
|
|
@@ -175,4 +184,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
175
184
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
176
185
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
177
186
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
178
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
187
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/sequenced.rb
CHANGED
@@ -6,9 +6,9 @@ module Sequenced
|
|
6
6
|
def self.included(base)
|
7
7
|
base.extend ClassMethods
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
module ClassMethods
|
11
|
-
# Public: Defines ActiveRecord callbacks to set a sequential ID scoped
|
11
|
+
# Public: Defines ActiveRecord callbacks to set a sequential ID scoped
|
12
12
|
# on a specific class.
|
13
13
|
#
|
14
14
|
# options - The Hash of options for configuration:
|
@@ -23,7 +23,7 @@ module Sequenced
|
|
23
23
|
# model object
|
24
24
|
#
|
25
25
|
# Examples
|
26
|
-
#
|
26
|
+
#
|
27
27
|
# class Answer < ActiveRecord::Base
|
28
28
|
# belongs_to :question
|
29
29
|
# acts_as_sequenced :scope => :question_id
|
@@ -31,124 +31,17 @@ module Sequenced
|
|
31
31
|
#
|
32
32
|
# Returns nothing.
|
33
33
|
def acts_as_sequenced(options = {})
|
34
|
-
# Remove extraneous options
|
35
|
-
options.slice!(:scope, :column, :start_at, :skip)
|
36
|
-
|
37
|
-
# Set defaults
|
38
|
-
options[:column] ||= :sequential_id
|
39
|
-
options[:start_at] ||= 1
|
40
|
-
options[:skip] ||= nil
|
41
|
-
|
42
|
-
# Create class accessor for sequenced options
|
43
34
|
cattr_accessor :sequenced_options
|
44
35
|
self.sequenced_options = options
|
45
|
-
|
46
|
-
# Specify ActiveRecord callback
|
36
|
+
|
47
37
|
before_save :set_sequential_id
|
48
38
|
include Sequenced::ActsAsSequenced::InstanceMethods
|
49
39
|
end
|
50
40
|
end
|
51
|
-
|
41
|
+
|
52
42
|
module InstanceMethods
|
53
|
-
# Internal: Fetches the next sequential ID and assigns it to
|
54
|
-
# the sequential ID column if the sequential id is not already
|
55
|
-
# defined.
|
56
|
-
#
|
57
|
-
# Returns nothing.
|
58
|
-
# Raises ArgumentError if
|
59
|
-
# 1) The specified scope method is undefined,
|
60
|
-
# 2) The specified scope method returns nil, or
|
61
|
-
# 3) The sequential ID column is undefined.
|
62
43
|
def set_sequential_id
|
63
|
-
|
64
|
-
column = self.class.sequenced_options[:column]
|
65
|
-
skip = self.class.sequenced_options[:skip]
|
66
|
-
|
67
|
-
unless self.respond_to?(column)
|
68
|
-
raise ArgumentError, "Column method ##{column.to_s} is undefined"
|
69
|
-
end
|
70
|
-
|
71
|
-
# Short-circuit here if the ID is already set
|
72
|
-
return unless self.send(column).nil?
|
73
|
-
|
74
|
-
if skip.present?
|
75
|
-
return if skip.call(self)
|
76
|
-
end
|
77
|
-
|
78
|
-
if scope.present?
|
79
|
-
if scope.is_a?(Array)
|
80
|
-
scope.each { |s| verify_scope_method(s) }
|
81
|
-
else
|
82
|
-
verify_scope_method(scope)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
# Fetch the next ID unless it is already defined
|
87
|
-
self.send(:"#{column}=", next_sequential_id) until sequential_id_is_unique?
|
88
|
-
end
|
89
|
-
|
90
|
-
# Internal: Verify that the given scope method is defined and does not
|
91
|
-
# return nil unexpectedly.
|
92
|
-
#
|
93
|
-
# scope - A Symbol representing the scope method.
|
94
|
-
#
|
95
|
-
# Returns nothing.
|
96
|
-
# Raises an ArgumentError if
|
97
|
-
# 1) The specified scope method is undefined, or
|
98
|
-
# 2) The specified scope method returns nil
|
99
|
-
def verify_scope_method(scope)
|
100
|
-
if !self.respond_to?(scope)
|
101
|
-
raise ArgumentError, "Scope method ##{scope.to_s} is undefined"
|
102
|
-
elsif self.send(scope).nil?
|
103
|
-
raise ArgumentError, "Scope method ##{scope.to_s} returned nil unexpectedly"
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
# Internal: Obtain the next sequential ID
|
108
|
-
#
|
109
|
-
# Returns Integer.
|
110
|
-
# Raises ArgumentError if the last sequential ID is not an Integer.
|
111
|
-
def next_sequential_id
|
112
|
-
scope = self.class.sequenced_options[:scope]
|
113
|
-
column = self.class.sequenced_options[:column]
|
114
|
-
start_at = self.class.sequenced_options[:start_at]
|
115
|
-
|
116
|
-
q = self.class.unscoped.where("#{column.to_s} IS NOT NULL").order("#{column.to_s} DESC")
|
117
|
-
|
118
|
-
if scope.is_a?(Symbol)
|
119
|
-
q = q.where(scope => self.send(scope))
|
120
|
-
elsif scope.is_a?(Array)
|
121
|
-
scope.each { |s| q = q.where(s => self.send(s)) }
|
122
|
-
end
|
123
|
-
|
124
|
-
return start_at unless last_record = q.first
|
125
|
-
last_id = last_record.send(column)
|
126
|
-
|
127
|
-
unless last_id.is_a?(Integer)
|
128
|
-
raise ArgumentError, "The sequential ID column must contain Integer values"
|
129
|
-
end
|
130
|
-
|
131
|
-
last_id + 1 > start_at ? last_id + 1 : start_at
|
132
|
-
end
|
133
|
-
|
134
|
-
# Internal: Checks the uniqueness of the sequential ID.
|
135
|
-
#
|
136
|
-
# Returns Boolean status of uniqueness.
|
137
|
-
def sequential_id_is_unique?
|
138
|
-
scope = self.class.sequenced_options[:scope]
|
139
|
-
column = self.class.sequenced_options[:column]
|
140
|
-
return false unless self.send(column).is_a?(Integer)
|
141
|
-
|
142
|
-
q = self.class.unscoped.where(column => self.send(column))
|
143
|
-
|
144
|
-
if scope.is_a?(Symbol)
|
145
|
-
q = q.where(scope => self.send(scope))
|
146
|
-
elsif scope.is_a?(Array)
|
147
|
-
scope.each { |s| q = q.where(s => self.send(s)) }
|
148
|
-
end
|
149
|
-
|
150
|
-
q = q.where("NOT id = ?", self.id) if self.persisted?
|
151
|
-
q.count > 0 ? false : true
|
44
|
+
Sequenced::Generator.new(self, self.class.base_class.sequenced_options).set
|
152
45
|
end
|
153
46
|
end
|
154
47
|
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Sequenced
|
2
|
+
class Generator
|
3
|
+
attr_reader :record, :scope, :column, :start_at, :skip
|
4
|
+
|
5
|
+
def initialize(record, options = {})
|
6
|
+
@record = record
|
7
|
+
@scope = options[:scope]
|
8
|
+
@column = (options[:column] || :sequential_id).to_sym
|
9
|
+
@start_at = options[:start_at] || 1
|
10
|
+
@skip = options[:skip]
|
11
|
+
end
|
12
|
+
|
13
|
+
def set
|
14
|
+
record.send(:"#{column}=", next_id) unless id_set? || skip?
|
15
|
+
end
|
16
|
+
|
17
|
+
def id_set?
|
18
|
+
!record.send(column).nil?
|
19
|
+
end
|
20
|
+
|
21
|
+
def skip?
|
22
|
+
skip && skip.call(record)
|
23
|
+
end
|
24
|
+
|
25
|
+
def next_id
|
26
|
+
next_id_in_sequence.tap do |id|
|
27
|
+
id += 1 until unique?(id)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def next_id_in_sequence
|
32
|
+
start_at = self.start_at.respond_to?(:call) ? self.start_at.call(record) : self.start_at
|
33
|
+
return start_at unless last_record = find_last_record
|
34
|
+
max(last_record.send(column) + 1, start_at)
|
35
|
+
end
|
36
|
+
|
37
|
+
def unique?(id)
|
38
|
+
build_scope(*scope) do
|
39
|
+
rel = base_relation
|
40
|
+
rel = rel.where("NOT id = ?", record.id) if record.persisted?
|
41
|
+
rel.where(column => id)
|
42
|
+
end.count == 0
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def base_relation
|
48
|
+
record.class.base_class.unscoped
|
49
|
+
end
|
50
|
+
|
51
|
+
def find_last_record
|
52
|
+
build_scope(*scope) do
|
53
|
+
base_relation.
|
54
|
+
where("#{column.to_s} IS NOT NULL").
|
55
|
+
order("#{column.to_s} DESC")
|
56
|
+
end.first
|
57
|
+
end
|
58
|
+
|
59
|
+
def build_scope(*columns)
|
60
|
+
rel = yield
|
61
|
+
columns.each { |c| rel = rel.where(c => record.send(c.to_sym)) }
|
62
|
+
rel
|
63
|
+
end
|
64
|
+
|
65
|
+
def max(*values)
|
66
|
+
values.to_a.max
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
data/lib/sequenced/version.rb
CHANGED
data/sequenced.gemspec
CHANGED
@@ -5,6 +5,7 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.name = "sequenced"
|
6
6
|
s.version = Sequenced::VERSION
|
7
7
|
s.authors = ["Derrick Reimer"]
|
8
|
+
s.licenses = ['MIT']
|
8
9
|
s.email = ["derrickreimer@gmail.com"]
|
9
10
|
s.homepage = "https://github.com/djreimer/sequenced"
|
10
11
|
s.summary = "Generate scoped sequential IDs for ActiveRecord models"
|
@@ -5,113 +5,128 @@ require 'test_helper'
|
|
5
5
|
# Answer - :scope => :question_id
|
6
6
|
# Comment - :scope => :question_id (with an AR default scope)
|
7
7
|
# Invoice - :scope => :account_id, :start_at => 1000
|
8
|
+
# Product - :scope => :account_id, :start_at => lambda { |r| r.computed_start_value }
|
8
9
|
# Order - :scope => :non_existent_column
|
9
10
|
# User - :scope => :account_id, :column => :custom_sequential_id
|
10
11
|
# Address - :scope => :account_id ('sequential_id' does not exist)
|
11
12
|
# Email - :scope => [:emailable_id, :emailable_type]
|
12
13
|
# Subscription - no options
|
13
14
|
# Rating - :scope => :comment_id, skip: { |r| r.score == 0 }
|
15
|
+
# Monster - no options
|
16
|
+
# Zombie - STI, inherits from Monster
|
17
|
+
# Werewolf - STI, inherits from Monster
|
14
18
|
|
15
|
-
class
|
19
|
+
class ActsAsSequencedTest < ActiveSupport::TestCase
|
16
20
|
test "default start_at" do
|
17
21
|
question = Question.create
|
18
22
|
answer = question.answers.create
|
19
23
|
assert_equal 1, answer.sequential_id
|
20
24
|
end
|
21
|
-
|
25
|
+
|
22
26
|
test "custom start_at" do
|
23
27
|
account = Account.create
|
24
28
|
invoice = account.invoices.create
|
25
29
|
assert_equal 1000, invoice.sequential_id
|
26
|
-
|
30
|
+
|
27
31
|
another_invoice = account.invoices.create
|
28
32
|
assert_equal 1001, another_invoice.sequential_id
|
29
33
|
end
|
30
|
-
|
34
|
+
|
35
|
+
test "lambda start_at" do
|
36
|
+
account = Account.create
|
37
|
+
product = Product.create(:account_id => account.id)
|
38
|
+
assert_equal 3, product.sequential_id
|
39
|
+
|
40
|
+
another_product = Product.create(:account_id => account.id)
|
41
|
+
assert_equal 4, another_product.sequential_id
|
42
|
+
end
|
43
|
+
|
31
44
|
test "custom start_at with populated table" do
|
32
45
|
account = Account.create
|
33
46
|
account.invoices.create(:sequential_id => 1)
|
34
47
|
invoice = account.invoices.create
|
35
48
|
assert_equal 1000, invoice.sequential_id
|
36
49
|
end
|
37
|
-
|
50
|
+
|
38
51
|
test "sequential id increment" do
|
39
52
|
question = Question.create
|
40
53
|
question.answers.create(:sequential_id => 10)
|
41
54
|
another_answer = question.answers.create
|
42
55
|
assert_equal 11, another_answer.sequential_id
|
43
56
|
end
|
44
|
-
|
57
|
+
|
45
58
|
test "default scope" do
|
46
59
|
Subscription.create(:sequential_id => 1)
|
47
60
|
subscription = Subscription.create
|
48
61
|
assert_equal 2, subscription.sequential_id
|
49
62
|
end
|
50
|
-
|
63
|
+
|
51
64
|
test "undefined scope method" do
|
52
65
|
account = Account.create
|
53
66
|
order = account.orders.build
|
54
|
-
assert_raises(
|
55
|
-
end
|
56
|
-
|
57
|
-
test "scope method returns nil" do
|
58
|
-
answer = Answer.new
|
59
|
-
assert_raises(ArgumentError) { answer.save }
|
67
|
+
assert_raises(NoMethodError) { order.save }
|
60
68
|
end
|
61
|
-
|
69
|
+
|
62
70
|
test "custom sequential id column" do
|
63
71
|
account = Account.create
|
64
72
|
user = account.users.create
|
65
73
|
assert_equal 1, user.custom_sequential_id
|
66
74
|
end
|
67
|
-
|
75
|
+
|
68
76
|
test "sequential id remains on save" do
|
69
77
|
question = Question.create
|
70
78
|
answer = question.answers.create
|
71
79
|
assert_equal 1, answer.sequential_id
|
72
|
-
|
80
|
+
|
73
81
|
answer.reload
|
74
82
|
answer.body = "Updated body"
|
75
83
|
answer.save
|
76
84
|
assert_equal 1, answer.sequential_id
|
77
85
|
end
|
78
|
-
|
86
|
+
|
79
87
|
test "undefined sequential id column" do
|
80
88
|
account = Account.create
|
81
89
|
address = account.addresses.build
|
82
|
-
assert_raises(
|
90
|
+
assert_raises(NoMethodError) { address.save }
|
83
91
|
end
|
84
|
-
|
92
|
+
|
85
93
|
test "manually setting sequential id" do
|
86
94
|
question = Question.create
|
87
95
|
answer = question.answers.build(:sequential_id => 10)
|
88
96
|
another_answer = question.answers.build(:sequential_id => 10)
|
89
97
|
answer.save
|
90
98
|
another_answer.save
|
91
|
-
|
99
|
+
|
92
100
|
assert_equal 10, answer.sequential_id
|
93
101
|
assert_equal 10, another_answer.sequential_id
|
94
102
|
end
|
95
|
-
|
103
|
+
|
96
104
|
test "model with a default scope for sorting" do
|
97
105
|
question = Question.create
|
98
106
|
(1..3).each { |id| question.comments.create(:sequential_id => id) }
|
99
107
|
comment = question.comments.create
|
100
108
|
assert_equal 4, comment.sequential_id
|
101
109
|
end
|
102
|
-
|
110
|
+
|
103
111
|
test "multi-column scopes" do
|
104
112
|
Email.create(:emailable_id => 1, :emailable_type => "User", :sequential_id => 2)
|
105
113
|
Email.create(:emailable_id => 1, :emailable_type => "Question", :sequential_id => 3)
|
106
114
|
email = Email.create(:emailable_id => 1, :emailable_type => "User")
|
107
115
|
assert_equal 3, email.sequential_id
|
108
116
|
end
|
109
|
-
|
117
|
+
|
110
118
|
test "skip option" do
|
111
119
|
rating = Rating.create(:comment_id => 1, :score => 1)
|
112
120
|
assert_equal 1, rating.sequential_id
|
113
|
-
|
121
|
+
|
114
122
|
rating = Rating.create(:comment_id => 1, :score => 0)
|
115
123
|
assert_equal nil, rating.sequential_id
|
116
124
|
end
|
125
|
+
|
126
|
+
test "STI" do
|
127
|
+
zombie = Zombie.create
|
128
|
+
werewolf = Werewolf.create
|
129
|
+
assert_equal 1, zombie.sequential_id
|
130
|
+
assert_equal 2, werewolf.sequential_id
|
131
|
+
end
|
117
132
|
end
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequenced
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.5.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Derrick Reimer
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-12-26 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activesupport
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ! '>='
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: activerecord
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rails
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ! '>='
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: sqlite3
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ! '>='
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ! '>='
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -84,6 +75,7 @@ extensions: []
|
|
84
75
|
extra_rdoc_files: []
|
85
76
|
files:
|
86
77
|
- .gitignore
|
78
|
+
- .travis.yml
|
87
79
|
- CHANGELOG.md
|
88
80
|
- Gemfile
|
89
81
|
- MIT-LICENSE
|
@@ -92,8 +84,10 @@ files:
|
|
92
84
|
- TODO.md
|
93
85
|
- lib/sequenced.rb
|
94
86
|
- lib/sequenced/acts_as_sequenced.rb
|
87
|
+
- lib/sequenced/generator.rb
|
95
88
|
- lib/sequenced/version.rb
|
96
89
|
- sequenced.gemspec
|
90
|
+
- test/acts_as_sequenced_test.rb
|
97
91
|
- test/dummy/README.rdoc
|
98
92
|
- test/dummy/Rakefile
|
99
93
|
- test/dummy/app/assets/javascripts/application.js
|
@@ -108,11 +102,15 @@ files:
|
|
108
102
|
- test/dummy/app/models/comment.rb
|
109
103
|
- test/dummy/app/models/email.rb
|
110
104
|
- test/dummy/app/models/invoice.rb
|
105
|
+
- test/dummy/app/models/monster.rb
|
111
106
|
- test/dummy/app/models/order.rb
|
107
|
+
- test/dummy/app/models/product.rb
|
112
108
|
- test/dummy/app/models/question.rb
|
113
109
|
- test/dummy/app/models/rating.rb
|
114
110
|
- test/dummy/app/models/subscription.rb
|
115
111
|
- test/dummy/app/models/user.rb
|
112
|
+
- test/dummy/app/models/werewolf.rb
|
113
|
+
- test/dummy/app/models/zombie.rb
|
116
114
|
- test/dummy/app/views/layouts/application.html.erb
|
117
115
|
- test/dummy/config.ru
|
118
116
|
- test/dummy/config/application.rb
|
@@ -141,6 +139,8 @@ files:
|
|
141
139
|
- test/dummy/db/migrate/20120220000804_create_comments.rb
|
142
140
|
- test/dummy/db/migrate/20130411225444_create_emails.rb
|
143
141
|
- test/dummy/db/migrate/20130715002029_create_ratings.rb
|
142
|
+
- test/dummy/db/migrate/20130730004055_create_products.rb
|
143
|
+
- test/dummy/db/migrate/20131226000000_create_monsters.rb
|
144
144
|
- test/dummy/db/schema.rb
|
145
145
|
- test/dummy/lib/assets/.gitkeep
|
146
146
|
- test/dummy/log/.gitkeep
|
@@ -149,37 +149,37 @@ files:
|
|
149
149
|
- test/dummy/public/500.html
|
150
150
|
- test/dummy/public/favicon.ico
|
151
151
|
- test/dummy/script/rails
|
152
|
-
- test/sequenced_test.rb
|
153
152
|
- test/test_helper.rb
|
154
153
|
- test/dummy/db/development.sqlite3
|
155
154
|
- test/dummy/db/test.sqlite3
|
156
155
|
- test/dummy/log/development.log
|
157
156
|
- test/dummy/log/test.log
|
158
157
|
homepage: https://github.com/djreimer/sequenced
|
159
|
-
licenses:
|
158
|
+
licenses:
|
159
|
+
- MIT
|
160
|
+
metadata: {}
|
160
161
|
post_install_message:
|
161
162
|
rdoc_options: []
|
162
163
|
require_paths:
|
163
164
|
- lib
|
164
165
|
required_ruby_version: !ruby/object:Gem::Requirement
|
165
|
-
none: false
|
166
166
|
requirements:
|
167
167
|
- - ! '>='
|
168
168
|
- !ruby/object:Gem::Version
|
169
169
|
version: '0'
|
170
170
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
|
-
none: false
|
172
171
|
requirements:
|
173
172
|
- - ! '>='
|
174
173
|
- !ruby/object:Gem::Version
|
175
174
|
version: '0'
|
176
175
|
requirements: []
|
177
176
|
rubyforge_project:
|
178
|
-
rubygems_version: 1.
|
177
|
+
rubygems_version: 2.1.10
|
179
178
|
signing_key:
|
180
|
-
specification_version:
|
179
|
+
specification_version: 4
|
181
180
|
summary: Generate scoped sequential IDs for ActiveRecord models
|
182
181
|
test_files:
|
182
|
+
- test/acts_as_sequenced_test.rb
|
183
183
|
- test/dummy/app/assets/javascripts/application.js
|
184
184
|
- test/dummy/app/assets/stylesheets/application.css
|
185
185
|
- test/dummy/app/controllers/application_controller.rb
|
@@ -190,11 +190,15 @@ test_files:
|
|
190
190
|
- test/dummy/app/models/comment.rb
|
191
191
|
- test/dummy/app/models/email.rb
|
192
192
|
- test/dummy/app/models/invoice.rb
|
193
|
+
- test/dummy/app/models/monster.rb
|
193
194
|
- test/dummy/app/models/order.rb
|
195
|
+
- test/dummy/app/models/product.rb
|
194
196
|
- test/dummy/app/models/question.rb
|
195
197
|
- test/dummy/app/models/rating.rb
|
196
198
|
- test/dummy/app/models/subscription.rb
|
197
199
|
- test/dummy/app/models/user.rb
|
200
|
+
- test/dummy/app/models/werewolf.rb
|
201
|
+
- test/dummy/app/models/zombie.rb
|
198
202
|
- test/dummy/app/views/layouts/application.html.erb
|
199
203
|
- test/dummy/config/application.rb
|
200
204
|
- test/dummy/config/boot.rb
|
@@ -224,6 +228,8 @@ test_files:
|
|
224
228
|
- test/dummy/db/migrate/20120220000804_create_comments.rb
|
225
229
|
- test/dummy/db/migrate/20130411225444_create_emails.rb
|
226
230
|
- test/dummy/db/migrate/20130715002029_create_ratings.rb
|
231
|
+
- test/dummy/db/migrate/20130730004055_create_products.rb
|
232
|
+
- test/dummy/db/migrate/20131226000000_create_monsters.rb
|
227
233
|
- test/dummy/db/schema.rb
|
228
234
|
- test/dummy/db/test.sqlite3
|
229
235
|
- test/dummy/log/development.log
|
@@ -235,5 +241,4 @@ test_files:
|
|
235
241
|
- test/dummy/Rakefile
|
236
242
|
- test/dummy/README.rdoc
|
237
243
|
- test/dummy/script/rails
|
238
|
-
- test/sequenced_test.rb
|
239
244
|
- test/test_helper.rb
|