eitil 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2249e8b19220f03df98daad2d625c434b46c3eb54982afce5b71098eb2ec7561
4
- data.tar.gz: f651112c073d1263919418904359cbdb03c39f232a216754c78da910b610e7d0
3
+ metadata.gz: b0a89a4609655c28ab6ee41d45b0c74d34b47d31cef1f494b0d942717cdf5371
4
+ data.tar.gz: 905882089b4723ee74710f4877eaecc612ac35c75b9ea954efd9edeb656d8cda
5
5
  SHA512:
6
- metadata.gz: 851e8992abcf099c7cb23e2fed760a37278d606b6d328b4a20d0444b93986a4fef3760ea5cad242d9e6bedc15b7e71620070ec2d80ec6c32b6a44bc253cf789f
7
- data.tar.gz: 1918147e3399a9a3e6fd363fb509bc55880f1dde592ef88cc072e2943ebb7f046db2ac312120cf48823338352a1cbe7bab06cdf5fed751419efba0581ddc5b75
6
+ metadata.gz: 8d395e454f20dffb4d7f4a5b9d77944fdbb4603013e5c562ad09d4768642a5df4b98fe8b2e6a10510535b0428aa6f506edab944a787954a8847cac27480df4da
7
+ data.tar.gz: c117f0a635d79282a6b7d54dd72a71de77d054c209f25b3c4cd76aae7469320af507c1f35f25b6770041b7b3fbfe3198b9c193c2bec8ed51acf6115a4f75ddcf
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
@@ -1,2 +1,3 @@
1
1
 
2
- require "eitil_core/kernel/always_require_relative"
2
+ require "eitil_core/kernel/loadquire"
3
+ require "eitil_core/kernel/loadquire_bang"
data/lib/eitil/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Eitil
2
2
 
3
- VERSION = '1.3.4'
3
+ VERSION = '1.3.5'
4
4
 
5
5
  end
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
4
+ version: 1.3.5
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-09-17 00:00:00.000000000 Z
11
+ date: 2021-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -208,6 +208,8 @@ files:
208
208
  - eitil_core/lib/eitil_core/hash/transform_string_values.rb
209
209
  - eitil_core/lib/eitil_core/kernel.rb
210
210
  - eitil_core/lib/eitil_core/kernel/always_require_relative.rb
211
+ - eitil_core/lib/eitil_core/kernel/loadquire.rb
212
+ - eitil_core/lib/eitil_core/kernel/loadquire_bang.rb
211
213
  - eitil_core/lib/eitil_core/lookups.rb
212
214
  - eitil_core/lib/eitil_core/lookups/all_methods.rb
213
215
  - eitil_core/lib/eitil_core/lookups/gem_path.rb