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 +4 -4
- data/lib/wallaby/core/version.rb +1 -1
- data/lib/wallaby/engine.rb +1 -2
- data/lib/wallaby/map.rb +5 -1
- data/lib/wallaby/preloader.rb +20 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42ce40b2375306ae5636cd6cf0416b0f1bc61a07efca25cd2dcf9cbe389a75af
|
4
|
+
data.tar.gz: 66cc05ec1bc0d6f927f9e1ffe3b39df70cd4e2d8ebfd752c07b0c96813a4ee16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83b55f8572a2d4d95d7d8c62ee1e11e3260d36935ddfc5712f0cf0e760fbb238b43b05cb38d892322a41842296c53b656146cd32870d54e356072adf3b974dd4
|
7
|
+
data.tar.gz: 71843ecf06cc964c4bd40639e158d3e9442dfec35f366c5ef05f31ba10bcf9842e89e3211f2e75283250411916a9d1bc69e4e6c3f0234a4f03706f611befd9a5
|
data/lib/wallaby/core/version.rb
CHANGED
data/lib/wallaby/engine.rb
CHANGED
@@ -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.
|
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 ||=
|
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
|
data/lib/wallaby/preloader.rb
CHANGED
@@ -11,16 +11,27 @@ module Wallaby
|
|
11
11
|
class Preloader
|
12
12
|
include ActiveModel::Model
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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.
|
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:
|
11
|
+
date: 2024-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|