mongoid_orderable 5.2.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +73 -58
  3. data/LICENSE.txt +20 -20
  4. data/README.md +256 -150
  5. data/Rakefile +24 -21
  6. data/lib/config/locales/en.yml +12 -9
  7. data/lib/mongoid/orderable.rb +29 -20
  8. data/lib/mongoid/orderable/configs/field_config.rb +79 -0
  9. data/lib/mongoid/orderable/configs/global_config.rb +26 -0
  10. data/lib/mongoid/orderable/engine.rb +204 -0
  11. data/lib/mongoid/orderable/errors/invalid_target_position.rb +19 -15
  12. data/lib/mongoid/orderable/errors/transaction_failed.rb +20 -0
  13. data/lib/mongoid/orderable/generators/base.rb +21 -0
  14. data/lib/mongoid/orderable/generators/helpers.rb +29 -0
  15. data/lib/mongoid/orderable/generators/listable.rb +41 -0
  16. data/lib/mongoid/orderable/generators/lock_collection.rb +37 -0
  17. data/lib/mongoid/orderable/generators/movable.rb +62 -0
  18. data/lib/mongoid/orderable/generators/position.rb +26 -0
  19. data/lib/mongoid/orderable/generators/scope.rb +26 -0
  20. data/lib/mongoid/orderable/installer.rb +63 -0
  21. data/lib/mongoid/orderable/mixins/callbacks.rb +29 -0
  22. data/lib/mongoid/orderable/mixins/helpers.rb +39 -0
  23. data/lib/mongoid/orderable/mixins/listable.rb +49 -0
  24. data/lib/mongoid/orderable/mixins/movable.rb +60 -0
  25. data/lib/mongoid/orderable/version.rb +7 -0
  26. data/lib/mongoid_orderable.rb +29 -56
  27. data/spec/mongoid/orderable_spec.rb +1486 -1380
  28. data/spec/spec_helper.rb +21 -21
  29. metadata +44 -41
  30. data/.gitignore +0 -4
  31. data/.rspec +0 -2
  32. data/.rubocop.yml +0 -6
  33. data/.rubocop_todo.yml +0 -88
  34. data/.rvmrc +0 -1
  35. data/.travis.yml +0 -48
  36. data/CONTRIBUTING.md +0 -118
  37. data/Dangerfile +0 -1
  38. data/Gemfile +0 -26
  39. data/RELEASING.md +0 -68
  40. data/lib/mongoid/orderable/callbacks.rb +0 -79
  41. data/lib/mongoid/orderable/configuration.rb +0 -58
  42. data/lib/mongoid/orderable/errors.rb +0 -2
  43. data/lib/mongoid/orderable/errors/mongoid_orderable_error.rb +0 -6
  44. data/lib/mongoid/orderable/generator.rb +0 -33
  45. data/lib/mongoid/orderable/generator/helpers.rb +0 -27
  46. data/lib/mongoid/orderable/generator/listable.rb +0 -39
  47. data/lib/mongoid/orderable/generator/movable.rb +0 -60
  48. data/lib/mongoid/orderable/generator/position.rb +0 -24
  49. data/lib/mongoid/orderable/generator/scope.rb +0 -17
  50. data/lib/mongoid/orderable/helpers.rb +0 -49
  51. data/lib/mongoid/orderable/listable.rb +0 -47
  52. data/lib/mongoid/orderable/movable.rb +0 -56
  53. data/lib/mongoid/orderable/orderable_class.rb +0 -47
  54. data/lib/mongoid_orderable/mongoid/contextual/memory.rb +0 -15
  55. data/lib/mongoid_orderable/version.rb +0 -3
  56. data/mongoid_orderable.gemspec +0 -26
@@ -1,21 +1,21 @@
1
- require 'bundler'
2
- Bundler.require
3
-
4
- Mongoid.configure do |config|
5
- config.connect_to 'mongoid_orderable_test'
6
- end
7
-
8
- Mongoid.logger.level = Logger::INFO
9
- Mongo::Logger.logger.level = Logger::INFO if Mongoid::Compatibility::Version.mongoid5_or_newer?
10
-
11
- Mongoid::Config.belongs_to_required_by_default = false if Mongoid::Compatibility::Version.mongoid6?
12
-
13
- RSpec.configure do |config|
14
- config.after(:all) do
15
- if Mongoid::Compatibility::Version.mongoid3? || Mongoid::Compatibility::Version.mongoid4?
16
- Mongoid.default_session.drop
17
- else
18
- Mongoid::Clients.default.database.drop
19
- end
20
- end
21
- end
1
+ require 'bundler'
2
+ Bundler.require
3
+ require 'rspec'
4
+ require 'rspec/retry'
5
+
6
+ Mongoid.configure do |config|
7
+ config.connect_to 'mongoid_orderable_test'
8
+ end
9
+
10
+ Mongoid.logger.level = Logger::INFO
11
+ Mongo::Logger.logger.level = Logger::INFO
12
+ Mongoid::Config.belongs_to_required_by_default = false
13
+
14
+ RSpec.configure do |config|
15
+ config.before(:each) do
16
+ Mongoid.purge!
17
+ Mongoid.models.each do |model|
18
+ model.create_indexes if model.name =~ /Mongoid::Orderable::Models/
19
+ end
20
+ end
21
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_orderable
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.0
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pyromaniac
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-01 00:00:00.000000000 Z
11
+ date: 2021-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -26,6 +26,20 @@ dependencies:
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 3.0.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 3.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec-retry
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - ">="
@@ -39,78 +53,68 @@ dependencies:
39
53
  - !ruby/object:Gem::Version
40
54
  version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
- name: mongoid
56
+ name: rubocop
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - ">="
46
60
  - !ruby/object:Gem::Version
47
- version: 3.0.0
48
- type: :runtime
61
+ version: 1.8.1
62
+ type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - ">="
53
67
  - !ruby/object:Gem::Version
54
- version: 3.0.0
68
+ version: 1.8.1
55
69
  - !ruby/object:Gem::Dependency
56
- name: mongoid-compatibility
70
+ name: mongoid
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ">="
60
74
  - !ruby/object:Gem::Version
61
- version: '0'
75
+ version: 7.0.0
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - ">="
67
81
  - !ruby/object:Gem::Version
68
- version: '0'
69
- description: Gem allows mongoid model behave as orderable list
82
+ version: 7.0.0
83
+ description: Enables Mongoid models to track their position in list
70
84
  email:
71
85
  - kinwizard@gmail.com
72
86
  executables: []
73
87
  extensions: []
74
88
  extra_rdoc_files: []
75
89
  files:
76
- - ".gitignore"
77
- - ".rspec"
78
- - ".rubocop.yml"
79
- - ".rubocop_todo.yml"
80
- - ".rvmrc"
81
- - ".travis.yml"
82
90
  - CHANGELOG.md
83
- - CONTRIBUTING.md
84
- - Dangerfile
85
- - Gemfile
86
91
  - LICENSE.txt
87
92
  - README.md
88
- - RELEASING.md
89
93
  - Rakefile
90
94
  - lib/config/locales/en.yml
91
95
  - lib/mongoid/orderable.rb
92
- - lib/mongoid/orderable/callbacks.rb
93
- - lib/mongoid/orderable/configuration.rb
94
- - lib/mongoid/orderable/errors.rb
96
+ - lib/mongoid/orderable/configs/field_config.rb
97
+ - lib/mongoid/orderable/configs/global_config.rb
98
+ - lib/mongoid/orderable/engine.rb
95
99
  - lib/mongoid/orderable/errors/invalid_target_position.rb
96
- - lib/mongoid/orderable/errors/mongoid_orderable_error.rb
97
- - lib/mongoid/orderable/generator.rb
98
- - lib/mongoid/orderable/generator/helpers.rb
99
- - lib/mongoid/orderable/generator/listable.rb
100
- - lib/mongoid/orderable/generator/movable.rb
101
- - lib/mongoid/orderable/generator/position.rb
102
- - lib/mongoid/orderable/generator/scope.rb
103
- - lib/mongoid/orderable/helpers.rb
104
- - lib/mongoid/orderable/listable.rb
105
- - lib/mongoid/orderable/movable.rb
106
- - lib/mongoid/orderable/orderable_class.rb
100
+ - lib/mongoid/orderable/errors/transaction_failed.rb
101
+ - lib/mongoid/orderable/generators/base.rb
102
+ - lib/mongoid/orderable/generators/helpers.rb
103
+ - lib/mongoid/orderable/generators/listable.rb
104
+ - lib/mongoid/orderable/generators/lock_collection.rb
105
+ - lib/mongoid/orderable/generators/movable.rb
106
+ - lib/mongoid/orderable/generators/position.rb
107
+ - lib/mongoid/orderable/generators/scope.rb
108
+ - lib/mongoid/orderable/installer.rb
109
+ - lib/mongoid/orderable/mixins/callbacks.rb
110
+ - lib/mongoid/orderable/mixins/helpers.rb
111
+ - lib/mongoid/orderable/mixins/listable.rb
112
+ - lib/mongoid/orderable/mixins/movable.rb
113
+ - lib/mongoid/orderable/version.rb
107
114
  - lib/mongoid_orderable.rb
108
- - lib/mongoid_orderable/mongoid/contextual/memory.rb
109
- - lib/mongoid_orderable/version.rb
110
- - mongoid_orderable.gemspec
111
115
  - spec/mongoid/orderable_spec.rb
112
116
  - spec/spec_helper.rb
113
- homepage: ''
117
+ homepage: https://github.com/mongoid/mongoid_orderable
114
118
  licenses: []
115
119
  metadata: {}
116
120
  post_install_message:
@@ -128,11 +132,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
132
  - !ruby/object:Gem::Version
129
133
  version: '0'
130
134
  requirements: []
131
- rubyforge_project: mongoid_orderable
132
- rubygems_version: 2.6.13
135
+ rubygems_version: 3.1.2
133
136
  signing_key:
134
137
  specification_version: 4
135
- summary: Acts as list mongoid implementation
138
+ summary: Mongoid orderable list implementation
136
139
  test_files:
137
140
  - spec/mongoid/orderable_spec.rb
138
141
  - spec/spec_helper.rb
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- *.gem
2
- .bundle
3
- Gemfile.lock
4
- pkg/*
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --colour
2
- --format=documentation
@@ -1,6 +0,0 @@
1
- AllCops:
2
- Exclude:
3
- - vendor/**/*
4
- - bin/**/*
5
-
6
- inherit_from: .rubocop_todo.yml
@@ -1,88 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2016-11-21 14:00:35 -0500 using RuboCop version 0.45.0.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 1
10
- Lint/AmbiguousOperator:
11
- Exclude:
12
- - 'lib/mongoid_orderable/mongoid/contextual/memory.rb'
13
-
14
- # Offense count: 3
15
- Metrics/AbcSize:
16
- Max: 34
17
-
18
- # Offense count: 1
19
- # Configuration parameters: CountComments.
20
- Metrics/BlockLength:
21
- Max: 51
22
-
23
- # Offense count: 2
24
- Metrics/CyclomaticComplexity:
25
- Max: 10
26
-
27
- # Offense count: 96
28
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives.
29
- # URISchemes: http, https
30
- Metrics/LineLength:
31
- Max: 134
32
-
33
- # Offense count: 6
34
- # Configuration parameters: CountComments.
35
- Metrics/MethodLength:
36
- Max: 17
37
-
38
- # Offense count: 1
39
- Metrics/PerceivedComplexity:
40
- Max: 10
41
-
42
- # Offense count: 1
43
- Style/AccessorMethodName:
44
- Exclude:
45
- - 'lib/mongoid/orderable/configuration.rb'
46
-
47
- # Offense count: 3
48
- # Configuration parameters: EnforcedStyle, SupportedStyles.
49
- # SupportedStyles: nested, compact
50
- Style/ClassAndModuleChildren:
51
- Exclude:
52
- - 'lib/mongoid/orderable.rb'
53
- - 'lib/mongoid/orderable/errors/invalid_target_position.rb'
54
- - 'lib/mongoid/orderable/errors/mongoid_orderable_error.rb'
55
-
56
- # Offense count: 17
57
- Style/Documentation:
58
- Exclude:
59
- - 'spec/**/*'
60
- - 'test/**/*'
61
- - 'lib/mongoid/orderable.rb'
62
- - 'lib/mongoid/orderable/callbacks.rb'
63
- - 'lib/mongoid/orderable/configuration.rb'
64
- - 'lib/mongoid/orderable/errors/invalid_target_position.rb'
65
- - 'lib/mongoid/orderable/generator.rb'
66
- - 'lib/mongoid/orderable/generator/helpers.rb'
67
- - 'lib/mongoid/orderable/generator/listable.rb'
68
- - 'lib/mongoid/orderable/generator/movable.rb'
69
- - 'lib/mongoid/orderable/generator/position.rb'
70
- - 'lib/mongoid/orderable/generator/scope.rb'
71
- - 'lib/mongoid/orderable/helpers.rb'
72
- - 'lib/mongoid/orderable/listable.rb'
73
- - 'lib/mongoid/orderable/movable.rb'
74
- - 'lib/mongoid/orderable/orderable_class.rb'
75
- - 'lib/mongoid_orderable.rb'
76
-
77
- # Offense count: 2
78
- # Cop supports --auto-correct.
79
- # Configuration parameters: AllowAsExpressionSeparator.
80
- Style/Semicolon:
81
- Exclude:
82
- - 'spec/mongoid/orderable_spec.rb'
83
-
84
- # Offense count: 37
85
- # Configuration parameters: SupportedStyles.
86
- # SupportedStyles: snake_case, normalcase, non_integer
87
- Style/VariableNumber:
88
- EnforcedStyle: normalcase
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use 2.2@mongoid_orderable --create
@@ -1,48 +0,0 @@
1
- sudo: false
2
-
3
- language: ruby
4
-
5
- cache: bundler
6
-
7
- services: mongodb
8
-
9
- rvm:
10
- - 2.1.10
11
- - 2.3.6
12
- - 2.5.0
13
-
14
- env:
15
- - MONGOID_VERSION=HEAD
16
- - MONGOID_VERSION=7
17
- - MONGOID_VERSION=6
18
- - MONGOID_VERSION=5
19
- - MONGOID_VERSION=4
20
- - MONGOID_VERSION=3
21
-
22
- before_install:
23
- - gem update bundler
24
-
25
- addons:
26
- apt:
27
- sources:
28
- - mongodb-3.2-precise
29
- packages:
30
- - mongodb-org-server
31
-
32
- matrix:
33
- fast_finish: true
34
- allow_failures:
35
- - env: MONGOID_VERSION=HEAD
36
- exclude:
37
- - env: MONGOID_VERSION=HEAD
38
- rvm: 2.1.10
39
- - env: MONGOID_VERSION=7
40
- rvm: 2.1.10
41
- - env: MONGOID_VERSION=6
42
- rvm: 2.1.10
43
- - env: MONGOID_VERSION=5
44
- rvm: 2.1.10
45
- include:
46
- - env: MONGOID_VERSION=6
47
- rvm: 2.3.6
48
- before_script: bundle exec danger
@@ -1,118 +0,0 @@
1
- Contributing to Mongoid::Orderable
2
- ==================================
3
-
4
- Mongoid::Orderable is work of [many of contributors](https://github.com/mongoid/mongoid_orderable/graphs/contributors). You're encouraged to submit [pull requests](https://github.com/mongoid/mongoid_orderable/pulls), [propose features, ask questions and discuss issues](https://github.com/mongoid/mongoid_orderable/issues).
5
-
6
- #### Fork the Project
7
-
8
- Fork the [project on Github](https://github.com/mongoid/mongoid_orderable) and check out your copy.
9
-
10
- ```
11
- git clone https://github.com/contributor/mongoid_orderable.git
12
- cd mongoid_orderable
13
- git remote add upstream https://github.com/mongoid/mongoid_orderable.git
14
- ```
15
-
16
- #### Create a Topic Branch
17
-
18
- Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
19
-
20
- ```
21
- git checkout master
22
- git pull upstream master
23
- git checkout -b my-feature-branch
24
- ```
25
-
26
- #### Bundle Install and Test
27
-
28
- Ensure that you can build the project and run tests.
29
-
30
- ```
31
- bundle install
32
- bundle exec rake
33
- ```
34
-
35
- #### Write Tests
36
-
37
- Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build. Add to [spec/mongoid_orderable](spec/mongoid_orderable).
38
-
39
- We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
40
-
41
- #### Write Code
42
-
43
- Implement your feature or bug fix.
44
-
45
- Ruby style is enforced with [Rubocop](https://github.com/bbatsov/rubocop), run `bundle exec rubocop` and fix any style issues highlighted.
46
-
47
- Make sure that `bundle exec rake` completes without errors.
48
-
49
- #### Write Documentation
50
-
51
- Document any external behavior in the [README](README.md).
52
-
53
- #### Update Changelog
54
-
55
- Add a line to [CHANGELOG](CHANGELOG.md) under *Next Release*. Make it look like every other line, including your name and link to your Github account.
56
-
57
- #### Commit Changes
58
-
59
- Make sure git knows your name and email address:
60
-
61
- ```
62
- git config --global user.name "Your Name"
63
- git config --global user.email "contributor@example.com"
64
- ```
65
-
66
- Writing good commit logs is important. A commit log should describe what changed and why.
67
-
68
- ```
69
- git add ...
70
- git commit
71
- ```
72
-
73
- #### Push
74
-
75
- ```
76
- git push origin my-feature-branch
77
- ```
78
-
79
- #### Make a Pull Request
80
-
81
- Go to https://github.com/contributor/mongoid_orderable and select your feature branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
82
-
83
- #### Rebase
84
-
85
- If you've been working on a change for a while, rebase with upstream/master.
86
-
87
- ```
88
- git fetch upstream
89
- git rebase upstream/master
90
- git push origin my-feature-branch -f
91
- ```
92
-
93
- #### Update CHANGELOG Again
94
-
95
- Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
96
-
97
- ```
98
- * [#123](https://github.com/mongoid/mongoid_orderable/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
99
- ```
100
-
101
- Amend your previous commit and force push the changes.
102
-
103
- ```
104
- git commit --amend
105
- git push origin my-feature-branch -f
106
- ```
107
-
108
- #### Check on Your Pull Request
109
-
110
- Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
111
-
112
- #### Be Patient
113
-
114
- It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang on there!
115
-
116
- #### Thank You
117
-
118
- Please do know that we really appreciate and value your time and work. We love you, really.