Class: Shakapacker::Configuration
- Inherits:
-
Object
- Object
- Shakapacker::Configuration
- Defined in:
- lib/shakapacker/configuration.rb
Class Attribute Summary collapse
-
.installing ⇒ Object
Returns the value of attribute installing.
Instance Attribute Summary collapse
-
#config_path ⇒ Object
readonly
Returns the value of attribute config_path.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#root_path ⇒ Object
readonly
Returns the value of attribute root_path.
Instance Method Summary collapse
- #additional_paths ⇒ Object
- #asset_host ⇒ Object
- #cache_manifest? ⇒ Boolean
- #cache_path ⇒ Object
- #compile? ⇒ Boolean
- #compiler_strategy ⇒ Object
- #dev_server ⇒ Object
- #ensure_consistent_versioning? ⇒ Boolean
- #fetch(key) ⇒ Object
-
#initialize(root_path:, config_path:, env:) ⇒ Configuration
constructor
A new instance of Configuration.
- #manifest_path ⇒ Object
- #nested_entries? ⇒ Boolean
- #public_manifest_path ⇒ Object
- #public_output_path ⇒ Object
- #public_path ⇒ Object
- #shakapacker_precompile? ⇒ Boolean
- #source_entry_path ⇒ Object
- #source_path ⇒ Object
- #webpack_compile_output? ⇒ Boolean
Constructor Details
#initialize(root_path:, config_path:, env:) ⇒ Configuration
Returns a new instance of Configuration.
12 13 14 15 16 |
# File 'lib/shakapacker/configuration.rb', line 12 def initialize(root_path:, config_path:, env:) @root_path = root_path @env = env @config_path = config_path end |
Class Attribute Details
.installing ⇒ Object
Returns the value of attribute installing.
7 8 9 |
# File 'lib/shakapacker/configuration.rb', line 7 def installing @installing end |
Instance Attribute Details
#config_path ⇒ Object (readonly)
Returns the value of attribute config_path.
10 11 12 |
# File 'lib/shakapacker/configuration.rb', line 10 def config_path @config_path end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
10 11 12 |
# File 'lib/shakapacker/configuration.rb', line 10 def env @env end |
#root_path ⇒ Object (readonly)
Returns the value of attribute root_path.
10 11 12 |
# File 'lib/shakapacker/configuration.rb', line 10 def root_path @root_path end |
Instance Method Details
#additional_paths ⇒ Object
47 48 49 |
# File 'lib/shakapacker/configuration.rb', line 47 def additional_paths fetch(:additional_paths) end |
#asset_host ⇒ Object
95 96 97 98 99 100 |
# File 'lib/shakapacker/configuration.rb', line 95 def asset_host ENV.fetch( "SHAKAPACKER_ASSET_HOST", fetch(:asset_host) || ActionController::Base.helpers.compute_asset_host ) end |
#cache_manifest? ⇒ Boolean
75 76 77 |
# File 'lib/shakapacker/configuration.rb', line 75 def cache_manifest? fetch(:cache_manifest) end |
#cache_path ⇒ Object
79 80 81 |
# File 'lib/shakapacker/configuration.rb', line 79 def cache_path root_path.join(fetch(:cache_path)) end |
#compile? ⇒ Boolean
22 23 24 |
# File 'lib/shakapacker/configuration.rb', line 22 def compile? fetch(:compile) end |
#compiler_strategy ⇒ Object
87 88 89 |
# File 'lib/shakapacker/configuration.rb', line 87 def compiler_strategy fetch(:compiler_strategy) end |
#dev_server ⇒ Object
18 19 20 |
# File 'lib/shakapacker/configuration.rb', line 18 def dev_server fetch(:dev_server) end |
#ensure_consistent_versioning? ⇒ Boolean
30 31 32 |
# File 'lib/shakapacker/configuration.rb', line 30 def ensure_consistent_versioning? fetch(:ensure_consistent_versioning) end |
#fetch(key) ⇒ Object
91 92 93 |
# File 'lib/shakapacker/configuration.rb', line 91 def fetch(key) data.fetch(key, defaults[key]) end |
#manifest_path ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/shakapacker/configuration.rb', line 55 def manifest_path if data.has_key?(:manifest_path) root_path.join(fetch(:manifest_path)) else public_output_path.join("manifest.json") end end |
#nested_entries? ⇒ Boolean
26 27 28 |
# File 'lib/shakapacker/configuration.rb', line 26 def nested_entries? fetch(:nested_entries) end |
#public_manifest_path ⇒ Object
63 64 65 |
# File 'lib/shakapacker/configuration.rb', line 63 def public_manifest_path manifest_path end |
#public_output_path ⇒ Object
71 72 73 |
# File 'lib/shakapacker/configuration.rb', line 71 def public_output_path public_path.join(fetch(:public_output_path)) end |
#public_path ⇒ Object
67 68 69 |
# File 'lib/shakapacker/configuration.rb', line 67 def public_path root_path.join(fetch(:public_root_path)) end |
#shakapacker_precompile? ⇒ Boolean
34 35 36 37 38 39 40 41 |
# File 'lib/shakapacker/configuration.rb', line 34 def shakapacker_precompile? # ENV of false takes precedence return false if %w(no false n f).include?(ENV["SHAKAPACKER_PRECOMPILE"]) return true if %w(yes true y t).include?(ENV["SHAKAPACKER_PRECOMPILE"]) return false unless config_path.exist? fetch(:shakapacker_precompile) end |
#source_entry_path ⇒ Object
51 52 53 |
# File 'lib/shakapacker/configuration.rb', line 51 def source_entry_path source_path.join(relative_path(fetch(:source_entry_path))) end |
#source_path ⇒ Object
43 44 45 |
# File 'lib/shakapacker/configuration.rb', line 43 def source_path root_path.join(fetch(:source_path)) end |
#webpack_compile_output? ⇒ Boolean
83 84 85 |
# File 'lib/shakapacker/configuration.rb', line 83 def webpack_compile_output? fetch(:webpack_compile_output) end |