File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ bin_path = ENV["BUNDLE_BIN"] || Rails.root.join("bin")
4
4
namespace :webpacker do
5
5
desc "Install Webpacker in this application"
6
6
task install : [ :check_node , :check_yarn ] do |task |
7
+ Webpacker ::Configuration . installing = true
8
+
7
9
prefix = task . name . split ( /#|webpacker:install/ ) . first
8
10
9
11
if Rails ::VERSION ::MAJOR >= 5
Original file line number Diff line number Diff line change 3
3
require "active_support/core_ext/hash/indifferent_access"
4
4
5
5
class Webpacker ::Configuration
6
+ class << self
7
+ attr_accessor :installing
8
+ end
9
+
6
10
attr_reader :root_path , :config_path , :env
7
11
8
12
def initialize ( root_path :, config_path :, env :)
@@ -80,10 +84,13 @@ def load
80
84
end
81
85
config [ env ] . deep_symbolize_keys
82
86
rescue Errno ::ENOENT => e
83
- raise "Webpacker configuration file not found #{ config_path } . " \
84
- "Please run rails webpacker:install " \
85
- "Error: #{ e . message } "
86
-
87
+ if self . class . installing
88
+ { }
89
+ else
90
+ raise "Webpacker configuration file not found #{ config_path } . " \
91
+ "Please run rails webpacker:install " \
92
+ "Error: #{ e . message } "
93
+ end
87
94
rescue Psych ::SyntaxError => e
88
95
raise "YAML syntax error occurred while parsing #{ config_path } . " \
89
96
"Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " \
You can’t perform that action at this time.
0 commit comments