Class: TestData::Wrap::WebpackerConfig
- Inherits:
-
Object
- Object
- TestData::Wrap::WebpackerConfig
- Defined in:
- lib/test_data/wrap/webpacker_config.rb
Instance Method Summary collapse
- #builtin_config ⇒ Object
-
#initialize ⇒ WebpackerConfig
constructor
A new instance of WebpackerConfig.
- #no_user_config_exists? ⇒ Boolean
- #relative_user_config_path ⇒ Object
- #required_entries_missing_from_test_data_config ⇒ Object
- #user_config ⇒ Object
- #webpacker_gem_spec_loaded? ⇒ Boolean
Constructor Details
#initialize ⇒ WebpackerConfig
Returns a new instance of WebpackerConfig.
4 5 6 |
# File 'lib/test_data/wrap/webpacker_config.rb', line 4 def initialize @user_config_path = Pathname.new("#{TestData.config.pwd}/config/webpacker.yml") end |
Instance Method Details
#builtin_config ⇒ Object
24 25 26 27 |
# File 'lib/test_data/wrap/webpacker_config.rb', line 24 def builtin_config webpacker_path = Gem.loaded_specs["webpacker"].full_gem_path load_yaml(File.join(webpacker_path, "lib/install/config/webpacker.yml")) end |
#no_user_config_exists? ⇒ Boolean
12 13 14 |
# File 'lib/test_data/wrap/webpacker_config.rb', line 12 def no_user_config_exists? !@user_config_path.readable? end |
#relative_user_config_path ⇒ Object
8 9 10 |
# File 'lib/test_data/wrap/webpacker_config.rb', line 8 def relative_user_config_path @user_config_path.relative_path_from(Rails.root) end |
#required_entries_missing_from_test_data_config ⇒ Object
29 30 31 32 |
# File 'lib/test_data/wrap/webpacker_config.rb', line 29 def required_entries_missing_from_test_data_config missing_keys = builtin_config["development"].keys - user_config["test_data"].keys builtin_config["development"].slice(*missing_keys).presence end |
#user_config ⇒ Object
16 17 18 |
# File 'lib/test_data/wrap/webpacker_config.rb', line 16 def user_config load_yaml(@user_config_path) end |
#webpacker_gem_spec_loaded? ⇒ Boolean
20 21 22 |
# File 'lib/test_data/wrap/webpacker_config.rb', line 20 def webpacker_gem_spec_loaded? !!Gem.loaded_specs["webpacker"] end |