webpacker_lite 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +2 -2
- data/Gemfile.lock +1 -1
- data/lib/webpacker_lite/file_loader.rb +2 -2
- data/lib/webpacker_lite/version.rb +1 -1
- data/test/manifest_test.rb +13 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64e87e565a455af62c43a863fcf44063208c83fc
|
4
|
+
data.tar.gz: d4c5089867ebcdd40cf3c9a274477663f236e54b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7f508d5f1c97d0c770f80cb38be7bacae6d78f7c0ac004bcd3ca0ff35f2116fdcf23058f4ea9612d2a53ee1e8c4178aa5c25e51ed8b9fe3f96f2ad948b4cbf0
|
7
|
+
data.tar.gz: b5edde0f90ce1b0f89b8a09ccff11397133438464fae475e93d23ad7a4817ba63d46284aaf2439db099c21f4539a42fe5cfcda912856e632c15842614e29c066
|
data/CONTRIBUTING.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -11,7 +11,7 @@ class WebpackerLite::FileLoader
|
|
11
11
|
# Assume production is 100% cached
|
12
12
|
return if self.instance && # if we have a singleton
|
13
13
|
(env == "production" || # skip if production bc always cached
|
14
|
-
self.instance.mtime == File.mtime(path)) # skip if mtime not changed
|
14
|
+
(File.exist?(path) && self.instance.mtime == File.mtime(path))) # skip if mtime not changed
|
15
15
|
|
16
16
|
self.instance = new(path)
|
17
17
|
end
|
@@ -31,7 +31,7 @@ class WebpackerLite::FileLoader
|
|
31
31
|
private
|
32
32
|
def initialize(path)
|
33
33
|
@path = path
|
34
|
-
@mtime = File.mtime(path)
|
34
|
+
@mtime = File.exist?(path) ? File.mtime(path) : nil
|
35
35
|
@data = load_data
|
36
36
|
end
|
37
37
|
|
data/test/manifest_test.rb
CHANGED
@@ -6,6 +6,19 @@ class ManifestTest < Minitest::Test
|
|
6
6
|
assert_equal WebpackerLite::Manifest.file_path.to_s, file_path
|
7
7
|
end
|
8
8
|
|
9
|
+
def test_file_not_existing
|
10
|
+
begin
|
11
|
+
file_path = File.join(File.dirname(__FILE__), "test_app/public/webpack/test", "manifest.json")
|
12
|
+
temp_path = "#{file_path}.backup"
|
13
|
+
FileUtils.mv(file_path, temp_path)
|
14
|
+
# Point of this test is to ensure no crash
|
15
|
+
WebpackerLite::Manifest.load_instance
|
16
|
+
assert_equal({}, WebpackerLite::Manifest.instance.data)
|
17
|
+
ensure
|
18
|
+
FileUtils.mv(temp_path, file_path)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
9
22
|
def test_lookup_exception
|
10
23
|
manifest_path = File.join(File.dirname(__FILE__), "test_app/public/webpack/test", "manifest.json").to_s
|
11
24
|
asset_file = "calendar.js"
|