order_query 0.3.4 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +6 -0
- data/Gemfile +7 -0
- data/README.md +21 -14
- data/Rakefile +15 -6
- data/lib/order_query.rb +12 -3
- data/lib/order_query/column.rb +72 -24
- data/lib/order_query/direction.rb +9 -7
- data/lib/order_query/errors.rb +11 -0
- data/lib/order_query/nulls_direction.rb +44 -0
- data/lib/order_query/point.rb +20 -6
- data/lib/order_query/space.rb +17 -8
- data/lib/order_query/sql/column.rb +9 -5
- data/lib/order_query/sql/order_by.rb +83 -11
- data/lib/order_query/sql/where.rb +59 -26
- data/lib/order_query/version.rb +3 -1
- data/spec/gemfiles/rails_5_0.gemfile +1 -1
- data/spec/gemfiles/rails_5_1.gemfile +1 -1
- data/spec/gemfiles/rails_5_2.gemfile +8 -0
- data/spec/order_query_spec.rb +259 -72
- data/spec/spec_helper.rb +24 -1
- metadata +30 -14
- data/spec/gemfiles/rails_4_2.gemfile +0 -9
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Configure Rails Environment
|
2
4
|
ENV['RAILS_ENV'] = ENV['RACK_ENV'] = 'test'
|
3
5
|
if ENV['COVERAGE'] && !%w[rbx jruby].include?(RUBY_ENGINE)
|
@@ -11,4 +13,25 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
|
11
13
|
require 'fileutils'
|
12
14
|
FileUtils.mkpath 'log' unless File.directory? 'log'
|
13
15
|
ActiveRecord::Base.logger = Logger.new('log/test-queries.log')
|
14
|
-
|
16
|
+
adapter = ENV.fetch('DB', 'sqlite3')
|
17
|
+
case adapter
|
18
|
+
when 'mysql2', 'postgresql'
|
19
|
+
system({ 'DB' => adapter }, 'script/create-db-users') unless ENV['TRAVIS']
|
20
|
+
config = {
|
21
|
+
# Host 127.0.0.1 required for default postgres installation on Ubuntu.
|
22
|
+
host: '127.0.0.1',
|
23
|
+
database: 'order_query_gem_test',
|
24
|
+
encoding: 'utf8',
|
25
|
+
min_messages: 'WARNING',
|
26
|
+
adapter: adapter,
|
27
|
+
username: ENV['DB_USERNAME'] || 'order_query',
|
28
|
+
password: ENV['DB_PASSWORD'] || 'order_query'
|
29
|
+
}
|
30
|
+
ActiveRecord::Tasks::DatabaseTasks.create config.stringify_keys
|
31
|
+
ActiveRecord::Base.establish_connection config
|
32
|
+
when 'sqlite3'
|
33
|
+
ActiveRecord::Base.establish_connection adapter: adapter, database: ':memory:'
|
34
|
+
else
|
35
|
+
fail "Unknown DB adapter #{adapter}. "\
|
36
|
+
'Valid adapters are: mysql2, postgresql, sqlite3.'
|
37
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: order_query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gleb Mazovetskiy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '6.0'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '5.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '6.0'
|
@@ -36,7 +36,7 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
39
|
+
version: '5.0'
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '6.0'
|
@@ -46,10 +46,24 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
49
|
+
version: '5.0'
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '6.0'
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: rake
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '10.2'
|
60
|
+
type: :development
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - "~>"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '10.2'
|
53
67
|
- !ruby/object:Gem::Dependency
|
54
68
|
name: rspec
|
55
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -65,19 +79,19 @@ dependencies:
|
|
65
79
|
- !ruby/object:Gem::Version
|
66
80
|
version: '3.4'
|
67
81
|
- !ruby/object:Gem::Dependency
|
68
|
-
name:
|
82
|
+
name: rubocop
|
69
83
|
requirement: !ruby/object:Gem::Requirement
|
70
84
|
requirements:
|
71
|
-
- - "
|
85
|
+
- - ">="
|
72
86
|
- !ruby/object:Gem::Version
|
73
|
-
version: '
|
87
|
+
version: '0'
|
74
88
|
type: :development
|
75
89
|
prerelease: false
|
76
90
|
version_requirements: !ruby/object:Gem::Requirement
|
77
91
|
requirements:
|
78
|
-
- - "
|
92
|
+
- - ">="
|
79
93
|
- !ruby/object:Gem::Version
|
80
|
-
version: '
|
94
|
+
version: '0'
|
81
95
|
- !ruby/object:Gem::Dependency
|
82
96
|
name: simplecov
|
83
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,15 +120,17 @@ files:
|
|
106
120
|
- lib/order_query.rb
|
107
121
|
- lib/order_query/column.rb
|
108
122
|
- lib/order_query/direction.rb
|
123
|
+
- lib/order_query/errors.rb
|
124
|
+
- lib/order_query/nulls_direction.rb
|
109
125
|
- lib/order_query/point.rb
|
110
126
|
- lib/order_query/space.rb
|
111
127
|
- lib/order_query/sql/column.rb
|
112
128
|
- lib/order_query/sql/order_by.rb
|
113
129
|
- lib/order_query/sql/where.rb
|
114
130
|
- lib/order_query/version.rb
|
115
|
-
- spec/gemfiles/rails_4_2.gemfile
|
116
131
|
- spec/gemfiles/rails_5_0.gemfile
|
117
132
|
- spec/gemfiles/rails_5_1.gemfile
|
133
|
+
- spec/gemfiles/rails_5_2.gemfile
|
118
134
|
- spec/order_query_spec.rb
|
119
135
|
- spec/spec_helper.rb
|
120
136
|
homepage: https://github.com/glebm/order_query
|
@@ -138,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
154
|
version: '0'
|
139
155
|
requirements: []
|
140
156
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.6.
|
157
|
+
rubygems_version: 2.6.13
|
142
158
|
signing_key:
|
143
159
|
specification_version: 4
|
144
160
|
summary: Find next / previous Active Record(s) in one query
|
@@ -146,5 +162,5 @@ test_files:
|
|
146
162
|
- spec/order_query_spec.rb
|
147
163
|
- spec/spec_helper.rb
|
148
164
|
- spec/gemfiles/rails_5_1.gemfile
|
149
|
-
- spec/gemfiles/
|
165
|
+
- spec/gemfiles/rails_5_2.gemfile
|
150
166
|
- spec/gemfiles/rails_5_0.gemfile
|