Commit 3e1f0a59 authored by Fabio Pelosin's avatar Fabio Pelosin

[Config] Read user settings from `~/.cocoapods/config.yaml`.

Closes #658.
parent 99ef21e1
......@@ -17,7 +17,7 @@ GIT
GIT
remote: git://github.com/CocoaPods/cocoapods-downloader
revision: d07096a3ab8c74ac34853fccfa968d55097fcbf2
revision: b349db398d5e9205a67974f70906fec2c7a0e588
specs:
cocoapods-downloader (0.1.0)
......
......@@ -86,28 +86,46 @@ module Pod
#--------------------------------------#
def initialize
@repos_dir = Pathname.new(File.expand_path("~/.cocoapods"))
@verbose = @silent = @skip_repo_update = false
@clean = @generate_docs = @doc_install = @integrate_targets = @new_version_message = true
configure_with(defaults)
config_file = Pathname.new(ENV['HOME'] + "/.cocoapods/config.yaml")
if config_file.exist?
require 'yaml'
user_config = YAML.load_file(config_file)
configure_with(user_config)
end
@repos_dir = Pathname.new(ENV['HOME'] + "/.cocoapods")
@project_root = Pathname.pwd
@project_pods_root = Pathname.pwd + 'Pods'
end
# @return [Pathname] the root of the CocoaPods instance where the Podfile
# is located.
#
# @todo Move to initialization.
#
def project_root
@project_root ||= Pathname.pwd
def defaults
{
:verbose => false,
:silent => false,
:skip_repo_update => false,
:clean => true,
:generate_docs => true,
:doc_install => true,
:integrate_targets => true,
:skip_repo_update => true,
:new_version_message => true,
}
end
# @return [Pathname] The root of the sandbox.
#
# @todo Why is this needed? Can't clients use config.sandbox.root?
#
def project_pods_root
@project_pods_root ||= project_root + 'Pods'
def configure_with(values)
values.each do |key, value|
self.instance_variable_set("@#{key}", value)
end
end
# @return [Podfile] The Podfile to use for the current execution.
#
def podfile
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment