lib/cocoapods-util/binary/config.rb in cocoapods-util-0.0.16 vs lib/cocoapods-util/binary/config.rb in cocoapods-util-0.2.0

- old
+ new

@@ -2,22 +2,51 @@ def self.config BinaryPrebuild::Config.instance end class Config - attr_accessor :enable_all, :enable_targets - + attr_accessor :dsl_config + + APPLICABLE_DSL_CONFIG = [ + :all_binary, + :binary_dir, + :dev_pods_enabled, + :xcconfig_replace_path, + ].freeze + def initialize() - @enable_all = false - @enable_targets = [] + @dsl_config = {} end def self.instance @instance ||= new() end - def add_enable_target(name) - @enable_targets.push name - @enable_targets.uniq! + def validate_dsl_config + inapplicable_options = @dsl_config.keys - APPLICABLE_DSL_CONFIG + return if inapplicable_options.empty? + + message = <<~HEREDOC + [WARNING] The following options (in `config_cocoapods_util`) are not correct: #{inapplicable_options}. + Available options: #{APPLICABLE_DSL_CONFIG}. + HEREDOC + + Pod::UI.puts message.yellow + end + + def all_binary_enable? + @dsl_config[:all_binary] || false + end + + def dev_pods_enabled? + @dsl_config[:dev_pods_enabled] || false + end + + def binary_dir + @dsl_config[:binary_dir] || '_Prebuild' + end + + def xcconfig_replace_path + @dsl_config[:xcconfig_replace_path] || "cocoapods-util-binary" end end end \ No newline at end of file