Skip to content

Commit eab7a02

Browse files
committed
Use class instance variable for installing
1 parent ce7cdd7 commit eab7a02

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/tasks/webpacker/install.rake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ bin_path = ENV["BUNDLE_BIN"] || Rails.root.join("bin")
44
namespace :webpacker do
55
desc "Install Webpacker in this application"
66
task install: [:check_node, :check_yarn] do |task|
7-
@@webpacker_installing = true
7+
Webpacker::Configuration.installing = true
8+
89
prefix = task.name.split(/#|webpacker:install/).first
910

1011
if Rails::VERSION::MAJOR >= 5

lib/webpacker/configuration.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
require "active_support/core_ext/hash/indifferent_access"
44

55
class Webpacker::Configuration
6+
class << self
7+
attr_accessor :installing
8+
end
9+
610
attr_reader :root_path, :config_path, :env
711

812
def initialize(root_path:, config_path:, env:)
@@ -80,7 +84,7 @@ def load
8084
end
8185
config[env].deep_symbolize_keys
8286
rescue Errno::ENOENT => e
83-
if @@webpacker_installing
87+
if self.class.installing
8488
{}
8589
else
8690
raise "Webpacker configuration file not found #{config_path}. " \

0 commit comments

Comments
 (0)