kaminari-mandatory_ordering 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +4 -1
- data/.travis.yml +21 -2
- data/README.md +3 -5
- data/gemfiles/active_record_42.gemfile +6 -0
- data/gemfiles/active_record_50.gemfile +6 -0
- data/gemfiles/active_record_edge.gemfile +13 -0
- data/kaminari-mandatory_ordering.gemspec +4 -3
- data/lib/kaminari/mandatory_ordering.rb +1 -2
- data/lib/kaminari/mandatory_ordering/active_record_model_extension.rb +2 -1
- data/lib/kaminari/mandatory_ordering/configuration.rb +3 -0
- data/lib/kaminari/mandatory_ordering/version.rb +1 -1
- metadata +14 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8f508477e6af13a5d570312043deb83cfefb931
|
4
|
+
data.tar.gz: ada5e44036c2f4ea27eeff4f8378b7db21be8d7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ae2cfdb4e336a4c5e8e91277ab0755d3a7838683d10755f873b373d1bb293fd70bb076a4a73baf0ff1ad903b792f478a30fec5207739139d8f094a8790bbea2
|
7
|
+
data.tar.gz: 536b20359a2fa1239ce99b84b1e28be603246a570885d4ee39f4817d70cfc69483d73b6955c7bcaa0bb748033a6e983b333fbb01285d69eff2fe38848484e467
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
sudo: false
|
2
|
+
|
2
3
|
language: ruby
|
4
|
+
|
3
5
|
rvm:
|
4
|
-
- 2.
|
5
|
-
|
6
|
+
- 2.2.7
|
7
|
+
- 2.3.4
|
8
|
+
- 2.4.1
|
9
|
+
|
10
|
+
gemfile:
|
11
|
+
- gemfiles/active_record_50.gemfile
|
12
|
+
- gemfiles/active_record_42.gemfile
|
13
|
+
- gemfiles/active_record_edge.gemfile
|
14
|
+
|
15
|
+
script:
|
16
|
+
- bundle exec rake spec
|
17
|
+
- bundle exec rubocop --display-cop-names
|
18
|
+
|
19
|
+
cache: bundler
|
20
|
+
|
21
|
+
matrix:
|
22
|
+
allow_failures:
|
23
|
+
- gemfile: gemfiles/active_record_edge.gemfile
|
24
|
+
fast_finish: true
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Kaminari::MandatoryOrdering
|
1
|
+
# Kaminari::MandatoryOrdering [![Build Status](https://travis-ci.org/tmikoss/kaminari-mandatory_ordering.svg?branch=master)](https://travis-ci.org/tmikoss/kaminari-mandatory_ordering)
|
2
2
|
|
3
3
|
Makes sure ActiveRecord collections paged over by `kaminari` are ordered.
|
4
4
|
|
@@ -24,13 +24,11 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
Look for `Kaminari::MandatoryOrdering::Error` exceptions, add order clauses to queries causing them.
|
26
26
|
|
27
|
-
|
27
|
+
Can be enabled / disabled by setting `mandatory_ordering` option in `kaminari` configuration (defaults to `true`).
|
28
28
|
|
29
29
|
## Development
|
30
30
|
|
31
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
32
|
-
|
33
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
31
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests and `rubocop` to check code style. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
34
32
|
|
35
33
|
## Contributing
|
36
34
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
git_source(:github) do |repo_name|
|
4
|
+
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
5
|
+
"https://github.com/#{repo_name}.git"
|
6
|
+
end
|
7
|
+
|
8
|
+
github 'rails/rails' do
|
9
|
+
gem 'railties'
|
10
|
+
gem 'activerecord', require: 'active_record'
|
11
|
+
end
|
12
|
+
|
13
|
+
gemspec path: '../'
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
|
2
3
|
lib = File.expand_path('../lib', __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'kaminari/mandatory_ordering/version'
|
@@ -18,12 +19,12 @@ Gem::Specification.new do |spec|
|
|
18
19
|
spec.require_paths = ['lib']
|
19
20
|
|
20
21
|
spec.add_dependency 'kaminari', '>= 1.0'
|
21
|
-
spec.add_dependency 'activerecord', '>= 4.
|
22
|
-
spec.add_dependency 'activesupport', '>= 4.
|
22
|
+
spec.add_dependency 'activerecord', '>= 4.2'
|
23
|
+
spec.add_dependency 'activesupport', '>= 4.2'
|
23
24
|
|
24
25
|
spec.add_development_dependency 'bundler', '~> 1.12'
|
25
26
|
spec.add_development_dependency 'rake', '~> 10.0'
|
26
27
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
27
|
-
spec.add_development_dependency 'rubocop'
|
28
|
+
spec.add_development_dependency 'rubocop', '~> 0.43.0'
|
28
29
|
spec.add_development_dependency 'sqlite3', '>= 1.3'
|
29
30
|
end
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require 'kaminari'
|
2
|
-
require 'active_support/lazy_load_hooks'
|
3
1
|
require 'kaminari/mandatory_ordering/version'
|
4
2
|
require 'kaminari/mandatory_ordering/error'
|
5
3
|
require 'kaminari/mandatory_ordering/active_record_extension'
|
4
|
+
require 'kaminari/mandatory_ordering/configuration'
|
6
5
|
|
7
6
|
module Kaminari
|
8
7
|
module MandatoryOrdering
|
@@ -4,7 +4,7 @@ module Kaminari
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
6
|
def self.prepended(klass)
|
7
|
-
return
|
7
|
+
return unless Kaminari.config.mandatory_ordering
|
8
8
|
|
9
9
|
original = klass.method(Kaminari.config.page_method_name)
|
10
10
|
|
@@ -12,6 +12,7 @@ module Kaminari
|
|
12
12
|
if all.values.fetch(:order, []).none?
|
13
13
|
raise Kaminari::MandatoryOrdering::Error
|
14
14
|
else
|
15
|
+
# TODO: Find out why calling `super` fails to find the previously defined method.
|
15
16
|
original.call(number)
|
16
17
|
end
|
17
18
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaminari-mandatory_ordering
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toms Mikoss
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '4.
|
33
|
+
version: '4.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '4.
|
40
|
+
version: '4.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activesupport
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '4.
|
47
|
+
version: '4.2'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '4.
|
54
|
+
version: '4.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,16 +98,16 @@ dependencies:
|
|
98
98
|
name: rubocop
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 0.43.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 0.43.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: sqlite3
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,10 +138,14 @@ files:
|
|
138
138
|
- Rakefile
|
139
139
|
- bin/console
|
140
140
|
- bin/setup
|
141
|
+
- gemfiles/active_record_42.gemfile
|
142
|
+
- gemfiles/active_record_50.gemfile
|
143
|
+
- gemfiles/active_record_edge.gemfile
|
141
144
|
- kaminari-mandatory_ordering.gemspec
|
142
145
|
- lib/kaminari/mandatory_ordering.rb
|
143
146
|
- lib/kaminari/mandatory_ordering/active_record_extension.rb
|
144
147
|
- lib/kaminari/mandatory_ordering/active_record_model_extension.rb
|
148
|
+
- lib/kaminari/mandatory_ordering/configuration.rb
|
145
149
|
- lib/kaminari/mandatory_ordering/error.rb
|
146
150
|
- lib/kaminari/mandatory_ordering/version.rb
|
147
151
|
homepage: https://github.com/tmikoss/kaminari-mandatory_ordering
|
@@ -163,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
167
|
version: '0'
|
164
168
|
requirements: []
|
165
169
|
rubyforge_project:
|
166
|
-
rubygems_version: 2.
|
170
|
+
rubygems_version: 2.6.11
|
167
171
|
signing_key:
|
168
172
|
specification_version: 4
|
169
173
|
summary: Makes sure ActiveRecord collections paged over by kaminari are ordered
|