sortable-by 0.13.0 → 0.13.1
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 +4 -4
- data/.github/workflows/ruby.yml +21 -0
- data/.rubocop.yml +7 -4
- data/Gemfile.lock +61 -43
- data/lib/sortable_by.rb +1 -1
- data/sortable-by.gemspec +3 -3
- data/spec/{sortable_by_spec.rb → active_record/sortable_by_spec.rb} +6 -6
- metadata +8 -8
- data/.travis.yml +0 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4bb07dd11741d2ea29ae694e1e6bc11711e8427b137855ff84fe6760e182e59e
|
|
4
|
+
data.tar.gz: a5d2b6e874053630307e891855e542b6874adad75788e6a0c822a2e9336d490d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 95feb9e2a5ba054e128572c35da39246760472ecb12c456976e267cac7eaa425c61505bce2037af98c5e33d5f20513571405395f1c462ad2054f6032d6600a5c
|
|
7
|
+
data.tar.gz: 610babd95b3ba593f9f566720e549929e13aef5031aa7330f7e87a07feac48b68483f2c5d2bc14489d81dd0728e39d405aeeb6d7681437598a98078e10f2e437
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Ruby
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
ruby-version: ["2.6", "2.7", "3.0"]
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v2
|
|
17
|
+
- uses: ruby/setup-ruby@v1
|
|
18
|
+
with:
|
|
19
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
20
|
+
bundler-cache: true
|
|
21
|
+
- run: bundle exec rake
|
data/.rubocop.yml
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
-
|
|
1
|
+
inherit_gem:
|
|
2
|
+
rubocop-bsm:
|
|
3
|
+
- default.yml
|
|
4
|
+
inherit_mode:
|
|
5
|
+
merge:
|
|
6
|
+
- Exclude
|
|
3
7
|
|
|
4
8
|
AllCops:
|
|
5
|
-
TargetRubyVersion: 2.
|
|
6
|
-
|
|
9
|
+
TargetRubyVersion: 2.6
|
|
7
10
|
Naming/MethodParameterName:
|
|
8
11
|
MinNameLength: 2
|
|
9
12
|
Naming/MemoizedInstanceVariableName:
|
data/Gemfile.lock
CHANGED
|
@@ -1,68 +1,86 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
sortable-by (0.13.
|
|
4
|
+
sortable-by (0.13.1)
|
|
5
5
|
activerecord
|
|
6
6
|
activesupport
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: http://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
activemodel (6.
|
|
12
|
-
activesupport (= 6.
|
|
13
|
-
activerecord (6.
|
|
14
|
-
activemodel (= 6.
|
|
15
|
-
activesupport (= 6.
|
|
16
|
-
activesupport (6.
|
|
11
|
+
activemodel (6.1.3)
|
|
12
|
+
activesupport (= 6.1.3)
|
|
13
|
+
activerecord (6.1.3)
|
|
14
|
+
activemodel (= 6.1.3)
|
|
15
|
+
activesupport (= 6.1.3)
|
|
16
|
+
activesupport (6.1.3)
|
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
18
|
-
i18n (>=
|
|
19
|
-
minitest (
|
|
20
|
-
tzinfo (~>
|
|
21
|
-
zeitwerk (~> 2.
|
|
22
|
-
ast (2.4.
|
|
23
|
-
concurrent-ruby (1.1.
|
|
18
|
+
i18n (>= 1.6, < 2)
|
|
19
|
+
minitest (>= 5.1)
|
|
20
|
+
tzinfo (~> 2.0)
|
|
21
|
+
zeitwerk (~> 2.3)
|
|
22
|
+
ast (2.4.2)
|
|
23
|
+
concurrent-ruby (1.1.8)
|
|
24
24
|
diff-lcs (1.4.4)
|
|
25
|
-
i18n (1.8.
|
|
25
|
+
i18n (1.8.9)
|
|
26
26
|
concurrent-ruby (~> 1.0)
|
|
27
|
-
minitest (5.14.
|
|
28
|
-
parallel (1.
|
|
29
|
-
parser (
|
|
27
|
+
minitest (5.14.4)
|
|
28
|
+
parallel (1.20.1)
|
|
29
|
+
parser (3.0.0.0)
|
|
30
30
|
ast (~> 2.4.1)
|
|
31
|
+
rack (2.2.3)
|
|
31
32
|
rainbow (3.0.0)
|
|
32
|
-
rake (13.0.
|
|
33
|
-
regexp_parser (1.
|
|
33
|
+
rake (13.0.3)
|
|
34
|
+
regexp_parser (2.1.1)
|
|
34
35
|
rexml (3.2.4)
|
|
35
|
-
rspec (3.
|
|
36
|
-
rspec-core (~> 3.
|
|
37
|
-
rspec-expectations (~> 3.
|
|
38
|
-
rspec-mocks (~> 3.
|
|
39
|
-
rspec-core (3.
|
|
40
|
-
rspec-support (~> 3.
|
|
41
|
-
rspec-expectations (3.
|
|
36
|
+
rspec (3.10.0)
|
|
37
|
+
rspec-core (~> 3.10.0)
|
|
38
|
+
rspec-expectations (~> 3.10.0)
|
|
39
|
+
rspec-mocks (~> 3.10.0)
|
|
40
|
+
rspec-core (3.10.1)
|
|
41
|
+
rspec-support (~> 3.10.0)
|
|
42
|
+
rspec-expectations (3.10.1)
|
|
42
43
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
43
|
-
rspec-support (~> 3.
|
|
44
|
-
rspec-mocks (3.
|
|
44
|
+
rspec-support (~> 3.10.0)
|
|
45
|
+
rspec-mocks (3.10.2)
|
|
45
46
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
46
|
-
rspec-support (~> 3.
|
|
47
|
-
rspec-support (3.
|
|
48
|
-
rubocop (
|
|
47
|
+
rspec-support (~> 3.10.0)
|
|
48
|
+
rspec-support (3.10.2)
|
|
49
|
+
rubocop (1.11.0)
|
|
49
50
|
parallel (~> 1.10)
|
|
50
|
-
parser (>=
|
|
51
|
+
parser (>= 3.0.0.0)
|
|
51
52
|
rainbow (>= 2.2.2, < 4.0)
|
|
52
|
-
regexp_parser (>= 1.
|
|
53
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
53
54
|
rexml
|
|
54
|
-
rubocop-ast (>=
|
|
55
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
|
55
56
|
ruby-progressbar (~> 1.7)
|
|
56
|
-
unicode-display_width (>= 1.4.0, <
|
|
57
|
-
rubocop-ast (
|
|
57
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
|
58
|
+
rubocop-ast (1.4.1)
|
|
58
59
|
parser (>= 2.7.1.5)
|
|
59
|
-
|
|
60
|
+
rubocop-bsm (0.5.4)
|
|
61
|
+
rubocop (~> 1.0)
|
|
62
|
+
rubocop-performance
|
|
63
|
+
rubocop-rails
|
|
64
|
+
rubocop-rake
|
|
65
|
+
rubocop-rspec
|
|
66
|
+
rubocop-performance (1.10.1)
|
|
67
|
+
rubocop (>= 0.90.0, < 2.0)
|
|
68
|
+
rubocop-ast (>= 0.4.0)
|
|
69
|
+
rubocop-rails (2.9.1)
|
|
70
|
+
activesupport (>= 4.2.0)
|
|
71
|
+
rack (>= 1.1)
|
|
72
|
+
rubocop (>= 0.90.0, < 2.0)
|
|
73
|
+
rubocop-rake (0.5.1)
|
|
74
|
+
rubocop
|
|
75
|
+
rubocop-rspec (2.2.0)
|
|
76
|
+
rubocop (~> 1.0)
|
|
77
|
+
rubocop-ast (>= 1.1.0)
|
|
78
|
+
ruby-progressbar (1.11.0)
|
|
60
79
|
sqlite3 (1.4.2)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
zeitwerk (2.4.0)
|
|
80
|
+
tzinfo (2.0.4)
|
|
81
|
+
concurrent-ruby (~> 1.0)
|
|
82
|
+
unicode-display_width (2.0.0)
|
|
83
|
+
zeitwerk (2.4.2)
|
|
66
84
|
|
|
67
85
|
PLATFORMS
|
|
68
86
|
ruby
|
|
@@ -71,7 +89,7 @@ DEPENDENCIES
|
|
|
71
89
|
bundler
|
|
72
90
|
rake
|
|
73
91
|
rspec
|
|
74
|
-
rubocop
|
|
92
|
+
rubocop-bsm
|
|
75
93
|
sortable-by!
|
|
76
94
|
sqlite3
|
|
77
95
|
|
data/lib/sortable_by.rb
CHANGED
data/sortable-by.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = 'sortable-by'
|
|
3
|
-
s.version = '0.13.
|
|
3
|
+
s.version = '0.13.1'
|
|
4
4
|
s.authors = ['Dimitrij Denissenko']
|
|
5
5
|
s.email = ['dimitrij@blacksquaremedia.com']
|
|
6
6
|
s.summary = 'Generate white-listed sort scopes from URL parameter values'
|
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
|
11
11
|
s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^spec/}) }
|
|
12
12
|
s.test_files = `git ls-files -z -- spec/*`.split("\x0")
|
|
13
13
|
s.require_paths = ['lib']
|
|
14
|
-
s.required_ruby_version = '>= 2.
|
|
14
|
+
s.required_ruby_version = '>= 2.6'
|
|
15
15
|
|
|
16
16
|
s.add_dependency 'activerecord'
|
|
17
17
|
s.add_dependency 'activesupport'
|
|
@@ -19,6 +19,6 @@ Gem::Specification.new do |s|
|
|
|
19
19
|
s.add_development_dependency 'bundler'
|
|
20
20
|
s.add_development_dependency 'rake'
|
|
21
21
|
s.add_development_dependency 'rspec'
|
|
22
|
-
s.add_development_dependency 'rubocop'
|
|
22
|
+
s.add_development_dependency 'rubocop-bsm'
|
|
23
23
|
s.add_development_dependency 'sqlite3'
|
|
24
24
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe ActiveRecord::SortableBy do
|
|
4
4
|
before do
|
|
@@ -8,7 +8,7 @@ describe ActiveRecord::SortableBy do
|
|
|
8
8
|
end
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
it '
|
|
11
|
+
it 'has config' do
|
|
12
12
|
expect(Post._sortable_by_config._fields.keys).to match_array(%w[title created])
|
|
13
13
|
expect(Post._sortable_by_config._default).to eq('-created')
|
|
14
14
|
expect(SubPost._sortable_by_config._fields.keys).to match_array(%w[title created])
|
|
@@ -24,7 +24,7 @@ describe ActiveRecord::SortableBy do
|
|
|
24
24
|
expect(Product._sortable_by_config._default).to eq('shop,name')
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
it '
|
|
27
|
+
it 'simplies order' do
|
|
28
28
|
Post.create! title: 'A', created_at: Time.at(1515151500)
|
|
29
29
|
Post.create! title: 'b', created_at: Time.at(1515151600)
|
|
30
30
|
Post.create! title: 'C', created_at: Time.at(1515151400)
|
|
@@ -41,7 +41,7 @@ describe ActiveRecord::SortableBy do
|
|
|
41
41
|
expect(Post.sorted_by(' title ').pluck(:title)).to eq(%w[A C b])
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
it '
|
|
44
|
+
it 'supports STI inheritance and overrides' do
|
|
45
45
|
SubPost.create! title: 'A', created_at: Time.at(1515151700)
|
|
46
46
|
SubPost.create! title: 'b', created_at: Time.at(1515151600)
|
|
47
47
|
Post.create! title: 'C', created_at: Time.at(1515151400)
|
|
@@ -56,7 +56,7 @@ describe ActiveRecord::SortableBy do
|
|
|
56
56
|
expect(SubPost.sorted_by('title').pluck(:title)).to eq(%w[A b D])
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
-
it '
|
|
59
|
+
it 'supports composition' do
|
|
60
60
|
App.create! name: 'E', major: 0, minor: 9, patch: 2
|
|
61
61
|
App.create! name: 'A', major: 1, minor: 0, patch: 1
|
|
62
62
|
App.create! name: 'D', major: 1, minor: 0, patch: 6
|
|
@@ -68,7 +68,7 @@ describe ActiveRecord::SortableBy do
|
|
|
68
68
|
expect(App.sorted_by('-version').pluck(:name)).to eq(%w[B C D A E])
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
-
it '
|
|
71
|
+
it 'supports associations' do
|
|
72
72
|
y = Shop.create! name: 'Y'
|
|
73
73
|
x = Shop.create! name: 'X'
|
|
74
74
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sortable-by
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.13.
|
|
4
|
+
version: 0.13.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dimitrij Denissenko
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-03-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
@@ -81,7 +81,7 @@ dependencies:
|
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
82
|
version: '0'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
|
-
name: rubocop
|
|
84
|
+
name: rubocop-bsm
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
86
86
|
requirements:
|
|
87
87
|
- - ">="
|
|
@@ -115,9 +115,9 @@ executables: []
|
|
|
115
115
|
extensions: []
|
|
116
116
|
extra_rdoc_files: []
|
|
117
117
|
files:
|
|
118
|
+
- ".github/workflows/ruby.yml"
|
|
118
119
|
- ".gitignore"
|
|
119
120
|
- ".rubocop.yml"
|
|
120
|
-
- ".travis.yml"
|
|
121
121
|
- Gemfile
|
|
122
122
|
- Gemfile.lock
|
|
123
123
|
- LICENSE
|
|
@@ -126,7 +126,7 @@ files:
|
|
|
126
126
|
- lib/sortable-by.rb
|
|
127
127
|
- lib/sortable_by.rb
|
|
128
128
|
- sortable-by.gemspec
|
|
129
|
-
- spec/sortable_by_spec.rb
|
|
129
|
+
- spec/active_record/sortable_by_spec.rb
|
|
130
130
|
- spec/spec_helper.rb
|
|
131
131
|
homepage: https://github.com/bsm/sortable-by
|
|
132
132
|
licenses:
|
|
@@ -140,17 +140,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
140
140
|
requirements:
|
|
141
141
|
- - ">="
|
|
142
142
|
- !ruby/object:Gem::Version
|
|
143
|
-
version: '2.
|
|
143
|
+
version: '2.6'
|
|
144
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
145
|
requirements:
|
|
146
146
|
- - ">="
|
|
147
147
|
- !ruby/object:Gem::Version
|
|
148
148
|
version: '0'
|
|
149
149
|
requirements: []
|
|
150
|
-
rubygems_version: 3.1.
|
|
150
|
+
rubygems_version: 3.1.4
|
|
151
151
|
signing_key:
|
|
152
152
|
specification_version: 4
|
|
153
153
|
summary: Generate white-listed sort scopes from URL parameter values
|
|
154
154
|
test_files:
|
|
155
|
-
- spec/sortable_by_spec.rb
|
|
155
|
+
- spec/active_record/sortable_by_spec.rb
|
|
156
156
|
- spec/spec_helper.rb
|