File tree 2 files changed +20
-5
lines changed
2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -93,8 +93,12 @@ def data
93
93
end
94
94
95
95
def load
96
- YAML . load ( config_path . read ) [ env ] . deep_symbolize_keys
97
-
96
+ config = begin
97
+ YAML . load_file ( config_path . to_s , aliases : true )
98
+ rescue ArgumentError
99
+ YAML . load_file ( config_path . to_s )
100
+ end
101
+ config [ env ] . deep_symbolize_keys
98
102
rescue Errno ::ENOENT => e
99
103
raise "Webpacker configuration file not found #{ config_path } . " \
100
104
"Please run rails webpacker:install " \
@@ -107,8 +111,15 @@ def load
107
111
end
108
112
109
113
def defaults
110
- @defaults ||= \
111
- HashWithIndifferentAccess . new ( YAML . load_file ( File . expand_path ( "../../install/config/webpacker.yml" , __FILE__ ) ) [ env ] )
114
+ @defaults ||= begin
115
+ path = File . expand_path ( "../../install/config/webpacker.yml" , __FILE__ )
116
+ config = begin
117
+ YAML . load_file ( path , aliases : true )
118
+ rescue ArgumentError
119
+ YAML . load_file ( path )
120
+ end
121
+ HashWithIndifferentAccess . new ( config [ env ] )
122
+ end
112
123
end
113
124
114
125
def globbed_path_with_extensions ( path )
Original file line number Diff line number Diff line change @@ -27,7 +27,11 @@ def fallback_env_warning
27
27
28
28
def available_environments
29
29
if config_path . exist?
30
- YAML . load ( config_path . read ) . keys
30
+ begin
31
+ YAML . load_file ( config_path . to_s , aliases : true )
32
+ rescue ArgumentError
33
+ YAML . load_file ( config_path . to_s )
34
+ end
31
35
else
32
36
[ ] . freeze
33
37
end
You can’t perform that action at this time.
0 commit comments