kaminari-mandatory_ordering 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 08f862a65011bcd30349ee2d7cf90df4c1805d2e
4
- data.tar.gz: 70c3466b658d90215de5a5537e1d1af12382642b
3
+ metadata.gz: a8f508477e6af13a5d570312043deb83cfefb931
4
+ data.tar.gz: ada5e44036c2f4ea27eeff4f8378b7db21be8d7e
5
5
  SHA512:
6
- metadata.gz: cd18bc69cc6844f7c56452ec180a2e04d453312e58ad1179eea67dae42193c1705879d743f47d44ba0b33972db4d9475266c955d311113be9ce8a2bdaaaa4da4
7
- data.tar.gz: 24be08e162d660a28a264967011a6d1a7ba3184a0a72d26a52457cc4970c534da633633d9c9d42ec54217ccb3d9f6b288b6acac67759ceafe3a5ca3954d67ef9
6
+ metadata.gz: 5ae2cfdb4e336a4c5e8e91277ab0755d3a7838683d10755f873b373d1bb293fd70bb076a4a73baf0ff1ad903b792f478a30fec5207739139d8f094a8790bbea2
7
+ data.tar.gz: 536b20359a2fa1239ce99b84b1e28be603246a570885d4ee39f4817d70cfc69483d73b6955c7bcaa0bb748033a6e983b333fbb01285d69eff2fe38848484e467
data/.gitignore CHANGED
@@ -8,3 +8,4 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  /.vscode/
11
+ /gemfiles/*.lock
data/.rubocop.yml CHANGED
@@ -1,5 +1,8 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.0
2
+ TargetRubyVersion: 2.2
3
+ Exclude:
4
+ - spec/**/*
5
+ - gemfiles/**/*
3
6
 
4
7
  Metrics/LineLength:
5
8
  Max: 145
data/.travis.yml CHANGED
@@ -1,5 +1,24 @@
1
1
  sudo: false
2
+
2
3
  language: ruby
4
+
3
5
  rvm:
4
- - 2.3.1
5
- before_install: gem install bundler -v 1.12.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
- Disable (for example, in production environment) by setting `disable_mandatory_ordering = true` value in `kaminari` configuration block.
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,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'railties', '~> 4.2.0'
4
+ gem 'activerecord', '~> 4.2.0', require: 'active_record'
5
+
6
+ gemspec path: '../'
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'railties', '~> 5.0.0'
4
+ gem 'activerecord', '~> 5.0.0', require: 'active_record'
5
+
6
+ gemspec path: '../'
@@ -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.0'
22
- spec.add_dependency 'activesupport', '>= 4.0'
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 if Kaminari.config.disable_mandatory_ordering
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
@@ -0,0 +1,3 @@
1
+ Kaminari.config.instance_eval do
2
+ self.mandatory_ordering = true
3
+ end
@@ -1,5 +1,5 @@
1
1
  module Kaminari
2
2
  module MandatoryOrdering
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.2.0'.freeze
4
4
  end
5
5
  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.1.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.0'
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.0'
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.0'
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.0'
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: '0'
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: '0'
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.5.1
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