eitil 1.0.2 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +0 -1
- data/eitil_core/README.md +93 -4
- data/eitil_core/lib/eitil_core.rb +1 -0
- data/eitil_core/lib/eitil_core/application_controller/slice_params.rb +3 -0
- data/eitil_core/lib/eitil_core/application_record/all_associations.rb +3 -0
- data/eitil_core/lib/eitil_core/application_record/find_by_like.rb +3 -0
- data/eitil_core/lib/eitil_core/application_record/where_like.rb +3 -0
- data/eitil_core/lib/eitil_core/argument_helpers.rb +8 -0
- data/eitil_core/lib/eitil_core/argument_helpers/all_args_to_ivars_bang.rb +15 -0
- data/eitil_core/lib/eitil_core/argument_helpers/all_kwargs_to_ivars_bang.rb +15 -0
- data/eitil_core/lib/eitil_core/argument_helpers/args_to_h.rb +15 -0
- data/eitil_core/lib/eitil_core/argument_helpers/args_to_h_bang.rb +17 -0
- data/eitil_core/lib/eitil_core/argument_helpers/args_to_ivars_bang.rb +15 -0
- data/eitil_core/lib/eitil_core/float/safe_to_i.rb +3 -0
- data/eitil_core/lib/eitil_core/lookups.rb +2 -1
- data/eitil_core/lib/eitil_core/lookups/gem_path.rb +10 -0
- data/eitil_core/lib/eitil_core/mocks.rb +6 -0
- data/eitil_core/lib/eitil_core/mocks/array.rb +39 -0
- data/eitil_core/lib/eitil_core/mocks/hash.rb +36 -0
- data/eitil_core/lib/eitil_core/mocks/string.rb +11 -0
- data/eitil_core/lib/eitil_core/railtie.rb +0 -3
- data/eitil_integrate/README.md +11 -0
- data/eitil_integrate/lib/eitil_integrate.rb +4 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter.rb +22 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum.rb +10 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/drop_data.rb +54 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/format_data.rb +27 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/initialize.rb +22 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/present_data.rb +31 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/reduce_data.rb +18 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/sum_data.rb +56 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter/default_export.rb +43 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter/helpers.rb +50 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter/infos.rb +20 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter/initialize.rb +28 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter/lookups.rb +46 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter/selectors.rb +58 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter/setters.rb +27 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter/store_file.rb +34 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter/style_cells.rb +97 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter/validations.rb +28 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter/write_cells.rb +78 -0
- data/eitil_integrate/lib/eitil_integrate/application_exporter/write_messages.rb +18 -0
- data/eitil_integrate/lib/eitil_integrate/railtie.rb +0 -3
- data/eitil_store/lib/eitil_store/railtie.rb +0 -3
- data/eitil_support/lib/eitil_support/directory/lookups.rb +3 -0
- data/eitil_support/lib/eitil_support/railtie.rb +0 -3
- data/eitil_wrapper/README.md +24 -0
- data/eitil_wrapper/lib/eitil_wrapper.rb +2 -1
- data/eitil_wrapper/lib/eitil_wrapper/jobs/single_method_job.rb +3 -0
- data/eitil_wrapper/lib/eitil_wrapper/railtie.rb +24 -7
- data/eitil_wrapper/lib/eitil_wrapper/request_logger.rb +5 -0
- data/eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb +48 -0
- data/eitil_wrapper/lib/eitil_wrapper/request_logger/logger_job.rb +17 -0
- data/eitil_wrapper/lib/eitil_wrapper/scopes/default_scopes.rb +6 -0
- data/lib/eitil.rb +0 -1
- data/lib/eitil/all.rb +5 -5
- data/lib/eitil/railtie.rb +28 -1
- data/lib/eitil/version.rb +1 -1
- metadata +63 -4
- data/lib/eitil/engine.rb +0 -38
- data/lib/tasks/eitil_tasks.rake +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b08b15e6b8d62cb06ba02b964c2996d06a2ab6a0384a3a6767d11aab994284b
|
4
|
+
data.tar.gz: e8bc13ea50e38201fae4272419b04f82c79ad6f2a4e7179055cc88bfcdff006a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff6a6f68bb479e8aa3c0e3ef71aedb34261da883913ca822d199527a605bd5bf0b94d62dff061ac5cfeea62e8e7f5cb9f39244813cdc9ba4af0bdf7b804ee1b4
|
7
|
+
data.tar.gz: 11763dbe1d14866880c06827601a0f4bf0c7bcc7fa460e0d76a7ee40b9819ad04afe7bf0a7c0cce1cbd7fc90a638ec3b4c1d46e301c8a75eb847b0e5157beddb
|
data/Rakefile
CHANGED
data/eitil_core/README.md
CHANGED
@@ -76,11 +76,11 @@ all_args_to_ivars(binding)
|
|
76
76
|
|
77
77
|
|
78
78
|
```ruby
|
79
|
-
# require "eitil_core/argument_helpers/
|
79
|
+
# require "eitil_core/argument_helpers/all_args_to_ivars_bang"
|
80
80
|
|
81
|
-
|
82
|
-
#
|
83
|
-
#
|
81
|
+
all_args_to_ivars!
|
82
|
+
# works the same as .all_args_to_ivars, except that passing the binding is no longer required
|
83
|
+
# production usage is discouraged by the creator of the supporting gem
|
84
84
|
```
|
85
85
|
|
86
86
|
|
@@ -94,6 +94,52 @@ all_kwargs_to_ivars(local_binding, namespace= :kwargs)
|
|
94
94
|
```
|
95
95
|
|
96
96
|
|
97
|
+
```ruby
|
98
|
+
# require "eitil_core/argument_helpers/all_kwargs_to_ivars_bang"
|
99
|
+
|
100
|
+
all_kwargs_to_ivars!(namespace= :kwargs)
|
101
|
+
# works the same as .all_kwargs_to_ivars, except that passing the binding is no longer required
|
102
|
+
# production usage is discouraged by the creator of the supporting gem
|
103
|
+
```
|
104
|
+
|
105
|
+
|
106
|
+
```ruby
|
107
|
+
# require "eitil_core/argument_helpers/args_to_h"
|
108
|
+
|
109
|
+
args_to_h(binding, *local_vars)
|
110
|
+
# creates a hash, with a given local_var as keys and its value as value
|
111
|
+
# call as: args_to_h(binding, :username, :password)
|
112
|
+
# => { username: 'jurriaan', password: 'matz_is_nice' }
|
113
|
+
```
|
114
|
+
|
115
|
+
|
116
|
+
```ruby
|
117
|
+
# require "eitil_core/argument_helpers/args_to_h_bang"
|
118
|
+
|
119
|
+
args_to_h!(*local_vars)
|
120
|
+
# works the same as .args_to_h, except that passing the binding is no longer required
|
121
|
+
# production usage is discouraged by the creator of the supporting gem
|
122
|
+
```
|
123
|
+
|
124
|
+
|
125
|
+
```ruby
|
126
|
+
# require "eitil_core/argument_helpers/args_to_ivars"
|
127
|
+
|
128
|
+
args_to_ivars(binding, *local_vars)
|
129
|
+
# sets specified keywords arguments of the method's local binding to instance variables
|
130
|
+
# call as: all_args_to_ivars binding :user_id, :user_name
|
131
|
+
```
|
132
|
+
|
133
|
+
|
134
|
+
```ruby
|
135
|
+
# require "eitil_core/argument_helpers/args_to_ivars_bang"
|
136
|
+
|
137
|
+
args_to_ivars!(*local_vars)
|
138
|
+
# works the same as .args_to_ivars, except that passing the binding is no longer required
|
139
|
+
# production usage is discouraged by the creator of the supporting gem
|
140
|
+
```
|
141
|
+
|
142
|
+
|
97
143
|
## Concerns
|
98
144
|
|
99
145
|
```ruby
|
@@ -203,6 +249,49 @@ all_methods(include_ancestors = true, grep: nil)
|
|
203
249
|
```
|
204
250
|
|
205
251
|
|
252
|
+
```ruby
|
253
|
+
# require "eitil_core/lookups/gem_path"
|
254
|
+
|
255
|
+
Find.gem_path(gem_name)
|
256
|
+
# finds the root of an installed gem, allowing you to traverse its paths from there.
|
257
|
+
# call as: Find.gem_path("rails")
|
258
|
+
# => "/Users/jurriaanschrofer/.rvm/gems/ruby-2.6.5/gems/rails-5.2.3"
|
259
|
+
```
|
260
|
+
|
261
|
+
|
262
|
+
## Mocks
|
263
|
+
|
264
|
+
```ruby
|
265
|
+
|
266
|
+
require "eitil_core/mocks"
|
267
|
+
|
268
|
+
```
|
269
|
+
|
270
|
+
```ruby
|
271
|
+
# require "eitil_core/mocks/string"
|
272
|
+
|
273
|
+
String.mock(n=25)
|
274
|
+
# String.mock(10) # ==> "oooooo c nnnnnnnnnn ttttttttt p kkk r ppppp rrrrrrr uuu"
|
275
|
+
```
|
276
|
+
|
277
|
+
```ruby
|
278
|
+
# require "eitil_core/mocks/array"
|
279
|
+
|
280
|
+
Array.mock(n=10, type=Integer, &block)
|
281
|
+
# Array.mock # ==> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
282
|
+
# Array.mock(10, Float) #==> [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]
|
283
|
+
# Built-in methods are provided for classes Integer, Float, String, Date, Time
|
284
|
+
# But any other class is accepted as well, also your own classes such as User, Shift and Environment
|
285
|
+
```
|
286
|
+
|
287
|
+
```ruby
|
288
|
+
# require "eitil_core/mocks/hash"
|
289
|
+
|
290
|
+
Hash.mock(n=10)
|
291
|
+
# Hash.mock(10) #==> {"a"=>1, "b"=>2, "c"=>3, "d"=>4, "e"=>5, "f"=>6, "g"=>7, "h"=>8, "i"=>9, "j"=>10}
|
292
|
+
```
|
293
|
+
|
294
|
+
|
206
295
|
## SafeExecutions
|
207
296
|
|
208
297
|
```ruby
|
@@ -1,5 +1,13 @@
|
|
1
1
|
# require "eitil_core/arugment_helpers"
|
2
2
|
|
3
3
|
require "eitil_core/argument_helpers/all_args_to_ivars"
|
4
|
+
require "eitil_core/argument_helpers/all_args_to_ivars_bang"
|
5
|
+
|
4
6
|
require "eitil_core/argument_helpers/args_to_ivars"
|
7
|
+
require "eitil_core/argument_helpers/args_to_ivars_bang"
|
8
|
+
|
9
|
+
require "eitil_core/argument_helpers/args_to_h"
|
10
|
+
require "eitil_core/argument_helpers/args_to_h_bang"
|
11
|
+
|
5
12
|
require "eitil_core/argument_helpers/all_kwargs_to_ivars"
|
13
|
+
require "eitil_core/argument_helpers/all_kwargs_to_ivars_bang"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
# require "eitil_core/argument_helpers/all_args_to_ivars_bang"
|
3
|
+
|
4
|
+
require "eitil_core/lookups/gem_path"
|
5
|
+
require "#{Find.gem_path('binding_of_caller')}/lib/binding_of_caller/mri.rb"
|
6
|
+
|
7
|
+
Kernel.module_eval do
|
8
|
+
|
9
|
+
def all_args_to_ivars!
|
10
|
+
binding.of_caller(1).local_variables.each do |lvar|
|
11
|
+
instance_variable_set("@#{lvar}", binding.of_caller(2).local_variable_get(lvar))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
# require "eitil_core/argument_helpers/all_kwargs_to_ivars_bang"
|
3
|
+
|
4
|
+
require "eitil_core/lookups/gem_path"
|
5
|
+
require "#{Find.gem_path('binding_of_caller')}/lib/binding_of_caller/mri.rb"
|
6
|
+
|
7
|
+
Kernel.module_eval do
|
8
|
+
|
9
|
+
def all_kwargs_to_ivars!(namespace=:kwargs)
|
10
|
+
binding.of_caller(1).local_variable_get(namespace).each do |name, value|
|
11
|
+
instance_variable_set "@#{name}", value
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
# require "eitil_core/argument_helpers/args_to_h"
|
3
|
+
|
4
|
+
Kernel.module_eval do
|
5
|
+
|
6
|
+
def args_to_h(local_binding, *local_vars)
|
7
|
+
|
8
|
+
local_vars.reject { |lvar| lvar == local_binding }
|
9
|
+
.reject { |lvar| lvar.to_s.starts_with?('_') }
|
10
|
+
.map { |lvar| { "#{lvar}": local_binding.local_variable_get(lvar) } }
|
11
|
+
.inject &:merge
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
# require "eitil_core/argument_helpers/args_to_h_bang"
|
3
|
+
|
4
|
+
require "eitil_core/lookups/gem_path"
|
5
|
+
require "#{Find.gem_path('binding_of_caller')}/lib/binding_of_caller/mri.rb"
|
6
|
+
|
7
|
+
Kernel.module_eval do
|
8
|
+
|
9
|
+
def args_to_h!(*local_vars)
|
10
|
+
|
11
|
+
local_vars.reject { |lvar| lvar.to_s.starts_with?('_') }
|
12
|
+
.map { |lvar| { "#{lvar}": binding.of_caller(2).local_variable_get(lvar) } }
|
13
|
+
.inject &:merge
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
# require "eitil_core/argument_helpers/args_to_ivars_bang"
|
3
|
+
|
4
|
+
require "eitil_core/lookups/gem_path"
|
5
|
+
require "#{Find.gem_path('binding_of_caller')}/lib/binding_of_caller/mri.rb"
|
6
|
+
|
7
|
+
Kernel.module_eval do
|
8
|
+
|
9
|
+
def args_to_ivars!(*local_vars)
|
10
|
+
local_vars.each do |lvar|
|
11
|
+
instance_variable_set("@#{lvar}", binding.of_caller(2).local_variable_get(lvar))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
# require "eitil_core/mocks/array"
|
3
|
+
|
4
|
+
class Array
|
5
|
+
|
6
|
+
def self.mock(n=10, type=Integer, &block)
|
7
|
+
|
8
|
+
return Array.new(n,&block) if block_given?
|
9
|
+
|
10
|
+
case type.to_s
|
11
|
+
|
12
|
+
when 'Integer'
|
13
|
+
Array.new(n) {|i| i+1}
|
14
|
+
|
15
|
+
when 'Float'
|
16
|
+
Array.new(n) {|i| i+1.0}
|
17
|
+
|
18
|
+
when 'String'
|
19
|
+
words = String.mock(n).split
|
20
|
+
Array.new(n) {|i| words[i]}
|
21
|
+
|
22
|
+
when 'Time'
|
23
|
+
time_now = Time.now
|
24
|
+
Array.new(n) {|i| time_now + (i * (60 * 60 * 24)) }
|
25
|
+
|
26
|
+
when 'Date'
|
27
|
+
date_now = Date.today
|
28
|
+
Array.new(n) {|i| date_now + (i * 1) }
|
29
|
+
|
30
|
+
else
|
31
|
+
Array.new(n) do
|
32
|
+
type.send(:new) rescue
|
33
|
+
raise NoNewMethodError, 'Please provide Object that responds to `new` call'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
|
2
|
+
# require "eitil_core/mocks/hash"
|
3
|
+
|
4
|
+
class Hash
|
5
|
+
|
6
|
+
def self.mock(n=10)
|
7
|
+
range = mock_size(n).to_a
|
8
|
+
Hash[Array.mock(n) {|m| range[m] }.zip(Array.mock(n))]
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def self.mock_size(n)
|
14
|
+
EitilCore::Mock.hash_range_for(n)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
module EitilCore
|
21
|
+
module Mock
|
22
|
+
|
23
|
+
def self.hash_range_for(n)
|
24
|
+
range = nil
|
25
|
+
i = 0
|
26
|
+
|
27
|
+
until range != nil do
|
28
|
+
range = ('a'..'z') if n <= 26
|
29
|
+
range = ('a'.."z#{'z'*i}") if n < (26 + (26 ** (i+1) )) && !range
|
30
|
+
i += 1
|
31
|
+
end
|
32
|
+
range
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
data/eitil_integrate/README.md
CHANGED
@@ -6,3 +6,14 @@
|
|
6
6
|
EitilIntegrate provides seamless integrations with select gems and API's, through helper methods stored in PORO's.
|
7
7
|
|
8
8
|
|
9
|
+
## EitilIntegrate::RubyXL::ApplicationExporter
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
|
13
|
+
require "eitil_integrate/application_exporter"
|
14
|
+
|
15
|
+
```
|
16
|
+
|
17
|
+
EitilIntegrate::RubyXL::ApplicationExporter provides an extensive wrapper around the RubyXL gem, and can be used by setting it as the superclass of your application's exporter classes.
|
18
|
+
|
19
|
+
Since the functionality is diverse and changing, you can best look at the source code files for the options and methods.
|