class Tapioca::ConfigBuilder
Constants
- DEFAULT_OPTIONS
Public Class Methods
from_options(command, options)
click to toggle source
# File lib/tapioca/config_builder.rb, line 12 def from_options(command, options) merged_options = merge_options(default_options(command), config_options, options) puts(<<~MSG) if merged_options.include?("generate_command") DEPRECATION: The `-c` and `--cmd` flags will be removed in a future release. MSG Config.from_hash(merged_options) end
Private Class Methods
config_options()
click to toggle source
# File lib/tapioca/config_builder.rb, line 25 def config_options if File.exist?(Config::TAPIOCA_CONFIG) YAML.load_file(Config::TAPIOCA_CONFIG, fallback: {}) else {} end end
default_options(command)
click to toggle source
# File lib/tapioca/config_builder.rb, line 34 def default_options(command) default_outdir = case command when :sync, :generate, :gem Config::DEFAULT_GEMDIR when :dsl Config::DEFAULT_DSLDIR else Config::SORBET_PATH end DEFAULT_OPTIONS.merge("outdir" => default_outdir) end
merge_options(*options)
click to toggle source
# File lib/tapioca/config_builder.rb, line 48 def merge_options(*options) options.each_with_object({}) do |option, result| result.merge!(option) do |_, this_val, other_val| if this_val.is_a?(Hash) && other_val.is_a?(Hash) this_val.merge(other_val) else other_val end end end end