Commit 6d77bb48 authored by Samuel Giddins's avatar Samuel Giddins

Merge pull request #5106 from CocoaPods/seg-source-metadata

Update for the removal of Pod::SourcesManager
parents 9df63513 706c80ce
...@@ -13,10 +13,15 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -13,10 +13,15 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Samuel Giddins](https://github.com/segiddins) [Samuel Giddins](https://github.com/segiddins)
[CocoaPods#5113](https://github.com/CocoaPods/CocoaPods/issues/5113) [CocoaPods#5113](https://github.com/CocoaPods/CocoaPods/issues/5113)
* Improved error messages, around the 1.0 changes when we cannot find a dependency * Improved the error message when a matching spec cannot be found,
in local sources, noting that CP > 1 doesnt run `pod repo update` mentioning that now `pod repo update` is not implicit when running `pod
install`.
[Orta Therox](https://github.com/orta) [Orta Therox](https://github.com/orta)
[CocoaPods#5135](https://github.com/CocoaPods/CocoaPods/issues/5135) [#5135](https://github.com/CocoaPods/CocoaPods/issues/5135)
* Add support for sharded specs directories.
[Samuel Giddins](https://github.com/segiddins)
[#5002](https://github.com/CocoaPods/CocoaPods/issues/5002)
##### Bug Fixes ##### Bug Fixes
......
...@@ -7,7 +7,7 @@ GIT ...@@ -7,7 +7,7 @@ GIT
GIT GIT
remote: https://github.com/CocoaPods/Core.git remote: https://github.com/CocoaPods/Core.git
revision: 33d5fbcfb956cfef621bfb1b03e0880d6de4a546 revision: 83d171f2b42b22bc84b6b3d1512aa99213ad163d
branch: master branch: master
specs: specs:
cocoapods-core (1.0.0.beta.6) cocoapods-core (1.0.0.beta.6)
...@@ -63,7 +63,7 @@ GIT ...@@ -63,7 +63,7 @@ GIT
GIT GIT
remote: https://github.com/CocoaPods/cocoapods-stats.git remote: https://github.com/CocoaPods/cocoapods-stats.git
revision: 8569ef61bd7d52f5d6d3e91ceb299bda7b86748c revision: fda6a8950aa49e10033002c9792da9f7fcd0e511
branch: master branch: master
specs: specs:
cocoapods-stats (1.0.0.beta.3) cocoapods-stats (1.0.0.beta.3)
......
...@@ -49,7 +49,6 @@ module Pod ...@@ -49,7 +49,6 @@ module Pod
autoload :Project, 'cocoapods/project' autoload :Project, 'cocoapods/project'
autoload :Resolver, 'cocoapods/resolver' autoload :Resolver, 'cocoapods/resolver'
autoload :Sandbox, 'cocoapods/sandbox' autoload :Sandbox, 'cocoapods/sandbox'
autoload :SourcesManager, 'cocoapods/sources_manager'
autoload :Target, 'cocoapods/target' autoload :Target, 'cocoapods/target'
autoload :Validator, 'cocoapods/validator' autoload :Validator, 'cocoapods/validator'
...@@ -68,4 +67,6 @@ module Pod ...@@ -68,4 +67,6 @@ module Pod
autoload :UmbrellaHeader, 'cocoapods/generator/umbrella_header' autoload :UmbrellaHeader, 'cocoapods/generator/umbrella_header'
autoload :XCConfig, 'cocoapods/generator/xcconfig' autoload :XCConfig, 'cocoapods/generator/xcconfig'
end end
require 'cocoapods/core_overrides'
end end
...@@ -93,7 +93,7 @@ module Pod ...@@ -93,7 +93,7 @@ module Pod
# @return [void] # @return [void]
# #
def ensure_master_spec_repo_exists! def ensure_master_spec_repo_exists!
unless SourcesManager.master_repo_functional? unless config.sources_manager.master_repo_functional?
Setup.new(CLAide::ARGV.new([])).run Setup.new(CLAide::ARGV.new([])).run
end end
end end
......
...@@ -81,7 +81,7 @@ module Pod ...@@ -81,7 +81,7 @@ module Pod
def run def run
require 'yaml' require 'yaml'
sets = SourcesManager.aggregate.all_sets sets = config.sources_manager.aggregate.all_sets
result = {} result = {}
sets.each do |set| sets.each do |set|
begin begin
...@@ -117,8 +117,8 @@ module Pod ...@@ -117,8 +117,8 @@ module Pod
DESC DESC
def run def run
SourcesManager.updated_search_index config.sources_manager.updated_search_index
output_pipe.puts(SourcesManager.search_index_path) output_pipe.puts(config.sources_manager.search_index_path)
end end
end end
......
...@@ -20,7 +20,7 @@ module Pod ...@@ -20,7 +20,7 @@ module Pod
def run def run
update_if_necessary! update_if_necessary!
sets = SourcesManager.aggregate.all_sets sets = config.sources_manager.aggregate.all_sets
sets.each { |set| UI.pod(set, :name_and_version) } sets.each { |set| UI.pod(set, :name_and_version) }
UI.puts "\n#{sets.count} pods were found" UI.puts "\n#{sets.count} pods were found"
end end
......
...@@ -40,7 +40,7 @@ module Pod ...@@ -40,7 +40,7 @@ module Pod
create_repos_dir create_repos_dir
clone_repo clone_repo
checkout_branch checkout_branch
SourcesManager.check_version_information(dir) config.sources_manager.sources([dir.basename.to_s]).each(&:verify_compatibility!)
end end
end end
......
...@@ -36,19 +36,19 @@ module Pod ...@@ -36,19 +36,19 @@ module Pod
def run def run
sources = if @name sources = if @name
if File.exist?(@name) if File.exist?(@name)
[Pathname.new(@name)] [Source.new(Pathname(@name))]
else else
SourcesManager.sources([@name]).map(&:repo) config.sources_manager.sources([@name])
end end
else else
SourcesManager.aggregate.sources.map(&:repo) config.sources_manager.all
end end
sources.each do |source| sources.each do |source|
SourcesManager.check_version_information(source) source.verify_compatibility!
UI.puts "\nLinting spec repo `#{source.basename}`\n".yellow UI.puts "\nLinting spec repo `#{source.name}`\n".yellow
validator = Source::HealthReporter.new(source) validator = Source::HealthReporter.new(source.repo)
validator.pre_check do |_name, _version| validator.pre_check do |_name, _version|
UI.print '.' UI.print '.'
end end
......
...@@ -30,7 +30,7 @@ module Pod ...@@ -30,7 +30,7 @@ module Pod
# - path: /Users/lascorbe/.cocoapods/repos/test # - path: /Users/lascorbe/.cocoapods/repos/test
# #
def run def run
sources = SourcesManager.all sources = config.sources_manager.all
print_sources(sources) unless @count_only print_sources(sources) unless @count_only
print_count_of_sources(sources) print_count_of_sources(sources)
end end
...@@ -45,7 +45,7 @@ module Pod ...@@ -45,7 +45,7 @@ module Pod
# @return [void] # @return [void]
# #
def print_source(source) def print_source(source)
if SourcesManager.git_repo?(source.repo) if source.git?
Dir.chdir(source.repo) do Dir.chdir(source.repo) do
branch_name = `git name-rev --name-only HEAD 2>/dev/null`.strip branch_name = `git name-rev --name-only HEAD 2>/dev/null`.strip
branch_name = 'unknown' if branch_name.empty? branch_name = 'unknown' if branch_name.empty?
......
...@@ -38,7 +38,8 @@ module Pod ...@@ -38,7 +38,8 @@ module Pod
@allow_warnings = argv.flag?('allow-warnings') @allow_warnings = argv.flag?('allow-warnings')
@local_only = argv.flag?('local-only') @local_only = argv.flag?('local-only')
@repo = argv.shift_argument @repo = argv.shift_argument
@source_urls = argv.option('sources', SourcesManager.all.map(&:url).join(',')).split(',') @source = config.sources_manager.sources([@repo]).first
@source_urls = argv.option('sources', config.sources_manager.all.map(&:url).join(',')).split(',')
@podspec = argv.shift_argument @podspec = argv.shift_argument
@use_frameworks = !argv.flag?('use-libraries') @use_frameworks = !argv.flag?('use-libraries')
@private = argv.flag?('private', true) @private = argv.flag?('private', true)
...@@ -48,8 +49,14 @@ module Pod ...@@ -48,8 +49,14 @@ module Pod
end end
def validate! def validate!
super
help! 'A spec-repo name is required.' unless @repo help! 'A spec-repo name is required.' unless @repo
unless @source.repo.directory?
raise Informative,
"Unable to find the `#{@repo}` repo. " \
'If it has not yet been cloned, add it via `pod repo add`.'
end
super
end end
def run def run
...@@ -161,12 +168,12 @@ module Pod ...@@ -161,12 +168,12 @@ module Pod
UI.puts "\nAdding the #{'spec'.pluralize(count)} to the `#{@repo}' repo\n".yellow UI.puts "\nAdding the #{'spec'.pluralize(count)} to the `#{@repo}' repo\n".yellow
podspec_files.each do |spec_file| podspec_files.each do |spec_file|
spec = Pod::Specification.from_file(spec_file) spec = Pod::Specification.from_file(spec_file)
output_path = File.join(repo_dir, spec.name, spec.version.to_s) output_path = @source.pod_path(spec.name) + spec.version.to_s
if @message && !@message.empty? if @message && !@message.empty?
message = @message message = @message
elsif Pathname.new(output_path).exist? elsif output_path.exist?
message = "[Fix] #{spec}" message = "[Fix] #{spec}"
elsif Pathname.new(File.join(repo_dir, spec.name)).exist? elsif output_path.dirname.directory?
message = "[Update] #{spec}" message = "[Update] #{spec}"
else else
message = "[Add] #{spec}" message = "[Add] #{spec}"
...@@ -205,16 +212,7 @@ module Pod ...@@ -205,16 +212,7 @@ module Pod
# @return [Pathname] The directory of the repository. # @return [Pathname] The directory of the repository.
# #
def repo_dir def repo_dir
specs_dir = Pathname.new(File.join(config.repos_dir, @repo, 'Specs')) @source.specs_dir
dir = config.repos_dir + @repo
if specs_dir.exist?
dir = specs_dir
elsif dir.exist?
dir
else
raise Informative, "`#{@repo}` repo not found either in #{specs_dir} or #{dir}"
end
dir
end end
# @return [Array<Pathname>] The path of the specifications to push. # @return [Array<Pathname>] The path of the specifications to push.
......
...@@ -19,7 +19,7 @@ module Pod ...@@ -19,7 +19,7 @@ module Pod
end end
def run def run
SourcesManager.update(@name, true) config.sources_manager.update(@name, true)
end end
end end
end end
......
...@@ -59,7 +59,7 @@ module Pod ...@@ -59,7 +59,7 @@ module Pod
# @return [void] # @return [void]
# #
def update_master_repo def update_master_repo
SourcesManager.update('master', true) config.sources_manager.update('master', true)
end end
# Sets the repo to the master branch. # Sets the repo to the master branch.
...@@ -95,7 +95,7 @@ module Pod ...@@ -95,7 +95,7 @@ module Pod
# @return [Pathname] the directory of the master repo. # @return [Pathname] the directory of the master repo.
# #
def master_repo_dir def master_repo_dir
SourcesManager.master_repo_dir config.sources_manager.master_repo_dir
end end
end end
end end
......
...@@ -40,7 +40,7 @@ module Pod ...@@ -40,7 +40,7 @@ module Pod
# @return [Pathname] the absolute path or paths of the given podspec # @return [Pathname] the absolute path or paths of the given podspec
# #
def get_path_of_spec(spec, show_all = false) def get_path_of_spec(spec, show_all = false)
sets = SourcesManager.search_by_name(spec) sets = config.sources_manager.search_by_name(spec)
if sets.count == 1 if sets.count == 1
set = sets.first set = sets.first
......
...@@ -130,6 +130,11 @@ module Pod ...@@ -130,6 +130,11 @@ module Pod
attr_writer :repos_dir attr_writer :repos_dir
def sources_manager
return @sources_manager if @sources_manager && @sources_manager.repos_dir == repos_dir
@sources_manager = Source::Manager.new(repos_dir)
end
# @return [Pathname] the directory where the CocoaPods templates are stored. # @return [Pathname] the directory where the CocoaPods templates are stored.
# #
def templates_dir def templates_dir
......
require 'cocoapods/sources_manager'
...@@ -216,8 +216,8 @@ module Pod ...@@ -216,8 +216,8 @@ module Pod
# #
def update_repositories def update_repositories
sources.each do |source| sources.each do |source|
if SourcesManager.git_repo?(source.repo) if source.git?
SourcesManager.update(source.name) config.sources_manager.update(source.name)
else else
UI.message "Skipping `#{source.name}` update because the repository is not a git source repository." UI.message "Skipping `#{source.name}` update because the repository is not a git source repository."
end end
...@@ -628,7 +628,7 @@ module Pod ...@@ -628,7 +628,7 @@ module Pod
# #
# When no explicit Podfile sources are defined, this defaults to the # When no explicit Podfile sources are defined, this defaults to the
# master spec repository. # master spec repository.
# available sources ({SourcesManager.all}). # available sources ({config.sources_manager.all}).
# #
# @return [Array<Source>] the sources to be used in finding # @return [Array<Source>] the sources to be used in finding
# specifications, as specified by the {#podfile} or all sources. # specifications, as specified by the {#podfile} or all sources.
...@@ -650,7 +650,7 @@ module Pod ...@@ -650,7 +650,7 @@ module Pod
end end
sources.uniq.map do |source_url| sources.uniq.map do |source_url|
SourcesManager.find_or_create_source_with_url(source_url) config.sources_manager.find_or_create_source_with_url(source_url)
end end
end end
end end
......
...@@ -350,7 +350,7 @@ module Pod ...@@ -350,7 +350,7 @@ module Pod
# #
def aggregate_for_dependency(dependency) def aggregate_for_dependency(dependency)
if dependency && dependency.podspec_repo if dependency && dependency.podspec_repo
return SourcesManager.aggregate_for_dependency(dependency) return Config.instance.sources_manager.aggregate_for_dependency(dependency)
else else
@aggregate ||= Source::Aggregate.new(sources) @aggregate ||= Source::Aggregate.new(sources)
end end
......
This diff is collapsed.
...@@ -424,6 +424,10 @@ module Pod ...@@ -424,6 +424,10 @@ module Pod
UI.puts message UI.puts message
end end
def print(message)
UI.print(message)
end
def warn(message) def warn(message)
UI.warn message UI.warn message
end end
......
...@@ -160,7 +160,7 @@ EOS ...@@ -160,7 +160,7 @@ EOS
end end
def repo_information def repo_information
SourcesManager.all.map do |source| Config.instance.sources_manager.all.map do |source|
next unless source.type == 'file system' next unless source.type == 'file system'
repo = source.repo repo = source.repo
Dir.chdir(repo) do Dir.chdir(repo) do
......
...@@ -30,7 +30,7 @@ module Pod ...@@ -30,7 +30,7 @@ module Pod
# the Source URLs to use in creating a {Podfile}. # the Source URLs to use in creating a {Podfile}.
# #
def initialize(spec_or_path, source_urls) def initialize(spec_or_path, source_urls)
@source_urls = source_urls.map { |url| SourcesManager.source_with_name_or_url(url) }.map(&:url) @source_urls = source_urls.map { |url| config.sources_manager.source_with_name_or_url(url) }.map(&:url)
@linter = Specification::Linter.new(spec_or_path) @linter = Specification::Linter.new(spec_or_path)
end end
......
...@@ -51,9 +51,9 @@ module Pod ...@@ -51,9 +51,9 @@ module Pod
describe Command::IPC::UpdateSearchIndex do describe Command::IPC::UpdateSearchIndex do
it 'updates the search index and prints its path to STDOUT' do it 'updates the search index and prints its path to STDOUT' do
SourcesManager.expects(:updated_search_index) config.sources_manager.expects(:updated_search_index)
out = run_command('ipc', 'update-search-index') out = run_command('ipc', 'update-search-index')
out.should.include(SourcesManager.search_index_path.to_s) out.should.include(config.sources_manager.search_index_path.to_s)
end end
end end
......
...@@ -18,7 +18,7 @@ module Pod ...@@ -18,7 +18,7 @@ module Pod
end end
it 'presents the known pods with versions' do it 'presents the known pods with versions' do
sets = SourcesManager.aggregate.all_sets sets = config.sources_manager.aggregate.all_sets
jsonkit_set = sets.find { |s| s.name == 'JSONKit' } jsonkit_set = sets.find { |s| s.name == 'JSONKit' }
out = run_command('list') out = run_command('list')
......
...@@ -58,7 +58,7 @@ module Pod ...@@ -58,7 +58,7 @@ module Pod
lockfile.stubs(:version).returns(Version.new('1.0')) lockfile.stubs(:version).returns(Version.new('1.0'))
lockfile.stubs(:pod_names).returns(%w(AFNetworking)) lockfile.stubs(:pod_names).returns(%w(AFNetworking))
Command::Outdated.any_instance.stubs(:lockfile).returns(lockfile) Command::Outdated.any_instance.stubs(:lockfile).returns(lockfile)
SourcesManager.expects(:update).once config.sources_manager.expects(:update).once
run_command('outdated') run_command('outdated')
end end
...@@ -71,7 +71,7 @@ module Pod ...@@ -71,7 +71,7 @@ module Pod
lockfile.stubs(:version).returns(Version.new('1.0')) lockfile.stubs(:version).returns(Version.new('1.0'))
lockfile.stubs(:pod_names).returns(%w(AFNetworking)) lockfile.stubs(:pod_names).returns(%w(AFNetworking))
Command::Outdated.any_instance.stubs(:lockfile).returns(lockfile) Command::Outdated.any_instance.stubs(:lockfile).returns(lockfile)
SourcesManager.expects(:update).never config.sources_manager.expects(:update).never
run_command('outdated', '--no-repo-update') run_command('outdated', '--no-repo-update')
end end
......
...@@ -12,10 +12,8 @@ module Pod ...@@ -12,10 +12,8 @@ module Pod
it "complains if it can't find the repo" do it "complains if it can't find the repo" do
Dir.chdir(fixture('banana-lib')) do Dir.chdir(fixture('banana-lib')) do
cmd = command('repo', 'push', 'missing_repo') cmd = command('repo', 'push', 'missing_repo')
cmd.expects(:check_if_master_repo) e = lambda { cmd.validate! }.should.raise Informative
cmd.expects(:validate_podspec_files).returns(true) e.message.should.match(/Unable to find the `missing_repo` repo/)
e = lambda { cmd.run }.should.raise Informative
e.message.should.match(/repo not found/)
end end
end end
......
...@@ -29,7 +29,7 @@ module Pod ...@@ -29,7 +29,7 @@ module Pod
`git fetch -q` `git fetch -q`
`git branch --set-upstream-to=origin/master master` `git branch --set-upstream-to=origin/master master`
end end
SourcesManager.expects(:update_search_index_if_needed_in_background).with({}).returns(nil) config.sources_manager.expects(:update_search_index_if_needed_in_background).with({}).returns(nil)
lambda { command('repo', 'update').run }.should.not.raise lambda { command('repo', 'update').run }.should.not.raise
end end
...@@ -38,7 +38,7 @@ module Pod ...@@ -38,7 +38,7 @@ module Pod
repo2 = repo_clone('repo1', 'repo2') repo2 = repo_clone('repo1', 'repo2')
repo_make_readme_change(repo1, 'Updated') repo_make_readme_change(repo1, 'Updated')
Dir.chdir(repo1) { `git commit -a -m "Update"` } Dir.chdir(repo1) { `git commit -a -m "Update"` }
SourcesManager.expects(:update_search_index_if_needed_in_background).with do |value| config.sources_manager.expects(:update_search_index_if_needed_in_background).with do |value|
value.each_pair do |source, paths| value.each_pair do |source, paths|
source.name.should == 'repo2' source.name.should == 'repo2'
paths.should == ['README'] paths.should == ['README']
......
...@@ -267,7 +267,7 @@ module Pod ...@@ -267,7 +267,7 @@ module Pod
before do before do
@test_source = Source.new(fixture('spec-repos/test_repo')) @test_source = Source.new(fixture('spec-repos/test_repo'))
Source::Aggregate.any_instance.stubs(:sources).returns([@test_source]) Source::Aggregate.any_instance.stubs(:sources).returns([@test_source])
SourcesManager.updated_search_index = nil config.sources_manager.updated_search_index = nil
yield if block_given? yield if block_given?
end end
......
...@@ -6,7 +6,7 @@ module Pod ...@@ -6,7 +6,7 @@ module Pod
extend SpecHelper::Command extend SpecHelper::Command
before do before do
@set = SourcesManager.search(Dependency.new('CocoaLumberjack')) @set = config.sources_manager.search(Dependency.new('CocoaLumberjack'))
end end
it 'presents the name, version, description, homepage and source of a specification set' do it 'presents the name, version, description, homepage and source of a specification set' do
...@@ -53,14 +53,14 @@ module Pod ...@@ -53,14 +53,14 @@ module Pod
end end
it 'should print at least one subspec' do it 'should print at least one subspec' do
@set = SourcesManager.search(Dependency.new('RestKit')) @set = config.sources_manager.search(Dependency.new('RestKit'))
UI.pod(@set) UI.pod(@set)
output = UI.output output = UI.output
output.should.include? 'RestKit/Network' output.should.include? 'RestKit/Network'
end end
it 'presents only name and version of a specification set in :name_and_version mode' do it 'presents only name and version of a specification set in :name_and_version mode' do
@set = SourcesManager.search_by_name('RestKit').first @set = config.sources_manager.search_by_name('RestKit').first
UI.pod(@set, :name_and_version) UI.pod(@set, :name_and_version)
output = UI.output output = UI.output
output.should.include? "RestKit #{@set.versions.first}" output.should.include? "RestKit #{@set.versions.first}"
......
...@@ -27,7 +27,7 @@ module Bacon ...@@ -27,7 +27,7 @@ module Bacon
SpecHelper.temporary_directory.mkpath SpecHelper.temporary_directory.mkpath
# TODO # TODO
::Pod::SourcesManager.stubs(:search_index_path).returns(temporary_directory + 'search_index.json') ::Pod::Source::Manager.any_instance.stubs(:search_index_path).returns(temporary_directory + 'search_index.json')
old_run_requirement.bind(self).call(description, spec) old_run_requirement.bind(self).call(description, spec)
end end
......
...@@ -6,7 +6,7 @@ module Pod ...@@ -6,7 +6,7 @@ module Pod
before do before do
repos = [Source.new(fixture('spec-repos/test_repo')), MasterSource.new(fixture('spec-repos/master'))] repos = [Source.new(fixture('spec-repos/test_repo')), MasterSource.new(fixture('spec-repos/master'))]
aggregate = Pod::Source::Aggregate.new(repos) aggregate = Pod::Source::Aggregate.new(repos)
Pod::SourcesManager.stubs(:aggregate).returns(aggregate) config.sources_manager.stubs(:aggregate).returns(aggregate)
aggregate.sources.first.stubs(:url).returns(SpecHelper.test_repo_url) aggregate.sources.first.stubs(:url).returns(SpecHelper.test_repo_url)
@podfile = Pod::Podfile.new do @podfile = Pod::Podfile.new do
...@@ -66,8 +66,8 @@ module Pod ...@@ -66,8 +66,8 @@ module Pod
#--------------------------------------# #--------------------------------------#
it 'does not update unused sources' do it 'does not update unused sources' do
@analyzer.stubs(:sources).returns(SourcesManager.master) @analyzer.stubs(:sources).returns(config.sources_manager.master)
SourcesManager.expects(:update).once.with('master') config.sources_manager.expects(:update).once.with('master')
@analyzer.update_repositories @analyzer.update_repositories
end end
...@@ -78,7 +78,7 @@ module Pod ...@@ -78,7 +78,7 @@ module Pod
end end
config.verbose = true config.verbose = true
SourcesManager.expects(:update).never config.sources_manager.expects(:update).never
analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil) analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil)
analyzer.update_repositories analyzer.update_repositories
end end
...@@ -98,7 +98,7 @@ module Pod ...@@ -98,7 +98,7 @@ module Pod
source = Source.new(non_git_repo) source = Source.new(non_git_repo)
SourcesManager.expects(:update).never config.sources_manager.expects(:update).never
analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil) analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil)
analyzer.stubs(:sources).returns([source]) analyzer.stubs(:sources).returns([source])
analyzer.update_repositories analyzer.update_repositories
...@@ -121,9 +121,9 @@ module Pod ...@@ -121,9 +121,9 @@ module Pod
source = mock source = mock
source.stubs(:name).returns('repo_2') source.stubs(:name).returns('repo_2')
source.stubs(:repo).returns('/repo/cache/path') source.stubs(:repo).returns('/repo/cache/path')
SourcesManager.expects(:find_or_create_source_with_url).with(repo_url).returns(source) config.sources_manager.expects(:find_or_create_source_with_url).with(repo_url).returns(source)
SourcesManager.stubs(:git_repo?).with(source.repo).returns(true) source.stubs(:git?).returns(true)
SourcesManager.expects(:update).once.with(source.name) config.sources_manager.expects(:update).once.with(source.name)
analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil) analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil)
analyzer.update_repositories analyzer.update_repositories
...@@ -321,7 +321,7 @@ module Pod ...@@ -321,7 +321,7 @@ module Pod
before do before do
repos = [Source.new(fixture('spec-repos/test_repo'))] repos = [Source.new(fixture('spec-repos/test_repo'))]
aggregate = Pod::Source::Aggregate.new(repos) aggregate = Pod::Source::Aggregate.new(repos)
Pod::SourcesManager.stubs(:aggregate).returns(aggregate) config.sources_manager.stubs(:aggregate).returns(aggregate)
aggregate.sources.first.stubs(:url).returns(SpecHelper.test_repo_url) aggregate.sources.first.stubs(:url).returns(SpecHelper.test_repo_url)
end end
...@@ -649,7 +649,7 @@ module Pod ...@@ -649,7 +649,7 @@ module Pod
pod 'JSONKit', '1.4' pod 'JSONKit', '1.4'
end end
@analyzer.instance_variable_set(:@podfile, podfile) @analyzer.instance_variable_set(:@podfile, podfile)
SourcesManager.expects(:find_or_create_source_with_url).once config.sources_manager.expects(:find_or_create_source_with_url).once
@analyzer.send(:sources) @analyzer.send(:sources)
end end
end end
......
...@@ -375,13 +375,13 @@ module Pod ...@@ -375,13 +375,13 @@ module Pod
describe 'Dependencies Resolution' do describe 'Dependencies Resolution' do
describe 'updating spec repos' do describe 'updating spec repos' do
it 'does not updates the repositories by default' do it 'does not updates the repositories by default' do
SourcesManager.expects(:update).never config.sources_manager.expects(:update).never
@installer.send(:resolve_dependencies) @installer.send(:resolve_dependencies)
end end
it 'updates the repositories if that was requested' do it 'updates the repositories if that was requested' do
@installer.repo_update = true @installer.repo_update = true
SourcesManager.expects(:update).once config.sources_manager.expects(:update).once
@installer.send(:resolve_dependencies) @installer.send(:resolve_dependencies)
end end
end end
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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