wallaby-core 0.2.9 → 0.2.10

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: 8a4c5c82124d25468728fff204eb9676d05100615edd67d86839d7008f258b42
4
- data.tar.gz: fe635d3585a5ec4d5205d90147d5377cc4a3e52459790b75a91e842fa41cce62
3
+ metadata.gz: 42ce40b2375306ae5636cd6cf0416b0f1bc61a07efca25cd2dcf9cbe389a75af
4
+ data.tar.gz: 66cc05ec1bc0d6f927f9e1ffe3b39df70cd4e2d8ebfd752c07b0c96813a4ee16
5
5
  SHA512:
6
- metadata.gz: 5fbf645d202fea16af664376a78177b9bf4bf6e6a1243e31be82f833d3cbb4dc5c5504208f583c596029bd1f7cb4a826417d8fe044725fa31df999868e3636b3
7
- data.tar.gz: f0e750484101ed6bad77a22b531a4dcf4c5a89a6379bc92078e4a63a20bd381c664c0b6a66f97f4f312eebd858ada6e49fe95739012fd2092bfa7cefc9cc2ac8
6
+ metadata.gz: 83b55f8572a2d4d95d7d8c62ee1e11e3260d36935ddfc5712f0cf0e760fbb238b43b05cb38d892322a41842296c53b656146cd32870d54e356072adf3b974dd4
7
+ data.tar.gz: 71843ecf06cc964c4bd40639e158d3e9442dfec35f366c5ef05f31ba10bcf9842e89e3211f2e75283250411916a9d1bc69e4e6c3f0234a4f03706f611befd9a5
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Wallaby
4
4
  module Core
5
- VERSION = '0.2.9' # :nodoc:
5
+ VERSION = '0.2.10' # :nodoc:
6
6
  end
7
7
  end
@@ -8,9 +8,8 @@ module Wallaby
8
8
  # @see http://rmosolgo.github.io/blog/2017/04/12/watching-files-during-rails-development/
9
9
  config.to_prepare do
10
10
  if Rails.env.development? || Rails.configuration.eager_load
11
- Logger.debug 'Reloading after Rails\' reload...', sourcing: false
12
11
  Map.clear
13
- Preloader.require_all
12
+ Preloader.pending!
14
13
  end
15
14
  end
16
15
  end
data/lib/wallaby/map.rb CHANGED
@@ -17,7 +17,11 @@ module Wallaby
17
17
 
18
18
  # @return [Wallaby::ClassHash] { Model Class => {Wallaby::Mode} }
19
19
  def mode_map
20
- @mode_map ||= ModeMapper.execute(modes).freeze
20
+ @mode_map ||= begin
21
+ # NOTE: this is the point where all files should be required
22
+ Preloader.require_all
23
+ ModeMapper.execute(modes).freeze
24
+ end
21
25
  end
22
26
 
23
27
  # TODO: remove this method
@@ -11,16 +11,27 @@ module Wallaby
11
11
  class Preloader
12
12
  include ActiveModel::Model
13
13
 
14
- # Require all files
15
- # @see #all_file_paths
16
- def self.require_all
17
- new.all_file_paths.each(&method(:require_dependency))
18
- end
14
+ class << self
15
+ # @return [true] mark this as pending
16
+ def pending!
17
+ @pending = true
18
+ end
19
+
20
+ # Require all files
21
+ # @see #all_file_paths
22
+ def require_all
23
+ return unless @pending
24
+
25
+ @pending = nil
26
+ Logger.debug 'Loading all files', sourcing: false
27
+ new.all_file_paths.each(&method(:require_dependency))
28
+ end
19
29
 
20
- # Require models under {Wallaby::Configuration#model_paths}
21
- # @see #model_file_paths
22
- def self.require_models
23
- new.model_file_paths.each(&method(:require_dependency))
30
+ # Require models under {Wallaby::Configuration#model_paths}
31
+ # @see #model_file_paths
32
+ def require_models
33
+ new.model_file_paths.each(&method(:require_dependency))
34
+ end
24
35
  end
25
36
 
26
37
  # @return [Array<String>] all files under **Rails.configuration.eager_load_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.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tian Chen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-19 00:00:00.000000000 Z
11
+ date: 2024-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel