Commit aab11a84 authored by Kyle Fuller's avatar Kyle Fuller

Merge pull request #2945 from CocoaPods/fix-sources-manager

Do not rely on ~/.cocoapods being present.
parents 33b4e884 cb6cda5d
...@@ -69,6 +69,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -69,6 +69,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Samuel Giddins](https://github.com/CocoaPods/CocoaPods/issues/2859) [Samuel Giddins](https://github.com/CocoaPods/CocoaPods/issues/2859)
[#2859](https://github.com/CocoaPods/CocoaPods/issues/2859) [#2859](https://github.com/CocoaPods/CocoaPods/issues/2859)
* Fix an issue when a user doesn't yet have any spec repositories configured.
[Boris Bügling](https://github.com/neonichu)
## 0.35.0 ## 0.35.0
......
...@@ -9,6 +9,7 @@ module Pod ...@@ -9,6 +9,7 @@ module Pod
# known Pods. # known Pods.
# #
def aggregate def aggregate
return Source::Aggregate.new([]) unless config.repos_dir.exist?
dirs = config.repos_dir.children.select(&:directory?) dirs = config.repos_dir.children.select(&:directory?)
Source::Aggregate.new(dirs) Source::Aggregate.new(dirs)
end end
...@@ -60,6 +61,7 @@ module Pod ...@@ -60,6 +61,7 @@ module Pod
# installation of CocoaPods. # installation of CocoaPods.
# #
def all def all
return [] unless config.repos_dir.exist?
dirs = config.repos_dir.children.select(&:directory?) dirs = config.repos_dir.children.select(&:directory?)
dirs.map { |repo| Source.new(repo) } dirs.map { |repo| Source.new(repo) }
end end
......
...@@ -43,6 +43,13 @@ module Pod ...@@ -43,6 +43,13 @@ module Pod
#--------------------------------------# #--------------------------------------#
it 'does not fail if the repos directory does not exist' do
config.stubs(:repos_dir).returns(Pathname.new('/foo/bar'))
SourcesManager.unstub(:all)
SourcesManager.aggregate.sources.should == []
SourcesManager.all.should == []
end
it 'returns all the sources' do it 'returns all the sources' do
SourcesManager.unstub(:all) SourcesManager.unstub(:all)
SourcesManager.all.map(&:name).should == %w(master test_repo) SourcesManager.all.map(&:name).should == %w(master test_repo)
......
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