Class: Pod::Installer::InstallationOptions
- Inherits:
-
Object
- Object
- Pod::Installer::InstallationOptions
- Defined in:
- lib/cocoapods/installer/installation_options.rb
Overview
Represents the installation options the user can customize via a ‘Podfile`.
Defined Under Namespace
Modules: Mixin
Class Method Summary collapse
-
.all_options ⇒ Array<Symbol>
The names of all known installation options.
-
.defaults ⇒ Hash<Symbol,Object>
All known installation options and their default values.
-
.from_podfile(podfile) ⇒ Self
Parses installation options from a podfile.
-
.option(name, default, boolean: true) ⇒ void
Defines a new installation option.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql)
-
#clean ⇒ Object
The clean option for installation.
-
#deduplicate_targets ⇒ Object
The deduplicate_targets option for installation.
-
#deterministic_uuids ⇒ Object
The deterministic_uuids option for installation.
- #hash ⇒ Object
-
#initialize(options = {}) ⇒ InstallationOptions
constructor
Initializes the installation options with a hash of options from a Podfile.
-
#integrate_targets ⇒ Object
The integrate_targets option for installation.
-
#lock_pod_sources ⇒ Object
The lock_pod_sources option for installation.
-
#share_schemes_for_development_pods ⇒ Object
The share_schemes_for_development_pods option for installation.
-
#to_h(include_defaults: true) ⇒ Hash
The options, keyed by option name.
-
#warn_for_multiple_pod_sources ⇒ Object
The warn_for_multiple_pod_sources option for installation.
Constructor Details
#initialize(options = {}) ⇒ InstallationOptions
Initializes the installation options with a hash of options from a Podfile.
71 72 73 74 75 76 77 78 79 |
# File 'lib/cocoapods/installer/installation_options.rb', line 71 def initialize( = {}) = ActiveSupport::HashWithIndifferentAccess.new() unknown_keys = .keys - self.class..map(&:to_s) raise Informative, "Unknown installation options: #{unknown_keys.to_sentence}." unless unknown_keys.empty? self.class.defaults.each do |key, default| value = .fetch(key, default) send("#{key}=", value) end end |
Class Method Details
.all_options ⇒ Array<Symbol>
Returns the names of all known installation options.
60 61 62 |
# File 'lib/cocoapods/installer/installation_options.rb', line 60 def self. defaults.keys end |
.defaults ⇒ Hash<Symbol,Object>
Returns all known installation options and their default values.
54 55 56 |
# File 'lib/cocoapods/installer/installation_options.rb', line 54 def self.defaults @defaults ||= {} end |
.from_podfile(podfile) ⇒ Self
Parses installation options from a podfile.
19 20 21 22 23 24 25 |
# File 'lib/cocoapods/installer/installation_options.rb', line 19 def self.from_podfile(podfile) name, = podfile.installation_method unless name.downcase == 'cocoapods' raise Informative, "Currently need to specify a `cocoapods` install, you chose `#{name}`." end new() end |
.option(name, default, boolean: true) ⇒ void
This method returns an undefined value.
Defines a new installation option.
43 44 45 46 47 48 49 |
# File 'lib/cocoapods/installer/installation_options.rb', line 43 def self.option(name, default, boolean: true) name = name.to_s raise ArgumentError, "The `#{name}` option is already defined" if defaults.key?(name) defaults[name] = default attr_accessor name alias_method "#{name}?", name if boolean end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql
94 95 96 |
# File 'lib/cocoapods/installer/installation_options.rb', line 94 def ==(other) other.is_a?(self.class) && to_h == other.to_h end |
#clean ⇒ Object
this option defaults to true.
Returns the clean option for installation.
104 |
# File 'lib/cocoapods/installer/installation_options.rb', line 104 option :clean, true |
#deduplicate_targets ⇒ Object
this option defaults to true.
Returns the deduplicate_targets option for installation.
105 |
# File 'lib/cocoapods/installer/installation_options.rb', line 105 option :deduplicate_targets, true |
#deterministic_uuids ⇒ Object
this option defaults to true.
Returns the deterministic_uuids option for installation.
106 |
# File 'lib/cocoapods/installer/installation_options.rb', line 106 option :deterministic_uuids, true |
#hash ⇒ Object
100 101 102 |
# File 'lib/cocoapods/installer/installation_options.rb', line 100 def hash to_h.hash end |
#integrate_targets ⇒ Object
this option defaults to true.
Returns the integrate_targets option for installation.
107 |
# File 'lib/cocoapods/installer/installation_options.rb', line 107 option :integrate_targets, true |
#lock_pod_sources ⇒ Object
this option defaults to true.
Returns the lock_pod_sources option for installation.
108 |
# File 'lib/cocoapods/installer/installation_options.rb', line 108 option :lock_pod_sources, true |
#share_schemes_for_development_pods ⇒ Object
this option defaults to false.
Returns the share_schemes_for_development_pods option for installation.
110 |
# File 'lib/cocoapods/installer/installation_options.rb', line 110 option :share_schemes_for_development_pods, false |
#to_h(include_defaults: true) ⇒ Hash
Returns the options, keyed by option name.
86 87 88 89 90 91 92 |
# File 'lib/cocoapods/installer/installation_options.rb', line 86 def to_h(include_defaults: true) self.class.defaults.reduce(ActiveSupport::HashWithIndifferentAccess.new) do |hash, (option, default)| value = send(option) hash[option] = value if include_defaults || value != default hash end end |
#warn_for_multiple_pod_sources ⇒ Object
this option defaults to true.
Returns the warn_for_multiple_pod_sources option for installation.
109 |
# File 'lib/cocoapods/installer/installation_options.rb', line 109 option :warn_for_multiple_pod_sources, true |