webpack_native 0.3.9 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/webpack_native/railtie.rb +16 -3
- data/lib/webpack_native/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e4009bf336ddda06916af069c42c99129febd5b684391506dc3a2358ac93886
|
4
|
+
data.tar.gz: 54279f3a7391baa78c1a0047a986ac1434cc3e391e426e5313fc9be6af31cd79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4affff6d93be02addccc0de31d5378e8627d26fc931ce727ad18def05379bae824448f1b51959e19eee59d2cb4cf5f34cd28d5a9bcec3108cbaa215153eaa0af
|
7
|
+
data.tar.gz: a2e9dad95ddbffbfc83c28bcfbbdd6cff109f24c290f34333efc07550e8e277274ca1375de7b07f8c26ccc938320ad4dc3901ada99cc5dbc37ee38e2e5a1ecd2
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rails'
|
2
2
|
require "open3"
|
3
|
+
require "fileutils"
|
3
4
|
|
4
5
|
class WebpackNative::Railtie < ::Rails::Railtie
|
5
6
|
|
@@ -17,14 +18,26 @@ class WebpackNative::Railtie < ::Rails::Railtie
|
|
17
18
|
|
18
19
|
initializer "webpack_native_set_manifest" do
|
19
20
|
if Rails.env.production?
|
20
|
-
|
21
|
+
|
22
|
+
# create public/webpack_native if it doesn't exist:
|
23
|
+
|
24
|
+
webpack_native_folder = "#{Rails.root}/public/webpack_native"
|
25
|
+
|
26
|
+
unless File.directory?(webpack_native_folder)
|
27
|
+
FileUtils.mkdir_p(webpack_native_folder)
|
28
|
+
end
|
29
|
+
|
21
30
|
# create manifest.json file if it doesn't exist with an empty json {} to prevent raising error in WebpackNativeHelper.load_webpack_manifest if a restart of a service happen (i.e delayed_job restart) that causes rails to load
|
22
|
-
|
23
|
-
|
31
|
+
|
32
|
+
manifest_path = "#{Rails.root}/public/webpack_native/manifest.json"
|
33
|
+
|
34
|
+
unless File.file?(manifest_path)
|
35
|
+
FileUtils.touch manifest_path
|
24
36
|
File.write manifest_path, "{}"
|
25
37
|
end
|
26
38
|
require_relative 'webpack_native_helper'
|
27
39
|
Rails.configuration.x.webpack_native.webpack_manifest_file = WebpackNative::WebpackNativeHelper.load_webpack_manifest
|
40
|
+
|
28
41
|
end
|
29
42
|
end
|
30
43
|
|