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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 898bb9c4f771b2ab8cd955eb1fb4905dae5390fcbb99e4fffc2ff8aa87da841d
4
- data.tar.gz: 9fff199c9312a34abfc2bb9fb762ac3870a657ebeab9b1f7d558abf581654c7e
3
+ metadata.gz: 6e4009bf336ddda06916af069c42c99129febd5b684391506dc3a2358ac93886
4
+ data.tar.gz: 54279f3a7391baa78c1a0047a986ac1434cc3e391e426e5313fc9be6af31cd79
5
5
  SHA512:
6
- metadata.gz: dfd7c8b1a9915002b2c837422f78c7985b21775a527ecddc33be4395ffdefbc47f7278f1b2819996a897f396e5302af11b7b3dace092a89a1f4fb513e0dbc472
7
- data.tar.gz: d29a2de898cba30e1e9c3769e57986c7115999a632631a6bb6a3b06cf1da5e779b705ed1831910b25da06c8ade19048d2f12cb02837a63d3b1f95305b241d639
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
- manifest_path = "#{Rails.root}/public/webpack_native/manifest.json"
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
- if !File.file?(manifest_path)
23
- #FileUtils.touch
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
 
@@ -1,3 +1,3 @@
1
1
  module WebpackNative
2
- VERSION = "0.3.9"
2
+ VERSION = "0.4.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webpack_native
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - scratchoo