mongoid_auto_increment 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 77dd586502e69cdc067f0f2fdc5da493e35eacd3
4
- data.tar.gz: 5f0df34d657c6c41bf7cebfd167f44ffe428f801
2
+ SHA256:
3
+ metadata.gz: 1c73073d5d05e77517252042ad3a63bb484d5660d5e87cfe4b5ac1a58489d4f7
4
+ data.tar.gz: a8656612fed0486a237e94eef56c367d16b993dd485397dd32b4901b4eb65fbe
5
5
  SHA512:
6
- metadata.gz: e26e7739728adb0c52754fd7b7b35332f1d3e232935c39219d0fe6b95638d22615e09585102b032eb3467aa531404eac49636c8b5c0c4fda1a6f663a05684fe5
7
- data.tar.gz: e690b7afaa740c79d8efa64eaf46761031d8eaa6977a33126c24292043f1ee0e6692cffbaa419f20ef077210d9144ee4f4b35c7ca0d07cb6b6d2f3bbe2458ca7
6
+ metadata.gz: 680eb520bbfe7602d7ba364584d781f495bc78c13415205edb9e3f49b51592131e79dc63a723fbe0b179f4bca5acde0b827585d2bcc9713c2cc73848b1d7af65
7
+ data.tar.gz: a2afacf125b79de0feb111c87835a18773905a1c1c17f7e95b3245fe8f18eccaf3844454e70886185ad5c44e3fb90173067c2f2c14470e42f966285688c117cb
@@ -0,0 +1,13 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
+ patreon: _proton
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: # Replace with a single Ko-fi username
7
+ tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ otechie: # Replace with a single Otechie username
12
+ lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13
+ custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
data/.travis.yml CHANGED
@@ -6,6 +6,10 @@ language: ruby
6
6
  cache: bundler
7
7
 
8
8
  rvm:
9
+ - 3.2.0
10
+ - 3.1.0
11
+ - 3.0.0
12
+ - 2.7.0
9
13
  - 2.3
10
14
  - 2.2
11
15
  - 2.1.1
@@ -18,6 +22,7 @@ env:
18
22
  - MONGOID_VERSION=5
19
23
  - MONGOID_VERSION=6
20
24
  - MONGOID_VERSION=7
25
+ - MONGOID_VERSION=8
21
26
 
22
27
  matrix:
23
28
  exclude:
@@ -29,3 +34,11 @@ matrix:
29
34
  env: MONGOID_VERSION=7
30
35
  - rvm: 2.1.1
31
36
  env: MONGOID_VERSION=7
37
+ - rvm: 2.0.0
38
+ env: MONGOID_VERSION=8
39
+ - rvm: 2.1.1
40
+ env: MONGOID_VERSION=8
41
+ - rvm: 2.2
42
+ env: MONGOID_VERSION=8
43
+ - rvm: 2.3
44
+ env: MONGOID_VERSION=8
data/Gemfile CHANGED
@@ -8,7 +8,7 @@ gem 'mongoid', '>= 2.0'
8
8
  # Include everything needed to run rake, tests, features, etc.
9
9
  group :development do
10
10
  gem 'bundler'
11
- gem 'database_cleaner', '>= 0.8.0'
11
+ gem 'database_cleaner-mongoid', '~> 2.0', '>= 2.0.1'
12
12
  gem 'jeweler', '~> 2.1.1'
13
13
  gem 'rack', '~> 1.6.4'
14
14
  gem 'rake'
data/README.md ADDED
@@ -0,0 +1,88 @@
1
+ # Mongoid::AutoIncrement
2
+
3
+ Add SQL like auto-incrementing fields to your Mongoid documents. This gem is
4
+ inspired by http://ihswebdesign.com/blog/autoincrement-in-mongodb-with-ruby/
5
+ and the [mongomapper_id2](https://github.com/phstc/mongomapper_id2) gem.
6
+
7
+ [![travis CI](https://secure.travis-ci.org/proton/mongoid_auto_increment.png)](http://travis-ci.org/proton/mongoid_auto_increment)
8
+ [![codetriage](https://www.codetriage.com/proton/mongoid_auto_increment/badges/users.svg)](https://www.codetriage.com/proton/mongoid_auto_increment)
9
+
10
+ ## Installation
11
+
12
+ Add to Gemfile:
13
+
14
+ gem 'mongoid_auto_increment'
15
+
16
+ ## Getting Started
17
+
18
+ Just add `auto_increment :field` to your Mongoid model where `:field` is the
19
+ name of the auto-incremented field you want to create. Example:
20
+
21
+ class Book
22
+ include Mongoid::Document
23
+
24
+ field :title
25
+ field :author
26
+
27
+ auto_increment :sequence
28
+ end
29
+
30
+ `auto_increment :sequence` will create a field of type `Integer` named
31
+ `sequence` for `Book`. Whenever an instance of the model is created (intially
32
+ saved to mongoDB), the `auto_increment` field will automatically be set to the
33
+ next number in the sequence.
34
+
35
+ You can add more than one auto-incremented field per model.
36
+
37
+ ### Options
38
+
39
+ auto_increment :sequence, collection: :some_collection
40
+
41
+ `mongoid_auto_inc` keeps track of the current number in the sequence by
42
+ creating a separate document mongoDB to query and update. By default
43
+ `auto_increment` will save this document to a mongoDB collection called
44
+ `sequences`. If you wish to save to a different collection use the
45
+ `:collection` option to specify its name.
46
+
47
+ auto_increment :sequence, step: 5
48
+
49
+ If desired, you can override the `:step`, or increment amount (default is 1).
50
+
51
+ auto_increment :sequence, seed: 3333
52
+
53
+ Use the `:seed` option to set the initial value of the auto-incremented field.
54
+ The first number assigned from the sequence will be the next number after the
55
+ seed value (including the step - so for `seed: 1000, step: 5`, first value
56
+ will be 1005).
57
+
58
+ auto_increment :sequence, scope: :some_field_or_relation
59
+ auto_increment :sequence, scope: [ :some_field_or_relation, :another_field_or_relation ]
60
+
61
+ Use the `:scope` option to scope an auto-incremented field to a query.
62
+ Similar to Mongoid, the scope may contain one or many fields or relations.
63
+ Each unique scope will result in it's own stream of incremented values.
64
+
65
+ ## Contributing to Mongoid::AutoIncrement
66
+
67
+ * Check out the latest master to make sure the feature hasn't been
68
+ implemented or the bug hasn't been fixed yet
69
+ * Check out the issue tracker to make sure someone already hasn't requested
70
+ it and/or contributed it
71
+ * Fork the project
72
+ * Start a feature/bugfix branch
73
+ * Commit and push until you are happy with your contribution
74
+ * Make sure to add tests for it. This is important so I don't break it in a
75
+ future version unintentionally.
76
+ * Please try not to mess with the Rakefile, version, or history. If you want
77
+ to have your own version, or is otherwise necessary, that is fine, but
78
+ please isolate to its own commit so I can cherry-pick around it.
79
+
80
+ ## Support us
81
+
82
+ https://www.patreon.com/_proton
83
+
84
+ ## Copyright
85
+
86
+ (c) 2011-2023 Peter Savichev (proton) (c) 2010-2011 Jeff Smith
87
+
88
+ See LICENSE.txt for further details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
@@ -2,28 +2,29 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: mongoid_auto_increment 0.1.5 ruby lib
5
+ # stub: mongoid_auto_increment 0.1.6 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "mongoid_auto_increment".freeze
9
- s.version = "0.1.5"
9
+ s.version = "0.1.6"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Peter Savichev (proton)".freeze]
14
- s.date = "2018-11-07"
14
+ s.date = "2023-03-08"
15
15
  s.description = "Add SQL like auto-incrementing fields to your Mongoid documents.".freeze
16
16
  s.email = "psavichev@gmail.com".freeze
17
17
  s.extra_rdoc_files = [
18
18
  "LICENSE",
19
- "README.rdoc"
19
+ "README.md"
20
20
  ]
21
21
  s.files = [
22
+ ".github/FUNDING.yml",
22
23
  ".rspec",
23
24
  ".travis.yml",
24
25
  "Gemfile",
25
26
  "LICENSE",
26
- "README.rdoc",
27
+ "README.md",
27
28
  "Rakefile",
28
29
  "VERSION",
29
30
  "lib/mongoid_auto_increment.rb",
@@ -42,43 +43,19 @@ Gem::Specification.new do |s|
42
43
  ]
43
44
  s.homepage = "http://github.com/proton/mongoid_auto_increment".freeze
44
45
  s.licenses = ["MIT".freeze]
45
- s.rubygems_version = "2.6.14".freeze
46
+ s.rubygems_version = "3.4.6".freeze
46
47
  s.summary = "Auto-incrementing fields for Mongoid documents".freeze
47
48
 
48
- if s.respond_to? :specification_version then
49
- s.specification_version = 4
49
+ s.specification_version = 4
50
50
 
51
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
52
- s.add_runtime_dependency(%q<mongoid>.freeze, [">= 2.0"])
53
- s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
54
- s.add_development_dependency(%q<database_cleaner>.freeze, [">= 0.8.0"])
55
- s.add_development_dependency(%q<jeweler>.freeze, ["~> 2.1.1"])
56
- s.add_development_dependency(%q<rack>.freeze, ["~> 1.6.4"])
57
- s.add_development_dependency(%q<rake>.freeze, [">= 0"])
58
- s.add_development_dependency(%q<rdoc>.freeze, [">= 0"])
59
- s.add_development_dependency(%q<rspec>.freeze, [">= 2.0.0"])
60
- s.add_development_dependency(%q<simplecov>.freeze, [">= 0.4.0"])
61
- else
62
- s.add_dependency(%q<mongoid>.freeze, [">= 2.0"])
63
- s.add_dependency(%q<bundler>.freeze, [">= 0"])
64
- s.add_dependency(%q<database_cleaner>.freeze, [">= 0.8.0"])
65
- s.add_dependency(%q<jeweler>.freeze, ["~> 2.1.1"])
66
- s.add_dependency(%q<rack>.freeze, ["~> 1.6.4"])
67
- s.add_dependency(%q<rake>.freeze, [">= 0"])
68
- s.add_dependency(%q<rdoc>.freeze, [">= 0"])
69
- s.add_dependency(%q<rspec>.freeze, [">= 2.0.0"])
70
- s.add_dependency(%q<simplecov>.freeze, [">= 0.4.0"])
71
- end
72
- else
73
- s.add_dependency(%q<mongoid>.freeze, [">= 2.0"])
74
- s.add_dependency(%q<bundler>.freeze, [">= 0"])
75
- s.add_dependency(%q<database_cleaner>.freeze, [">= 0.8.0"])
76
- s.add_dependency(%q<jeweler>.freeze, ["~> 2.1.1"])
77
- s.add_dependency(%q<rack>.freeze, ["~> 1.6.4"])
78
- s.add_dependency(%q<rake>.freeze, [">= 0"])
79
- s.add_dependency(%q<rdoc>.freeze, [">= 0"])
80
- s.add_dependency(%q<rspec>.freeze, [">= 2.0.0"])
81
- s.add_dependency(%q<simplecov>.freeze, [">= 0.4.0"])
82
- end
51
+ s.add_runtime_dependency(%q<mongoid>.freeze, [">= 2.0"])
52
+ s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
53
+ s.add_development_dependency(%q<database_cleaner-mongoid>.freeze, ["~> 2.0", ">= 2.0.1"])
54
+ s.add_development_dependency(%q<jeweler>.freeze, ["~> 2.1.1"])
55
+ s.add_development_dependency(%q<rack>.freeze, ["~> 1.6.4"])
56
+ s.add_development_dependency(%q<rake>.freeze, [">= 0"])
57
+ s.add_development_dependency(%q<rdoc>.freeze, [">= 0"])
58
+ s.add_development_dependency(%q<rspec>.freeze, [">= 2.0.0"])
59
+ s.add_development_dependency(%q<simplecov>.freeze, [">= 0.4.0"])
83
60
  end
84
61
 
data/spec/spec_helper.rb CHANGED
@@ -6,7 +6,7 @@ MODELS = File.join(File.dirname(__FILE__), 'models')
6
6
  require 'rubygems'
7
7
  require 'mongoid'
8
8
  require 'mongoid_auto_increment'
9
- require 'database_cleaner'
9
+ require 'database_cleaner/mongoid'
10
10
  require 'simplecov'
11
11
 
12
12
  SimpleCov.start
@@ -22,18 +22,16 @@ else
22
22
  end
23
23
  Mongoid.logger = Logger.new($stdout)
24
24
 
25
- DatabaseCleaner.orm = 'mongoid'
26
-
27
25
  RSpec.configure do |config|
28
26
  config.before(:all) do
29
- DatabaseCleaner.strategy = :truncation
27
+ DatabaseCleaner[:mongoid].strategy = :deletion
30
28
  end
31
29
 
32
30
  config.before(:each) do
33
- DatabaseCleaner.start
31
+ DatabaseCleaner[:mongoid].start
34
32
  end
35
33
 
36
34
  config.after(:each) do
37
- DatabaseCleaner.clean
35
+ DatabaseCleaner[:mongoid].clean
38
36
  end
39
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_auto_increment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Savichev (proton)
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-07 00:00:00.000000000 Z
11
+ date: 2023-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
@@ -39,19 +39,25 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: database_cleaner
42
+ name: database_cleaner-mongoid
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
45
48
  - - ">="
46
49
  - !ruby/object:Gem::Version
47
- version: 0.8.0
50
+ version: 2.0.1
48
51
  type: :development
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '2.0'
52
58
  - - ">="
53
59
  - !ruby/object:Gem::Version
54
- version: 0.8.0
60
+ version: 2.0.1
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: jeweler
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -142,13 +148,14 @@ executables: []
142
148
  extensions: []
143
149
  extra_rdoc_files:
144
150
  - LICENSE
145
- - README.rdoc
151
+ - README.md
146
152
  files:
153
+ - ".github/FUNDING.yml"
147
154
  - ".rspec"
148
155
  - ".travis.yml"
149
156
  - Gemfile
150
157
  - LICENSE
151
- - README.rdoc
158
+ - README.md
152
159
  - Rakefile
153
160
  - VERSION
154
161
  - lib/mongoid_auto_increment.rb
@@ -168,7 +175,7 @@ homepage: http://github.com/proton/mongoid_auto_increment
168
175
  licenses:
169
176
  - MIT
170
177
  metadata: {}
171
- post_install_message:
178
+ post_install_message:
172
179
  rdoc_options: []
173
180
  require_paths:
174
181
  - lib
@@ -183,9 +190,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
190
  - !ruby/object:Gem::Version
184
191
  version: '0'
185
192
  requirements: []
186
- rubyforge_project:
187
- rubygems_version: 2.6.14
188
- signing_key:
193
+ rubygems_version: 3.4.6
194
+ signing_key:
189
195
  specification_version: 4
190
196
  summary: Auto-incrementing fields for Mongoid documents
191
197
  test_files: []
data/README.rdoc DELETED
@@ -1,73 +0,0 @@
1
- = Mongoid::AutoIncrement
2
-
3
- Add SQL like auto-incrementing fields to your Mongoid documents.
4
- This gem is inspired by http://ihswebdesign.com/blog/autoincrement-in-mongodb-with-ruby/ and the mongomapper_id2[https://github.com/phstc/mongomapper_id2] gem.
5
-
6
- {<img src="https://secure.travis-ci.org/proton/mongoid_auto_increment.png" />}[http://travis-ci.org/proton/mongoid_auto_increment]
7
- {<img src="https://www.codetriage.com/proton/mongoid_auto_increment/badges/users.svg" />}[https://www.codetriage.com/proton/mongoid_auto_increment]
8
-
9
- == Installation
10
-
11
- Add to Gemfile:
12
-
13
- gem 'mongoid_auto_increment'
14
-
15
- == Getting Started
16
-
17
- Just add <tt>auto_increment :field</tt> to your Mongoid model where <tt>:field</tt> is the name of the auto-incremented field you want to create.
18
- Example:
19
-
20
- class Book
21
- include Mongoid::Document
22
-
23
- field :title
24
- field :author
25
-
26
- auto_increment :sequence
27
- end
28
-
29
- <tt>auto_increment :sequence</tt> will create a field of type <tt>Integer</tt> named <tt>sequence</tt> for <tt>Book</tt>. Whenever an instance of the model is created (intially saved to mongoDB), the <tt>auto_increment</tt> field will automatically be set to the next number in the sequence.
30
-
31
- You can add more than one auto-incremented field per model.
32
-
33
- === Options
34
-
35
- auto_increment :sequence, collection: :some_collection
36
-
37
- <tt>mongoid_auto_inc</tt> keeps track of the current number in the sequence by creating a separate document mongoDB to query and update. By default <tt>auto_increment</tt> will save this document to a mongoDB collection called <tt>sequences</tt>. If you wish to save to a different collection use the <tt>:collection</tt> option to specify its name.
38
-
39
- auto_increment :sequence, step: 5
40
-
41
- If desired, you can override the <tt>:step</tt>, or increment amount (default is 1).
42
-
43
- auto_increment :sequence, seed: 3333
44
-
45
- Use the <tt>:seed</tt> option to set the initial value of the auto-incremented field. The first number assigned from the sequence will be the next number after the seed value (including the step - so for <tt>seed: 1000, step: 5</tt>, first value will be 1005).
46
-
47
- auto_increment :sequence, scope: :some_field_or_relation
48
- auto_increment :sequence, scope: [ :some_field_or_relation, :another_field_or_relation ]
49
-
50
- Use the <tt>:scope</tt> option to scope an auto-incremented field to a query. Similar to Mongoid, the scope may contain one or many fields or relations. Each unique scope will result in it's own stream of incremented values.
51
-
52
- == Contributing to Mongoid::AutoIncrement
53
-
54
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
55
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
56
- * Fork the project
57
- * Start a feature/bugfix branch
58
- * Commit and push until you are happy with your contribution
59
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
60
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
61
-
62
- == Support us
63
-
64
-
65
- {<img src="http://api.flattr.com/button/flattr-badge-large.png" />}[https://flattr.com/submit/auto?user_id=proton&url=https://github.com/proton/mongoid_auto_increment/&title=MongoidAutoIncrement&language=&tags=github&category=software]
66
-
67
-
68
- == Copyright
69
-
70
- (c) 2011-2018 Peter Savichev (proton)
71
- (c) 2010-2011 Jeff Smith
72
-
73
- See LICENSE.txt for further details.