wallaby-core 0.2.10 → 0.2.11

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: 42ce40b2375306ae5636cd6cf0416b0f1bc61a07efca25cd2dcf9cbe389a75af
4
- data.tar.gz: 66cc05ec1bc0d6f927f9e1ffe3b39df70cd4e2d8ebfd752c07b0c96813a4ee16
3
+ metadata.gz: 0f1ac3bd8eff66540e6b9f6c6c7b1f569bffe58177134b70fde36bd5b9e3df82
4
+ data.tar.gz: ec78aac3194fe1dd051160d9f77695247213565260b1035d1aebd7acd84ea1a6
5
5
  SHA512:
6
- metadata.gz: 83b55f8572a2d4d95d7d8c62ee1e11e3260d36935ddfc5712f0cf0e760fbb238b43b05cb38d892322a41842296c53b656146cd32870d54e356072adf3b974dd4
7
- data.tar.gz: 71843ecf06cc964c4bd40639e158d3e9442dfec35f366c5ef05f31ba10bcf9842e89e3211f2e75283250411916a9d1bc69e4e6c3f0234a4f03706f611befd9a5
6
+ metadata.gz: d5b70441c58655aa2bd9aa49175f137e8680a78619c9a5236e560a912dc86995dba8597a60f54ad90ac3a80a074a4ddb8bfca346c8a73fa772edae8e63aa2fc9
7
+ data.tar.gz: 459f70f2d01dba201f7873b5a7fa61c33ea3cf8ff8824ea7d33f450878ddbb01242bf71887a3200229cfe44b3c0c70190e76ea165872fe43238e424ed5a0254e
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Wallaby
4
4
  module Core
5
- VERSION = '0.2.10' # :nodoc:
5
+ VERSION = '0.2.11' # :nodoc:
6
6
  end
7
7
  end
@@ -5,27 +5,27 @@ module Wallaby
5
5
  class Engine < ::Rails::Engine
6
6
  initializer 'wallaby.development.reload' do |_|
7
7
  # NOTE: Rails reload! will hit here
8
- # @see http://rmosolgo.github.io/blog/2017/04/12/watching-files-during-rails-development/
8
+ # @see https://rmosolgo.github.io/ruby/rails/2017/04/12/watching-files-during-rails-development.html
9
9
  config.to_prepare do
10
- if Rails.env.development? || Rails.configuration.eager_load
11
- Map.clear
12
- Preloader.pending!
13
- end
10
+ Map.clear
11
+ Preloader.clear
14
12
  end
15
13
  end
16
14
 
17
15
  config.before_eager_load do
18
- # NOTE: The models must be loaded before everything else
19
- Logger.debug 'Preload all `app/models` files.', sourcing: false
16
+ Logger.debug 'Preload all model files before everything else.', sourcing: false
20
17
  Preloader.require_models
21
18
  end
22
19
 
23
20
  config.after_initialize do
24
- # Load the rest files
25
- unless Rails.env.development? || Rails.configuration.eager_load
26
- Logger.debug 'Preload all other eager load files after initialize.', sourcing: false
27
- Preloader.require_all
28
- end
21
+ # Preload will be postponed to Map when `cache_classes` is set to false
22
+ next unless Rails.configuration.cache_classes
23
+ # Models are preloaded in `before_eager_load` block,
24
+ # therefore, it's not essential to preload all files Since Rails will do it
25
+ next if Rails.configuration.eager_load
26
+
27
+ Logger.debug 'Preload all files in model first and non-model last order', sourcing: false
28
+ Preloader.require_all
29
29
  end
30
30
  end
31
31
  end
@@ -12,17 +12,16 @@ module Wallaby
12
12
  include ActiveModel::Model
13
13
 
14
14
  class << self
15
- # @return [true] mark this as pending
16
- def pending!
17
- @pending = true
15
+ def clear
16
+ @all_required = nil
18
17
  end
19
18
 
20
19
  # Require all files
21
20
  # @see #all_file_paths
22
21
  def require_all
23
- return unless @pending
22
+ return if @all_required
24
23
 
25
- @pending = nil
24
+ @all_required = true
26
25
  Logger.debug 'Loading all files', sourcing: false
27
26
  new.all_file_paths.each(&method(:require_dependency))
28
27
  end
@@ -36,7 +35,7 @@ module Wallaby
36
35
 
37
36
  # @return [Array<String>] all files under **Rails.configuration.eager_load_paths**
38
37
  def all_file_paths
39
- sort all_eager_load_file_paths
38
+ sort(all_eager_load_file_paths)
40
39
  end
41
40
 
42
41
  # @return [Array<String>] model files under {Wallaby::Configuration#model_paths}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wallaby-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tian Chen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-03 00:00:00.000000000 Z
11
+ date: 2024-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel