eitil 1.3.4 → 1.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/eitil_core/README.md +29 -0
- data/eitil_core/lib/eitil_core/kernel/loadquire.rb +25 -0
- data/eitil_core/lib/eitil_core/kernel/loadquire_bang.rb +26 -0
- data/eitil_core/lib/eitil_core/kernel.rb +2 -1
- data/eitil_wrapper/README.md +81 -8
- data/eitil_wrapper/lib/eitil_wrapper/railtie.rb +9 -2
- data/eitil_wrapper/lib/eitil_wrapper/records/default_calculators.rb +101 -0
- data/eitil_wrapper/lib/eitil_wrapper/{scopes → records}/default_scopes.rb +5 -10
- data/eitil_wrapper/lib/eitil_wrapper/records/default_sorts.rb +81 -0
- data/eitil_wrapper/lib/eitil_wrapper/records.rb +4 -0
- data/eitil_wrapper/lib/eitil_wrapper.rb +1 -1
- data/lib/eitil/railtie.rb +6 -2
- data/lib/eitil/version.rb +1 -1
- metadata +9 -6
- data/eitil_core/lib/eitil_core/kernel/always_require_relative.rb +0 -21
- data/eitil_wrapper/lib/eitil_wrapper/scopes.rb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62c186ffdd14894a3ed5ce9d6a635030821ab1bdc86aa5ad7f35c7d1a3592dca
|
4
|
+
data.tar.gz: b53791e40cd28e1f6435e9cbc2888c57e26ca6f5d05b3cb3518f7285a6311618
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 869d88f962e7a688b203d0f5e89132ce5f343975d6ce1a0c926691454027c5935073086766c5d0febb28be0108ca8a183f106cfb32b8314f50046dbffd6d68c7
|
7
|
+
data.tar.gz: 3ebe01d21f32cc00c3e9c84b9937b71d9e1aa46590f5b0384c18d28e0a1d6706a161cab34c58bdb2a0b59c2a8883dcf1371bcd928f645b8c6fadcdd6057143c4
|
data/eitil_core/README.md
CHANGED
@@ -385,6 +385,35 @@ transform_string_values!(&block)
|
|
385
385
|
# bang variant of .transform_string_values, which recursively modifies all objects it is called on.
|
386
386
|
```
|
387
387
|
|
388
|
+
|
389
|
+
## Kernel
|
390
|
+
|
391
|
+
```ruby
|
392
|
+
|
393
|
+
require "eitil_core/kernel"
|
394
|
+
|
395
|
+
```
|
396
|
+
|
397
|
+
```ruby
|
398
|
+
# require "eitil_core/kernel/loadquire"
|
399
|
+
|
400
|
+
loadquire(current_path, *relative_paths, ext: '.rb')
|
401
|
+
# use .loadquire to pickup code changes on reload in development environment, while not creating overhead in production through 'load' usage
|
402
|
+
# call as: loadquire __dir__, 'user'
|
403
|
+
# => loads '../user.rb' in development environment, requires '../user.rb' in all other environments
|
404
|
+
```
|
405
|
+
|
406
|
+
```ruby
|
407
|
+
# require "eitil_core/kernel/loadquire_bang"
|
408
|
+
|
409
|
+
loadquire!(*relative_paths, ext: '.rb')
|
410
|
+
# use .loadquire! to pickup code changes on reload in development environment, while not creating overhead in production through 'load' usage
|
411
|
+
# call as: loadquire! 'user'
|
412
|
+
# => loads '../user.rb' in development environment, requires '../user.rb' in all other environments
|
413
|
+
|
414
|
+
```
|
415
|
+
|
416
|
+
|
388
417
|
## Lookups
|
389
418
|
|
390
419
|
```ruby
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
# require "eitil_core/kernel/loadquire"
|
3
|
+
|
4
|
+
Kernel.module_eval do
|
5
|
+
|
6
|
+
def loadquire(current_path, *relative_paths, ext: '.rb')
|
7
|
+
|
8
|
+
file_paths = relative_paths.map do |relative_path|
|
9
|
+
File.expand_path(relative_path, current_path).concat(ext)
|
10
|
+
end
|
11
|
+
|
12
|
+
if Object.const_defined?('Rails') && Rails.env.development?
|
13
|
+
file_paths.each do |path|
|
14
|
+
load(path)
|
15
|
+
end
|
16
|
+
|
17
|
+
else
|
18
|
+
file_paths.each do |path|
|
19
|
+
require(path)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
# require "eitil_core/kernel/loadquire_bang"
|
3
|
+
|
4
|
+
Kernel.module_eval do
|
5
|
+
|
6
|
+
def loadquire!(*relative_paths, ext: '.rb')
|
7
|
+
|
8
|
+
current_path = caller.first.split('/')[0..-2].join('/')
|
9
|
+
file_paths = relative_paths.map do |relative_path|
|
10
|
+
File.expand_path(relative_path, current_path).concat(ext)
|
11
|
+
end
|
12
|
+
|
13
|
+
if Object.const_defined?('Rails') && Rails.env.development?
|
14
|
+
file_paths.each do |path|
|
15
|
+
load(path)
|
16
|
+
end
|
17
|
+
|
18
|
+
else
|
19
|
+
file_paths.each do |path|
|
20
|
+
require(path)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/eitil_wrapper/README.md
CHANGED
@@ -150,11 +150,20 @@ extended_resources(controller, **kwargs)
|
|
150
150
|
|
151
151
|
|
152
152
|
|
153
|
-
## EitilWrapper::
|
153
|
+
## EitilWrapper::Records
|
154
154
|
|
155
155
|
```ruby
|
156
156
|
|
157
|
-
|
157
|
+
# include all below EitilWrapper::Records helpers through:
|
158
|
+
require "eitil_wrapper/records"
|
159
|
+
|
160
|
+
```
|
161
|
+
|
162
|
+
### Scopes
|
163
|
+
|
164
|
+
```ruby
|
165
|
+
|
166
|
+
require "eitil_wrapper/records/scopes"
|
158
167
|
|
159
168
|
```
|
160
169
|
|
@@ -175,8 +184,6 @@ Scopes are generated through the columns of your model's database table. Which s
|
|
175
184
|
.{column_name}_before_date(date)
|
176
185
|
.{column_name}_after_date(date)
|
177
186
|
.{column_name}_between_dates(start_date, end_date)
|
178
|
-
.{column_name}_oldest_first
|
179
|
-
.{column_name}_newest_first
|
180
187
|
|
181
188
|
# columns of datatype: date
|
182
189
|
.{column_name}_today
|
@@ -186,27 +193,93 @@ Scopes are generated through the columns of your model's database table. Which s
|
|
186
193
|
.{column_name}_before_date(date)
|
187
194
|
.{column_name}_after_date(date)
|
188
195
|
.{column_name}_between_dates(start_date, end_date)
|
189
|
-
.{column_name}_oldest_first
|
190
|
-
.{column_name}_newest_first
|
191
196
|
|
192
197
|
# columns of datatype: integer
|
193
198
|
.{column_name}_equal_to(number)
|
194
199
|
.{column_name}_lower_than(number)
|
195
200
|
.{column_name}_higher_than(number)
|
196
201
|
.{column_name}_between(min, max)
|
197
|
-
.{column_name}_ascending
|
198
|
-
.{column_name}_descending
|
199
202
|
|
200
203
|
# columns of datatype: float
|
201
204
|
.{column_name}_equal_to(number)
|
202
205
|
.{column_name}_lower_than(number)
|
203
206
|
.{column_name}_higher_than(number)
|
204
207
|
.{column_name}_between(min, max)
|
208
|
+
```
|
209
|
+
|
210
|
+
### Sorts
|
211
|
+
|
212
|
+
|
213
|
+
```ruby
|
214
|
+
|
215
|
+
require "eitil_wrapper/records/sorts"
|
216
|
+
|
217
|
+
```
|
218
|
+
|
219
|
+
Sorts are generated through the columns of your model's database table. Which sorts are generated depends on the datatype of a column. A sort method is defined only if it does not already responds to another method of the same name. The sorts generated are:
|
220
|
+
|
221
|
+
```ruby
|
222
|
+
# require "eitil_wrapper/scopes/default_scopes"
|
223
|
+
|
224
|
+
# columns of datatype: datetime
|
225
|
+
.{column_name}_oldest_first
|
226
|
+
.{column_name}_newest_first
|
227
|
+
|
228
|
+
# columns of datatype: date
|
229
|
+
.{column_name}_oldest_first
|
230
|
+
.{column_name}_newest_first
|
231
|
+
|
232
|
+
# columns of datatype: integer
|
233
|
+
.{column_name}_ascending
|
234
|
+
.{column_name}_descending
|
235
|
+
|
236
|
+
# columns of datatype: float
|
205
237
|
.{column_name}_ascending
|
206
238
|
.{column_name}_descending
|
207
239
|
```
|
208
240
|
|
209
241
|
|
242
|
+
### Calculators
|
243
|
+
|
244
|
+
|
245
|
+
```ruby
|
246
|
+
|
247
|
+
require "eitil_wrapper/records/calculators"
|
248
|
+
|
249
|
+
```
|
250
|
+
|
251
|
+
Calculators are generated through the columns of your model's database table. Which calculators are generated depends on the datatype of a column. A calculator method is defined only if it does not already responds to another method of the same name. The calculators generated are:
|
252
|
+
|
253
|
+
```ruby
|
254
|
+
# require "eitil_wrapper/scopes/default_scopes"
|
255
|
+
|
256
|
+
# columns of datatype: array (serialized)
|
257
|
+
.{column_name}_sum # returns all uniq elements in a new, single array
|
258
|
+
|
259
|
+
# columns of datatype: integer
|
260
|
+
.{column_name}_max
|
261
|
+
.{column_name}_min
|
262
|
+
.{column_name}_sum
|
263
|
+
.{column_name}_avg
|
264
|
+
|
265
|
+
# columns of datatype: float
|
266
|
+
.{column_name}_max
|
267
|
+
.{column_name}_min
|
268
|
+
.{column_name}_sum
|
269
|
+
.{column_name}_avg
|
270
|
+
|
271
|
+
# columns of datatype: decimal
|
272
|
+
.{column_name}_max
|
273
|
+
.{column_name}_min
|
274
|
+
.{column_name}_sum
|
275
|
+
.{column_name}_avg
|
276
|
+
|
277
|
+
# columns of datatype: bigint
|
278
|
+
.{column_name}_max
|
279
|
+
.{column_name}_min
|
280
|
+
.{column_name}_sum
|
281
|
+
.{column_name}_avg
|
282
|
+
```
|
210
283
|
|
211
284
|
|
212
285
|
|
@@ -7,9 +7,16 @@ module EitilWrapper
|
|
7
7
|
|
8
8
|
initializer "my_railtie.configure_rails_initialization", options: :after do |app|
|
9
9
|
|
10
|
+
if Object.const_defined?('EitilWrapper::Records::DefaultCalculators')
|
11
|
+
::ApplicationRecord.send(:extend, EitilWrapper::Records::DefaultCalculators)
|
12
|
+
end
|
13
|
+
|
14
|
+
if Object.const_defined?('EitilWrapper::Records::DefaultScopes')
|
15
|
+
::ApplicationRecord.send(:extend, EitilWrapper::Records::DefaultScopes)
|
16
|
+
end
|
10
17
|
|
11
|
-
if Object.const_defined?('EitilWrapper::
|
12
|
-
::ApplicationRecord.send(:extend, EitilWrapper::
|
18
|
+
if Object.const_defined?('EitilWrapper::Records::DefaultSorts')
|
19
|
+
::ApplicationRecord.send(:extend, EitilWrapper::Records::DefaultSorts)
|
13
20
|
end
|
14
21
|
|
15
22
|
if Object.const_defined?('EitilWrapper::Callbacks::HelperMethods')
|
@@ -0,0 +1,101 @@
|
|
1
|
+
|
2
|
+
# require "eitil_wrapper/records/default_calculators"
|
3
|
+
|
4
|
+
# require "eitil_wrapper/railtie" to run the dynamic dispatch as an init hook during boot
|
5
|
+
require "eitil_wrapper/railtie"
|
6
|
+
|
7
|
+
module EitilWrapper
|
8
|
+
module Records
|
9
|
+
module DefaultCalculators
|
10
|
+
|
11
|
+
Eitil::ApplicationRecordModules << self
|
12
|
+
|
13
|
+
SharableNumberCalculators = -> (_class, column) {
|
14
|
+
_class.eitil_calculator :"#{column}_max", -> { _class.maximum(column) }
|
15
|
+
_class.eitil_calculator :"#{column}_min", -> { _class.minimum(column) }
|
16
|
+
_class.eitil_calculator :"#{column}_sum", -> { _class.sum(column) }
|
17
|
+
_class.eitil_calculator :"#{column}_avg", -> { _class.average(column) }
|
18
|
+
}
|
19
|
+
|
20
|
+
SharableIterableCalculators = -> (_class, column) {
|
21
|
+
_class.eitil_calculator :"#{column}_sum", -> { _class.pluck(column).flatten!.uniq! }
|
22
|
+
}
|
23
|
+
|
24
|
+
def inherited(subclass)
|
25
|
+
super
|
26
|
+
return if Eitil.skip_default_calculators_for_models.include?(subclass.to_s.to_sym)
|
27
|
+
|
28
|
+
# Set the proper table_names for namespaced models. Without setting this,
|
29
|
+
# Rails run into problems due to the fact that the first call to the model's
|
30
|
+
# constant triggers this initializer first, and only thereafter the model file
|
31
|
+
# which sets the correct table_name through a macro.
|
32
|
+
|
33
|
+
namespaced_class = subclass.to_s.include?('::')
|
34
|
+
subclass.table_name = subclass.to_s.gsub('::', '_').downcase.pluralize if namespaced_class
|
35
|
+
|
36
|
+
subclass.use_eitil_calculators
|
37
|
+
|
38
|
+
rescue => e
|
39
|
+
puts "default calculators failed for class '#{subclass}' with expected table '#{subclass.table_name}' because of #{e.class} and '#{e.to_s.split(' ').first}'"
|
40
|
+
end
|
41
|
+
|
42
|
+
def use_eitil_calculators
|
43
|
+
return if abstract_class?
|
44
|
+
|
45
|
+
# text[] is postgresql's datatype for serialized arrays
|
46
|
+
# numeric is postgresql's datatype for decimals
|
47
|
+
# double precision is postgresql's datatype for floats
|
48
|
+
|
49
|
+
|
50
|
+
%w[integer bigint double\ precision numeric].each do |_type|
|
51
|
+
send :"create_eitil_#{_type.gsub(' ','_')}_calculators"
|
52
|
+
end
|
53
|
+
|
54
|
+
create_array_calculators
|
55
|
+
end
|
56
|
+
|
57
|
+
def eitil_calculator(_name, _proc)
|
58
|
+
# skip calculator methods for primary and foreign key columns
|
59
|
+
return if _name.to_s =~ /^id_[a-z]{1,}$/ || _name.to_s =~ /_id_[a-z]{1,}$/
|
60
|
+
|
61
|
+
define_singleton_method(_name) { _proc.call } unless respond_to? _name
|
62
|
+
end
|
63
|
+
|
64
|
+
def calculator_columns_of_type(data_type)
|
65
|
+
columns_hash.select { |column,v| v.sql_type == data_type }
|
66
|
+
end
|
67
|
+
|
68
|
+
def create_eitil_integer_calculators
|
69
|
+
calculator_columns_of_type("integer")&.map do |column, object|
|
70
|
+
SharableNumberCalculators.call self, column
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def create_eitil_bigint_calculators
|
75
|
+
calculator_columns_of_type("bigint")&.map do |column, object|
|
76
|
+
SharableNumberCalculators.call self, column
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def create_eitil_double_precision_calculators
|
81
|
+
calculator_columns_of_type("double\ precision")&.map do |column, object|
|
82
|
+
SharableNumberCalculators.call self, column
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def create_eitil_numeric_calculators
|
87
|
+
calculator_columns_of_type("numeric")&.map do |column, object|
|
88
|
+
SharableNumberCalculators.call self, column
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def create_array_calculators
|
93
|
+
columns = columns_hash.select { |column,v| v.sql_type == "text" && v.default == "{}" }
|
94
|
+
columns&.map do |column, object|
|
95
|
+
SharableIterableCalculators.call self, column
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
|
2
|
-
# require "eitil_wrapper/
|
2
|
+
# require "eitil_wrapper/records/default_scopes"
|
3
3
|
|
4
4
|
# require "eitil_wrapper/railtie" to run the dynamic dispatch as an init hook during boot
|
5
5
|
require "eitil_wrapper/railtie"
|
6
6
|
|
7
7
|
module EitilWrapper
|
8
|
-
module
|
8
|
+
module Records
|
9
9
|
module DefaultScopes
|
10
10
|
|
11
11
|
Eitil::ApplicationRecordModules << self
|
@@ -19,9 +19,6 @@ module EitilWrapper
|
|
19
19
|
_class.eitil_scope :"#{column}_before_date", -> (date) { where("#{column} = ?", date) }
|
20
20
|
_class.eitil_scope :"#{column}_after_date", -> (date) { where("#{column} = ?", date) }
|
21
21
|
_class.eitil_scope :"#{column}_between_dates", -> (from, till) { where("#{column} >= ? and #{column} <= ?", from, till) }
|
22
|
-
|
23
|
-
_class.eitil_scope :"#{column}_oldest_first", -> { order("#{column} ASC") }
|
24
|
-
_class.eitil_scope :"#{column}_newest_first", -> { order("#{column} DESC") }
|
25
22
|
}
|
26
23
|
|
27
24
|
SharableNumScopes = -> (_class, column) {
|
@@ -29,9 +26,6 @@ module EitilWrapper
|
|
29
26
|
_class.eitil_scope :"#{column}_lower_than", -> (number) { where("#{column} = <", number) }
|
30
27
|
_class.eitil_scope :"#{column}_higher_than", -> (number) { where("#{column} = >", number) }
|
31
28
|
_class.eitil_scope :"#{column}_between", -> (min, max) { where("#{column} >= ? and #{column} <= ?", min, max) }
|
32
|
-
|
33
|
-
_class.eitil_scope :"#{column}_ascending", -> { order("#{column} ASC") }
|
34
|
-
_class.eitil_scope :"#{column}_descending", -> { order("#{column} DESC") }
|
35
29
|
}
|
36
30
|
|
37
31
|
def inherited(subclass)
|
@@ -42,13 +36,14 @@ module EitilWrapper
|
|
42
36
|
# Rails run into problems due to the fact that the first call to the model's
|
43
37
|
# constant triggers this initializer first, and only thereafter the model file
|
44
38
|
# which sets the correct table_name through a macro.
|
39
|
+
|
45
40
|
namespaced_class = subclass.to_s.include?('::')
|
46
41
|
subclass.table_name = subclass.to_s.gsub('::', '_').downcase.pluralize if namespaced_class
|
47
42
|
|
48
43
|
subclass.use_eitil_scopes
|
49
44
|
|
50
45
|
rescue => e
|
51
|
-
puts "default scopes failed for #{subclass} because of #{e.class} and '#{e.to_s.split(' ').first}'"
|
46
|
+
puts "default scopes failed for class '#{subclass}' with expected table '#{subclass.table_name}' because of #{e.class} and '#{e.to_s.split(' ').first}'"
|
52
47
|
end
|
53
48
|
|
54
49
|
def use_eitil_scopes
|
@@ -97,4 +92,4 @@ module EitilWrapper
|
|
97
92
|
|
98
93
|
end
|
99
94
|
end
|
100
|
-
end
|
95
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
|
2
|
+
# require "eitil_wrapper/records/default_sorts"
|
3
|
+
|
4
|
+
# require "eitil_wrapper/railtie" to run the dynamic dispatch as an init hook during boot
|
5
|
+
require "eitil_wrapper/railtie"
|
6
|
+
|
7
|
+
|
8
|
+
module EitilWrapper
|
9
|
+
module Records
|
10
|
+
module DefaultSorts
|
11
|
+
|
12
|
+
Eitil::ApplicationRecordModules << self
|
13
|
+
|
14
|
+
SharableDateSorts = -> (_class, column) {
|
15
|
+
_class.eitil_sort :"#{column}_oldest_first", -> { _class.order("#{column} ASC") }
|
16
|
+
_class.eitil_sort :"#{column}_newest_first", -> { _class.order("#{column} DESC") }
|
17
|
+
}
|
18
|
+
|
19
|
+
SharableNumSorts = -> (_class, column) {
|
20
|
+
_class.eitil_sort :"#{column}_ascending", -> { _class.order("#{column} ASC") }
|
21
|
+
_class.eitil_sort :"#{column}_descending", -> { _class.order("#{column} DESC") }
|
22
|
+
}
|
23
|
+
|
24
|
+
def inherited(subclass)
|
25
|
+
super
|
26
|
+
return if Eitil.skip_default_sorts_for_models.include?(subclass.to_s.to_sym)
|
27
|
+
|
28
|
+
# Set the proper table_names for namespaced models. Without setting this,
|
29
|
+
# Rails run into problems due to the fact that the first call to the model's
|
30
|
+
# constant triggers this initializer first, and only thereafter the model file
|
31
|
+
# which sets the correct table_name through a macro.
|
32
|
+
|
33
|
+
namespaced_class = subclass.to_s.include?('::')
|
34
|
+
subclass.table_name = subclass.to_s.gsub('::', '_').downcase.pluralize if namespaced_class
|
35
|
+
|
36
|
+
subclass.use_eitil_sorts
|
37
|
+
|
38
|
+
rescue => e
|
39
|
+
puts "default sorts failed for class '#{subclass}' with expected table '#{subclass.table_name}' because of #{e.class} and '#{e.to_s.split(' ').first}'"
|
40
|
+
end
|
41
|
+
|
42
|
+
def use_eitil_sorts
|
43
|
+
return if abstract_class?
|
44
|
+
%i[datetime date integer float].each { |_type| send :"create_eitil_#{_type}_sorts" }
|
45
|
+
end
|
46
|
+
|
47
|
+
def eitil_sort(_name, _proc)
|
48
|
+
define_singleton_method(_name) { _proc.call } unless respond_to? _name
|
49
|
+
end
|
50
|
+
|
51
|
+
def sort_columns_of_type(data_type)
|
52
|
+
columns_hash.select { |column,v| v.sql_type_metadata.type == data_type }
|
53
|
+
end
|
54
|
+
|
55
|
+
def create_eitil_datetime_sorts
|
56
|
+
columns_of_type(:datetime)&.map do |column, object|
|
57
|
+
SharableDateSorts.call self, column
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def create_eitil_date_sorts
|
62
|
+
columns_of_type(:date)&.map do |column, object|
|
63
|
+
SharableDateSorts.call self, column
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def create_eitil_integer_sorts
|
68
|
+
columns_of_type(:integer)&.map do |column, object|
|
69
|
+
SharableNumSorts.call self, column
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def create_eitil_float_sorts
|
74
|
+
columns_of_type(:float)&.map do |column, object|
|
75
|
+
SharableNumSorts.call self, column
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
data/lib/eitil/railtie.rb
CHANGED
@@ -31,10 +31,14 @@ module Eitil
|
|
31
31
|
|
32
32
|
Eitil.mattr_accessor :controller_ivars,
|
33
33
|
:skip_default_scopes_for_models,
|
34
|
+
:skip_default_calculators_for_models,
|
35
|
+
:skip_default_sorts_for_models,
|
34
36
|
:skip_callback_helper_methods_for_models
|
35
37
|
|
36
|
-
Eitil.controller_ivars
|
37
|
-
Eitil.skip_default_scopes_for_models
|
38
|
+
Eitil.controller_ivars ||= []
|
39
|
+
Eitil.skip_default_scopes_for_models ||= []
|
40
|
+
Eitil.skip_default_calculators_for_models ||= []
|
41
|
+
Eitil.skip_default_sorts_for_models ||= []
|
38
42
|
Eitil.skip_callback_helper_methods_for_models ||= []
|
39
43
|
|
40
44
|
def Eitil.set_config(&block)
|
data/lib/eitil/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eitil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jurriaan Schrofer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -207,7 +207,8 @@ files:
|
|
207
207
|
- eitil_core/lib/eitil_core/hash/auto_dig.rb
|
208
208
|
- eitil_core/lib/eitil_core/hash/transform_string_values.rb
|
209
209
|
- eitil_core/lib/eitil_core/kernel.rb
|
210
|
-
- eitil_core/lib/eitil_core/kernel/
|
210
|
+
- eitil_core/lib/eitil_core/kernel/loadquire.rb
|
211
|
+
- eitil_core/lib/eitil_core/kernel/loadquire_bang.rb
|
211
212
|
- eitil_core/lib/eitil_core/lookups.rb
|
212
213
|
- eitil_core/lib/eitil_core/lookups/all_methods.rb
|
213
214
|
- eitil_core/lib/eitil_core/lookups/gem_path.rb
|
@@ -282,13 +283,15 @@ files:
|
|
282
283
|
- eitil_wrapper/lib/eitil_wrapper/jobs/new_job_now.rb
|
283
284
|
- eitil_wrapper/lib/eitil_wrapper/jobs/single_method_job.rb
|
284
285
|
- eitil_wrapper/lib/eitil_wrapper/railtie.rb
|
286
|
+
- eitil_wrapper/lib/eitil_wrapper/records.rb
|
287
|
+
- eitil_wrapper/lib/eitil_wrapper/records/default_calculators.rb
|
288
|
+
- eitil_wrapper/lib/eitil_wrapper/records/default_scopes.rb
|
289
|
+
- eitil_wrapper/lib/eitil_wrapper/records/default_sorts.rb
|
285
290
|
- eitil_wrapper/lib/eitil_wrapper/request_logger.rb
|
286
291
|
- eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb
|
287
292
|
- eitil_wrapper/lib/eitil_wrapper/request_logger/logger_job.rb
|
288
293
|
- eitil_wrapper/lib/eitil_wrapper/routes.rb
|
289
294
|
- eitil_wrapper/lib/eitil_wrapper/routes/extended_resources.rb
|
290
|
-
- eitil_wrapper/lib/eitil_wrapper/scopes.rb
|
291
|
-
- eitil_wrapper/lib/eitil_wrapper/scopes/default_scopes.rb
|
292
295
|
- lib/eitil.rb
|
293
296
|
- lib/eitil/all.rb
|
294
297
|
- lib/eitil/railtie.rb
|
@@ -468,7 +471,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
468
471
|
- !ruby/object:Gem::Version
|
469
472
|
version: '0'
|
470
473
|
requirements: []
|
471
|
-
rubygems_version: 3.
|
474
|
+
rubygems_version: 3.0.9
|
472
475
|
signing_key:
|
473
476
|
specification_version: 4
|
474
477
|
summary: Eitil (eitje utility) never stops increasing your life's efficacy and productivity,
|
@@ -1,21 +0,0 @@
|
|
1
|
-
|
2
|
-
# require "eitil_core/kernel/always_require_relative"
|
3
|
-
|
4
|
-
Kernel.module_eval do
|
5
|
-
|
6
|
-
def always_require_relative(current_path, relative_path, extension = '.rb')
|
7
|
-
|
8
|
-
unless Object.const_defined?('Rails')
|
9
|
-
return require_relative(path)
|
10
|
-
end
|
11
|
-
|
12
|
-
absolute_path = File.expand_path(relative_path, current_path).concat(extension)
|
13
|
-
|
14
|
-
if Rails.env.development?
|
15
|
-
load(absolute_path)
|
16
|
-
else
|
17
|
-
require(absolute_path)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|