Class: Pod::Config
- Inherits:
-
Object
- Object
- Pod::Config
- Defined in:
- lib/cocoapods/config.rb
Overview
Stores the global configuration of CocoaPods.
Defined Under Namespace
Modules: Mixin
Constant Summary collapse
- DEFAULTS =
The default settings for the configuration.
Users can specify custom settings in ‘~/.cocoapods/config.yaml`. An example of the contents of this file might look like:
--- skip_repo_update: true new_version_message: false
{ :verbose => false, :silent => false, :skip_repo_update => false, :aggressive_cache => false, :clean => true, :integrate_targets => true, :new_version_message => true, }
UI collapse
-
#new_version_message ⇒ Bool
(also: #new_version_message?)
Whether a message should be printed when a new version of CocoaPods is available.
-
#silent ⇒ Bool
(also: #silent?)
Whether CocoaPods should produce not output.
Installation collapse
-
#aggressive_cache ⇒ Object
writeonly
Allows to set whether the downloader should use more aggressive caching options.
-
#clean ⇒ Bool
(also: #clean?)
Whether the installer should clean after the installation.
-
#integrate_targets ⇒ Bool
(also: #integrate_targets?)
Whether CocoaPods should integrate a user target and build the workspace or just create the Pods project.
-
#skip_repo_update ⇒ Bool
(also: #skip_repo_update?)
Whether the installer should skip the repos update.
Initialization collapse
-
#verbose ⇒ Bool
Whether CocoaPods should provide detailed output about the performed actions.
Paths collapse
-
#installation_root ⇒ Pathname
(also: #project_root)
The root of the CocoaPods installation where the Podfile is located.
-
#podfile ⇒ Podfile
The Podfile to use for the current execution.
-
#repos_dir ⇒ Pathname
The directory where the CocoaPods sources are stored.
-
#sandbox_root ⇒ Pathname
(also: #project_pods_root)
The root of the sandbox.
UI collapse
-
#verbose? ⇒ Bool
Whether CocoaPods should provide detailed output about the performed actions.
Installation collapse
-
#aggressive_cache? ⇒ Bool
Whether the downloader should use more aggressive caching options.
Initialization collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Paths collapse
-
#lockfile ⇒ Lockfile
The Lockfile to use for the current execution.
-
#sandbox ⇒ Sandbox
The sandbox of the current project.
Helpers collapse
-
.instance ⇒ Config
The current config instance creating one if needed.
-
.instance=(instance) ⇒ void
Sets the current config instance.
-
#configure_with(values_by_key) ⇒ void
Sets the values of the attributes with the given hash.
-
#lockfile_path ⇒ Object
Returns the path of the Lockfile.
-
#podfile_path ⇒ Object
Returns the path of the Podfile.
-
#user_settings_file ⇒ Pathname
The path of the file which contains the user settings.
Constructor Details
Instance Attribute Details
#aggressive_cache=(value) ⇒ Object (writeonly)
The aggressive cache has lead to issues if a tag is updated to point to another commit.
Allows to set whether the downloader should use more aggressive caching options.
75 76 77 |
# File 'lib/cocoapods/config.rb', line 75 def aggressive_cache=(value) @aggressive_cache = value end |
#clean ⇒ Bool Also known as: clean?
Returns Whether the installer should clean after the installation.
54 55 56 |
# File 'lib/cocoapods/config.rb', line 54 def clean @clean end |
#installation_root ⇒ Pathname Also known as: project_root
Returns the root of the CocoaPods installation where the Podfile is located.
117 118 119 |
# File 'lib/cocoapods/config.rb', line 117 def installation_root @installation_root ||= Pathname.pwd end |
#integrate_targets ⇒ Bool Also known as: integrate_targets?
Returns Whether CocoaPods should integrate a user target and build the workspace or just create the Pods project.
60 61 62 |
# File 'lib/cocoapods/config.rb', line 60 def integrate_targets @integrate_targets end |
#new_version_message ⇒ Bool Also known as: new_version_message?
Returns Whether a message should be printed when a new version of CocoaPods is available.
45 46 47 |
# File 'lib/cocoapods/config.rb', line 45 def @new_version_message end |
#podfile ⇒ Podfile
Returns The Podfile to use for the current execution.
141 142 143 |
# File 'lib/cocoapods/config.rb', line 141 def podfile @podfile ||= Podfile.from_file(podfile_path) if podfile_path.exist? end |
#repos_dir ⇒ Pathname
Returns the directory where the CocoaPods sources are stored.
108 109 110 |
# File 'lib/cocoapods/config.rb', line 108 def repos_dir @repos_dir ||= Pathname.new(ENV['CP_REPOS_DIR'] || "~/.cocoapods"). end |
#sandbox_root ⇒ Pathname Also known as: project_pods_root
Returns The root of the sandbox.
126 127 128 |
# File 'lib/cocoapods/config.rb', line 126 def sandbox_root @sandbox_root ||= installation_root + 'Pods' end |
#silent ⇒ Bool Also known as: silent?
Returns Whether CocoaPods should produce not output.
39 40 41 |
# File 'lib/cocoapods/config.rb', line 39 def silent @silent end |
#skip_repo_update ⇒ Bool Also known as: skip_repo_update?
Returns Whether the installer should skip the repos update.
66 67 68 |
# File 'lib/cocoapods/config.rb', line 66 def skip_repo_update @skip_repo_update end |
#verbose ⇒ Bool
Returns Whether CocoaPods should provide detailed output about the performed actions.
34 35 36 |
# File 'lib/cocoapods/config.rb', line 34 def verbose @verbose end |
Class Method Details
.instance ⇒ Config
Returns the current config instance creating one if needed.
205 206 207 |
# File 'lib/cocoapods/config.rb', line 205 def self.instance @instance ||= new end |
.instance=(instance) ⇒ void
This method returns an undefined value.
Sets the current config instance. If set to nil the config will be recreated when needed.
216 217 218 |
# File 'lib/cocoapods/config.rb', line 216 def self.instance=(instance) @instance = instance end |
Instance Method Details
#aggressive_cache? ⇒ Bool
Returns Whether the downloader should use more aggressive caching options.
80 81 82 |
# File 'lib/cocoapods/config.rb', line 80 def aggressive_cache? @aggressive_cache || (ENV['CP_AGGRESSIVE_CACHE'] != 'FALSE') end |
#configure_with(values_by_key) ⇒ void
This method returns an undefined value.
Sets the values of the attributes with the given hash.
171 172 173 174 175 176 |
# File 'lib/cocoapods/config.rb', line 171 def configure_with(values_by_key) return unless values_by_key values_by_key.each do |key, value| self.instance_variable_set("@#{key}", value) end end |
#lockfile ⇒ Lockfile
Returns The Lockfile to use for the current execution.
148 149 150 |
# File 'lib/cocoapods/config.rb', line 148 def lockfile @lockfile ||= Lockfile.from_file(lockfile_path) if lockfile_path.exist? end |
#lockfile_path ⇒ Object
The Lockfile is named ‘Podfile.lock`.
Returns the path of the Lockfile.
197 198 199 |
# File 'lib/cocoapods/config.rb', line 197 def lockfile_path @lockfile_path ||= installation_root + 'Podfile.lock' end |
#podfile_path ⇒ Object
The Podfile can be named either ‘CocoaPods.podfile` or `Podfile`. The first is preferred as it allows to specify an OS X UTI.
Returns the path of the Podfile.
183 184 185 186 187 188 189 190 191 |
# File 'lib/cocoapods/config.rb', line 183 def podfile_path unless @podfile_path path = installation_root + 'CocoaPods.podfile.yaml' path = installation_root + 'CocoaPods.podfile' unless path.exist? path = installation_root + 'Podfile' unless path.exist? @podfile_path = path end @podfile_path end |
#sandbox ⇒ Sandbox
Returns The sandbox of the current project.
135 136 137 |
# File 'lib/cocoapods/config.rb', line 135 def sandbox @sandbox ||= Sandbox.new(sandbox_root) end |
#user_settings_file ⇒ Pathname
Returns The path of the file which contains the user settings.
160 161 162 |
# File 'lib/cocoapods/config.rb', line 160 def user_settings_file repos_dir + "config.yaml" end |
#verbose? ⇒ Bool
Returns Whether CocoaPods should provide detailed output about the performed actions.
35 36 37 |
# File 'lib/cocoapods/config.rb', line 35 def verbose @verbose end |