>Config

Config

Stores the global configuration of CocoaPods.

Inherits from:

Object

Child Name Spaces

Pod::Config::Mixin

Initialization

verbose

initialize

UI

verbose?

silent

silent?

new_version_message

new_version_message?

Installation

clean

clean?

integrate_targets

integrate_targets?

skip_repo_update

skip_repo_update?

Cache

max_cache_size

cache_root

aggressive_cache=

aggressive_cache?

Paths

home_dir

repos_dir

installation_root

project_root

sandbox_root

project_pods_root

sandbox

podfile

lockfile

podfile_path

lockfile_path

statistics_cache_file

search_index_file

Dependency Injection

downloader

spec_statistics_provider

Private helpers

user_settings_file

configure_with

podfile_path_in_dir

Singleton

instance

verbosereadwrite attribute

Signature

verbose #=> Bool 

Returns

Bool

Whether CocoaPods should provide detailed output about the performed actions.

Signature

verbose=(value) #=> Bool 

Returns

Bool

Whether CocoaPods should provide detailed output about the performed actions.

Source Files

lib/cocoapods/config.rb:39

lib/cocoapods/config.rb:125

spec/unit/config_spec.rb

spec/unit/config_spec.rb

initialize

Signature

initialize(use_user_settings = true) #=> Config 

Returns

Config A new instance of Config

Source

115 def initialize(use_user_settings = true)
116   configure_with(DEFAULTS)
117 
118   if use_user_settings && user_settings_file.exist?
119     require 'yaml'
120     user_settings = YAML.load_file(user_settings_file)
121     configure_with(user_settings)
122   end
123 end

Source Files

lib/cocoapods/config.rb:115

spec/unit/config_spec.rb

verbose?

Signature

verbose? #=> Bool 

Returns

Bool

Whether CocoaPods should provide detailed output about the performed actions.

Source

40 def verbose
41   @verbose
42 end

Source Files

lib/cocoapods/config.rb:40

spec/unit/config_spec.rb

silentreadwrite attribute

Signature

silent #=> Bool 

Returns

Bool Whether CocoaPods should produce not output.

Aliases

Pod::Config#silent?

Signature

silent=(value) #=> Bool 

Returns

Bool Whether CocoaPods should produce not output.

Source Files

lib/cocoapods/config.rb:44

spec/unit/config_spec.rb

silent?

Signature

silent? #=> Bool 

Returns

Bool Whether CocoaPods should produce not output.

Source

45 def silent
46   @silent
47 end

Source Files

lib/cocoapods/config.rb:45

spec/unit/config_spec.rb

new_version_messagereadwrite attribute

Signature

new_version_message #=> Bool 

Returns

Bool

Whether a message should be printed when a new version of CocoaPods is available.

Aliases

Pod::Config#new_version_message?

Signature

new_version_message=(value) #=> Bool 

Returns

Bool

Whether a message should be printed when a new version of CocoaPods is available.

Source Files

lib/cocoapods/config.rb:50

spec/unit/config_spec.rb

new_version_message?

Signature

new_version_message? #=> Bool 

Returns

Bool

Whether a message should be printed when a new version of CocoaPods is available.

Source

51 def new_version_message
52   @new_version_message
53 end

Source Files

lib/cocoapods/config.rb:51

spec/unit/config_spec.rb

cleanreadwrite attribute

Signature

clean #=> Bool 

Returns

Bool Whether the installer should clean after the installation.

Aliases

Pod::Config#clean?

Signature

clean=(value) #=> Bool 

Returns

Bool Whether the installer should clean after the installation.

Source Files

lib/cocoapods/config.rb:59

spec/unit/config_spec.rb

clean?

Signature

clean? #=> Bool 

Returns

Bool Whether the installer should clean after the installation.

Source

60 def clean
61   @clean
62 end

Source Files

lib/cocoapods/config.rb:60

spec/unit/config_spec.rb

integrate_targetsreadwrite attribute

Signature

integrate_targets #=> Bool 

Returns

Bool

Whether CocoaPods should integrate a user target and build the workspace or just create the Pods project.

Aliases

Pod::Config#integrate_targets?

Signature

integrate_targets=(value) #=> Bool 

Returns

Bool

Whether CocoaPods should integrate a user target and build the workspace or just create the Pods project.

Source Files

lib/cocoapods/config.rb:65

spec/unit/config_spec.rb

integrate_targets?

Signature

integrate_targets? #=> Bool 

Returns

Bool

Whether CocoaPods should integrate a user target and build the workspace or just create the Pods project.

Source

66 def integrate_targets
67   @integrate_targets
68 end

Source Files

lib/cocoapods/config.rb:66

spec/unit/config_spec.rb

skip_repo_updatereadwrite attribute

Signature

skip_repo_update #=> Bool 

Returns

Bool Whether the installer should skip the repos update.

Aliases

Pod::Config#skip_repo_update?

Signature

skip_repo_update=(value) #=> Bool 

Returns

Bool Whether the installer should skip the repos update.

Source Files

lib/cocoapods/config.rb:71

spec/unit/config_spec.rb

skip_repo_update?

Signature

skip_repo_update? #=> Bool 

Returns

Bool Whether the installer should skip the repos update.

Source

72 def skip_repo_update
73   @skip_repo_update
74 end

Source Files

lib/cocoapods/config.rb:72

spec/unit/config_spec.rb

max_cache_sizereadwrite attribute

Signature

max_cache_size #=> Fixnum 

Returns

Fixnum The maximum size for the cache expressed in Mb.

Signature

max_cache_size=(value) #=> Fixnum 

Returns

Fixnum The maximum size for the cache expressed in Mb.

Source Files

lib/cocoapods/config.rb:82

spec/unit/config_spec.rb

cache_rootreadwrite attribute

Signature

cache_root #=> Pathname 

Returns

Pathname

The directory where CocoaPods should cache remote data and other expensive to compute information.

Signature

cache_root=(value) #=> Pathname 

Returns

Pathname

The directory where CocoaPods should cache remote data and other expensive to compute information.

Source Files

lib/cocoapods/config.rb:87

lib/cocoapods/config.rb:89

spec/unit/config_spec.rb

spec/unit/config_spec.rb

aggressive_cache=attribute writer

Signature

aggressive_cache=(value) #=> undefined

Source Files

lib/cocoapods/config.rb:100

spec/unit/config_spec.rb

aggressive_cache?

Signature

aggressive_cache? #=> Bool 

Returns

Bool

Whether the downloader should use more aggressive caching options.

Source

105 def aggressive_cache?
106   @aggressive_cache || (ENV['CP_AGGRESSIVE_CACHE'] == 'TRUE')
107 end

Source Files

lib/cocoapods/config.rb:105

spec/unit/config_spec.rb

home_dir

Signature

home_dir #=> Pathname 

Returns

Pathname

The directory where repos, templates and configuration files are stored.

Source

138 def home_dir
139   @home_dir ||= Pathname.new(ENV['CP_HOME_DIR'] || "~/.cocoapods").expand_path
140 end

Source Files

lib/cocoapods/config.rb:138

spec/unit/config_spec.rb

repos_dirreadwrite attribute

Signature

repos_dir #=> Pathname 

Returns

Pathname The directory where the CocoaPods sources are stored.

Signature

repos_dir=(value) #=> undefined

Parameters

value

The value to set the attribute repos_dir to.

Source Files

lib/cocoapods/config.rb:144

spec/unit/config_spec.rb

installation_rootreadwrite attribute

Signature

installation_root #=> Pathname 

Returns

Pathname

The root of the CocoaPods installation where the Podfile is located.

Aliases

Pod::Config#project_root

Signature

installation_root=(value) #=> undefined

Parameters

value

The value to set the attribute installation_root to.

Source Files

lib/cocoapods/config.rb:153

spec/unit/config_spec.rb

project_root

Signature

project_root #=> Pathname 

Returns

Pathname

The root of the CocoaPods installation where the Podfile is located.

Source

173 def installation_root
174   current_path = Pathname.pwd
175   unless @installation_root
176     while(!current_path.root?)
177       if podfile_path_in_dir(current_path)
178         @installation_root = current_path
179         unless current_path == Pathname.pwd
180           UI.puts("[in #{current_path}]")
181         end
182         break
183       else
184         current_path = current_path.parent
185       end
186     end
187     @installation_root ||= Pathname.pwd
188   end
189   @installation_root
190 end

Source Files

lib/cocoapods/config.rb:173

spec/unit/config_spec.rb

sandbox_rootreadwrite attribute

Signature

sandbox_root #=> Pathname 

Returns

Pathname The root of the sandbox.

Aliases

Pod::Config#project_pods_root

Signature

sandbox_root=(value) #=> undefined

Parameters

value

The value to set the attribute sandbox_root to.

Source Files

lib/cocoapods/config.rb:177

spec/unit/config_spec.rb

project_pods_root

Signature

project_pods_root #=> Pathname 

Returns

Pathname The root of the sandbox.

Source

182 def sandbox_root
183   @sandbox_root ||= installation_root + 'Pods'
184 end

Source Files

lib/cocoapods/config.rb:182

spec/unit/config_spec.rb

sandbox

Signature

sandbox #=> Sandbox 

Returns

Sandbox The sandbox of the current project.

Source

186 def sandbox
187   @sandbox ||= Sandbox.new(sandbox_root)
188 end

Source Files

lib/cocoapods/config.rb:186

spec/unit/config_spec.rb

podfilereadwrite attribute

Signature

podfile #=> Podfile, Nil 

Returns

Podfile The Podfile to use for the current execution.

Nil If no Podfile is available.

Signature

podfile=(value) #=> undefined

Parameters

value

The value to set the attribute podfile to.

Source Files

lib/cocoapods/config.rb:193

spec/unit/config_spec.rb

lockfile

Signature

lockfile #=> Lockfile, Nil 

Returns

Lockfile The Lockfile to use for the current execution.

Nil If no Lockfile is available.

Source

201 def lockfile
202   @lockfile ||= Lockfile.from_file(lockfile_path) if lockfile_path
203 end

Source Files

lib/cocoapods/config.rb:201

spec/unit/config_spec.rb

podfile_path

Signature

podfile_path #=> Pathname, Nil 

Returns

Pathname

Nil

Source

214 def podfile_path
215   @podfile_path ||= podfile_path_in_dir(installation_root)
216 end

Source Files

lib/cocoapods/config.rb:214

spec/unit/config_spec.rb

lockfile_path

Signature

lockfile_path #=> undefined

Source

222 def lockfile_path
223   @lockfile_path ||= installation_root + 'Podfile.lock'
224 end

Source Files

lib/cocoapods/config.rb:222

spec/unit/config_spec.rb

statistics_cache_file

Signature

statistics_cache_file #=> Pathname 

Returns

Pathname The file to use a cache of the statistics provider.

Source

228 def statistics_cache_file
229   cache_root + 'statistics.yml'
230 end

Source Files

lib/cocoapods/config.rb:228

spec/unit/config_spec.rb

search_index_file

Signature

search_index_file #=> Pathname 

Returns

Pathname The file to use to cache the search data.

Source

234 def search_index_file
235   cache_root + 'search_index.yaml'
236 end

Source Files

lib/cocoapods/config.rb:234

spec/unit/config_spec.rb

downloader

Signature

downloader(target_path, options) #=> Downloader 

Returns

Downloader

The downloader to use for the retrieving remote source.

Source

247 def downloader(target_path, options)
248   downloader = Downloader.for_target(target_path, options)
249   downloader.cache_root = cache_root
250   downloader.max_cache_size = max_cache_size
251   downloader.aggressive_cache = aggressive_cache?
252   downloader
253 end

Source Files

lib/cocoapods/config.rb:247

spec/unit/config_spec.rb

spec_statistics_provider

Signature

spec_statistics_provider #=> Specification::Set::Statistics 

Returns

Specification::Set::Statistics

The statistic provider to use for specifications.

Source

258 def spec_statistics_provider
259   Specification::Set::Statistics.new(statistics_cache_file)
260 end

Source Files

lib/cocoapods/config.rb:258

spec/unit/config_spec.rb

user_settings_file

Signature

user_settings_file #=> Pathname 

Returns

Pathname The path of the file which contains the user settings.

Source

270 def user_settings_file
271   home_dir + "config.yaml"
272 end

Source Files

lib/cocoapods/config.rb:270

spec/unit/config_spec.rb

configure_with

Signature

configure_with(values_by_key) #=> void 

Parameters

Hash{String,Symbol => Object} values_by_key

The values of the attributes grouped by key.

Returns

void

Source

281 def configure_with(values_by_key)
282   return unless values_by_key
283   values_by_key.each do |key, value|
284     self.instance_variable_set("@#{key}", value)
285   end
286 end

Source Files

lib/cocoapods/config.rb:281

spec/unit/config_spec.rb

podfile_path_in_dir

Signature

podfile_path_in_dir(dir) #=> Pathname, Nil 

Parameters

Pathname dir

The directory where to look for the Podfile.

Returns

Pathname The path of the Podfile.

Nil If not Podfile was found in the given dir

Source

305 def podfile_path_in_dir(dir)
306   PODFILE_NAMES.each do |filename|
307     candidate = dir + filename
308     if candidate.exist?
309       return candidate
310     end
311   end
312   nil
313 end

Source Files

lib/cocoapods/config.rb:305

spec/unit/config_spec.rb

instanceclass method

Signature

instance #=> Config 

Returns

Config The current config instance creating one if needed.

Signature

instance=(instance) #=> void 

Parameters

Config Nil the

Instance.

Returns

void

Source

323 def self.instance
324   @instance ||= new
325 end

Source Files

lib/cocoapods/config.rb:323

spec/unit/config_spec.rb