Module: Shakapacker::Install::Env
- Defined in:
- lib/shakapacker/install/env.rb
Constant Summary collapse
- TRUTHY_VALUES =
%w[true 1 yes].freeze
Class Method Summary collapse
- .conflict_option ⇒ Object
- .truthy_env?(name) ⇒ Boolean
-
.update_transpiler_config?(transpiler_to_install:, conflict_option:, config_preexisting:) ⇒ Boolean
Preserve existing shakapacker.yml when SKIP mode is active, but still update newly-copied files on fresh installs.
Class Method Details
.conflict_option ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/shakapacker/install/env.rb', line 12 def conflict_option if truthy_env?("FORCE") { force: true } elsif truthy_env?("SKIP") { skip: true } else {} end end |
.truthy_env?(name) ⇒ Boolean
8 9 10 |
# File 'lib/shakapacker/install/env.rb', line 8 def truthy_env?(name) TRUTHY_VALUES.include?(ENV[name].to_s.downcase) end |
.update_transpiler_config?(transpiler_to_install:, conflict_option:, config_preexisting:) ⇒ Boolean
Preserve existing shakapacker.yml when SKIP mode is active, but still update newly-copied files on fresh installs.
24 25 26 27 28 29 30 |
# File 'lib/shakapacker/install/env.rb', line 24 def update_transpiler_config?(transpiler_to_install:, conflict_option:, config_preexisting:) return false if transpiler_to_install == "swc" return true if conflict_option[:force] return true unless conflict_option[:skip] !config_preexisting end |