Commit fc58fa00 authored by Samuel Giddins's avatar Samuel Giddins

Update for the remove of Pod::SourcesManager

parent 5dc2ed13
......@@ -22,12 +22,12 @@ gem 'json', :git => 'https://github.com/segiddins/json.git', :branch => 'seg-1.7
group :development do
cp_gem 'claide', 'CLAide'
cp_gem 'cocoapods-core', 'Core'
cp_gem 'cocoapods-core', 'Core', 'seg-source-metadata'
cp_gem 'cocoapods-deintegrate', 'cocoapods-deintegrate'
cp_gem 'cocoapods-downloader', 'cocoapods-downloader'
cp_gem 'cocoapods-plugins', 'cocoapods-plugins'
cp_gem 'cocoapods-search', 'cocoapods-search'
cp_gem 'cocoapods-stats', 'cocoapods-stats'
cp_gem 'cocoapods-stats', 'cocoapods-stats', 'seg-source-metadata'
cp_gem 'cocoapods-trunk', 'cocoapods-trunk'
cp_gem 'cocoapods-try', 'cocoapods-try'
cp_gem 'molinillo', 'Molinillo'
......
......@@ -7,8 +7,8 @@ GIT
GIT
remote: https://github.com/CocoaPods/Core.git
revision: 33d5fbcfb956cfef621bfb1b03e0880d6de4a546
branch: master
revision: ec49c1259eabe6cdf6a9f416fc5c0ca905c4ced2
branch: seg-source-metadata
specs:
cocoapods-core (1.0.0.beta.6)
activesupport (>= 4.0.2)
......@@ -63,8 +63,8 @@ GIT
GIT
remote: https://github.com/CocoaPods/cocoapods-stats.git
revision: 8569ef61bd7d52f5d6d3e91ceb299bda7b86748c
branch: master
revision: 554f95bd53dcbc53602934a25beeb6ffc2f2aee9
branch: seg-source-metadata
specs:
cocoapods-stats (1.0.0.beta.3)
......
......@@ -49,7 +49,6 @@ module Pod
autoload :Project, 'cocoapods/project'
autoload :Resolver, 'cocoapods/resolver'
autoload :Sandbox, 'cocoapods/sandbox'
autoload :SourcesManager, 'cocoapods/sources_manager'
autoload :Target, 'cocoapods/target'
autoload :Validator, 'cocoapods/validator'
......@@ -68,4 +67,6 @@ module Pod
autoload :UmbrellaHeader, 'cocoapods/generator/umbrella_header'
autoload :XCConfig, 'cocoapods/generator/xcconfig'
end
require 'cocoapods/core_overrides'
end
......@@ -93,7 +93,7 @@ module Pod
# @return [void]
#
def ensure_master_spec_repo_exists!
unless SourcesManager.master_repo_functional?
unless config.sources_manager.master_repo_functional?
Setup.new(CLAide::ARGV.new([])).run
end
end
......
......@@ -81,7 +81,7 @@ module Pod
def run
require 'yaml'
sets = SourcesManager.aggregate.all_sets
sets = config.sources_manager.aggregate.all_sets
result = {}
sets.each do |set|
begin
......@@ -117,8 +117,8 @@ module Pod
DESC
def run
SourcesManager.updated_search_index
output_pipe.puts(SourcesManager.search_index_path)
config.sources_manager.updated_search_index
output_pipe.puts(config.sources_manager.search_index_path)
end
end
......
......@@ -20,7 +20,7 @@ module Pod
def run
update_if_necessary!
sets = SourcesManager.aggregate.all_sets
sets = config.sources_manager.aggregate.all_sets
sets.each { |set| UI.pod(set, :name_and_version) }
UI.puts "\n#{sets.count} pods were found"
end
......
......@@ -40,7 +40,7 @@ module Pod
create_repos_dir
clone_repo
checkout_branch
SourcesManager.check_version_information(dir)
config.sources_manager.sources([dir.basename.to_s]).each(&:verify_compatibility!)
end
end
......
......@@ -36,19 +36,19 @@ module Pod
def run
sources = if @name
if File.exist?(@name)
[Pathname.new(@name)]
[Source.new(Pathname(@name))]
else
SourcesManager.sources([@name]).map(&:repo)
config.sources_manager.sources([@name])
end
else
SourcesManager.aggregate.sources.map(&:repo)
config.sources_manager.all
end
sources.each do |source|
SourcesManager.check_version_information(source)
UI.puts "\nLinting spec repo `#{source.basename}`\n".yellow
source.verify_compatibility!
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|
UI.print '.'
end
......
......@@ -30,7 +30,7 @@ module Pod
# - path: /Users/lascorbe/.cocoapods/repos/test
#
def run
sources = SourcesManager.all
sources = config.sources_manager.all
print_sources(sources) unless @count_only
print_count_of_sources(sources)
end
......@@ -45,7 +45,7 @@ module Pod
# @return [void]
#
def print_source(source)
if SourcesManager.git_repo?(source.repo)
if source.git?
Dir.chdir(source.repo) do
branch_name = `git name-rev --name-only HEAD 2>/dev/null`.strip
branch_name = 'unknown' if branch_name.empty?
......
......@@ -38,8 +38,8 @@ module Pod
@allow_warnings = argv.flag?('allow-warnings')
@local_only = argv.flag?('local-only')
@repo = argv.shift_argument
@source = SourcesManager.source_with_name_or_url(@repo)
@source_urls = argv.option('sources', SourcesManager.all.map(&:url).join(',')).split(',')
@source = config.sources_manager.source_with_name_or_url(@repo)
@source_urls = argv.option('sources', config.sources_manager.all.map(&:url).join(',')).split(',')
@podspec = argv.shift_argument
@use_frameworks = !argv.flag?('use-libraries')
@private = argv.flag?('private', true)
......
......@@ -19,7 +19,7 @@ module Pod
end
def run
SourcesManager.update(@name, true)
config.sources_manager.update(@name, true)
end
end
end
......
......@@ -59,7 +59,7 @@ module Pod
# @return [void]
#
def update_master_repo
SourcesManager.update('master', true)
config.sources_manager.update('master', true)
end
# Sets the repo to the master branch.
......@@ -95,7 +95,7 @@ module Pod
# @return [Pathname] the directory of the master repo.
#
def master_repo_dir
SourcesManager.master_repo_dir
config.sources_manager.master_repo_dir
end
end
end
......
......@@ -40,7 +40,7 @@ module Pod
# @return [Pathname] the absolute path or paths of the given podspec
#
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
set = sets.first
......
......@@ -130,6 +130,11 @@ module Pod
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.
#
def templates_dir
......
require 'cocoapods/sources_manager'
......@@ -216,8 +216,8 @@ module Pod
#
def update_repositories
sources.each do |source|
if SourcesManager.git_repo?(source.repo)
SourcesManager.update(source.name)
if source.git?
config.sources_manager.update(source.name)
else
UI.message "Skipping `#{source.name}` update because the repository is not a git source repository."
end
......@@ -628,7 +628,7 @@ module Pod
#
# When no explicit Podfile sources are defined, this defaults to the
# master spec repository.
# available sources ({SourcesManager.all}).
# available sources ({config.sources_manager.all}).
#
# @return [Array<Source>] the sources to be used in finding
# specifications, as specified by the {#podfile} or all sources.
......@@ -650,7 +650,7 @@ module Pod
end
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
......
......@@ -350,7 +350,7 @@ module Pod
#
def aggregate_for_dependency(dependency)
if dependency && dependency.podspec_repo
return SourcesManager.aggregate_for_dependency(dependency)
return Config.instance.sources_manager.aggregate_for_dependency(dependency)
else
@aggregate ||= Source::Aggregate.new(sources)
end
......
This diff is collapsed.
......@@ -424,6 +424,10 @@ module Pod
UI.puts message
end
def print(message)
UI.print(message)
end
def warn(message)
UI.warn message
end
......
......@@ -160,7 +160,7 @@ EOS
end
def repo_information
SourcesManager.all.map do |source|
Config.instance.sources_manager.all.map do |source|
next unless source.type == 'file system'
repo = source.repo
Dir.chdir(repo) do
......
......@@ -30,7 +30,7 @@ module Pod
# the Source URLs to use in creating a {Podfile}.
#
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)
end
......
......@@ -51,9 +51,9 @@ module Pod
describe Command::IPC::UpdateSearchIndex 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.should.include(SourcesManager.search_index_path.to_s)
out.should.include(config.sources_manager.search_index_path.to_s)
end
end
......
......@@ -18,7 +18,7 @@ module Pod
end
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' }
out = run_command('list')
......
......@@ -58,7 +58,7 @@ module Pod
lockfile.stubs(:version).returns(Version.new('1.0'))
lockfile.stubs(:pod_names).returns(%w(AFNetworking))
Command::Outdated.any_instance.stubs(:lockfile).returns(lockfile)
SourcesManager.expects(:update).once
config.sources_manager.expects(:update).once
run_command('outdated')
end
......@@ -71,7 +71,7 @@ module Pod
lockfile.stubs(:version).returns(Version.new('1.0'))
lockfile.stubs(:pod_names).returns(%w(AFNetworking))
Command::Outdated.any_instance.stubs(:lockfile).returns(lockfile)
SourcesManager.expects(:update).never
config.sources_manager.expects(:update).never
run_command('outdated', '--no-repo-update')
end
......
......@@ -29,7 +29,7 @@ module Pod
`git fetch -q`
`git branch --set-upstream-to=origin/master master`
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
end
......@@ -38,7 +38,7 @@ module Pod
repo2 = repo_clone('repo1', 'repo2')
repo_make_readme_change(repo1, 'Updated')
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|
source.name.should == 'repo2'
paths.should == ['README']
......
......@@ -267,7 +267,7 @@ module Pod
before do
@test_source = Source.new(fixture('spec-repos/test_repo'))
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?
end
......
......@@ -6,7 +6,7 @@ module Pod
extend SpecHelper::Command
before do
@set = SourcesManager.search(Dependency.new('CocoaLumberjack'))
@set = config.sources_manager.search(Dependency.new('CocoaLumberjack'))
end
it 'presents the name, version, description, homepage and source of a specification set' do
......@@ -53,14 +53,14 @@ module Pod
end
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)
output = UI.output
output.should.include? 'RestKit/Network'
end
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)
output = UI.output
output.should.include? "RestKit #{@set.versions.first}"
......
......@@ -27,7 +27,7 @@ module Bacon
SpecHelper.temporary_directory.mkpath
# 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)
end
......
......@@ -6,7 +6,7 @@ module Pod
before do
repos = [Source.new(fixture('spec-repos/test_repo')), MasterSource.new(fixture('spec-repos/master'))]
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)
@podfile = Pod::Podfile.new do
......@@ -66,8 +66,8 @@ module Pod
#--------------------------------------#
it 'does not update unused sources' do
@analyzer.stubs(:sources).returns(SourcesManager.master)
SourcesManager.expects(:update).once.with('master')
@analyzer.stubs(:sources).returns(config.sources_manager.master)
config.sources_manager.expects(:update).once.with('master')
@analyzer.update_repositories
end
......@@ -78,7 +78,7 @@ module Pod
end
config.verbose = true
SourcesManager.expects(:update).never
config.sources_manager.expects(:update).never
analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil)
analyzer.update_repositories
end
......@@ -98,7 +98,7 @@ module Pod
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.stubs(:sources).returns([source])
analyzer.update_repositories
......@@ -121,9 +121,9 @@ module Pod
source = mock
source.stubs(:name).returns('repo_2')
source.stubs(:repo).returns('/repo/cache/path')
SourcesManager.expects(:find_or_create_source_with_url).with(repo_url).returns(source)
SourcesManager.stubs(:git_repo?).with(source.repo).returns(true)
SourcesManager.expects(:update).once.with(source.name)
config.sources_manager.expects(:find_or_create_source_with_url).with(repo_url).returns(source)
source.stubs(:git?).returns(true)
config.sources_manager.expects(:update).once.with(source.name)
analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil)
analyzer.update_repositories
......@@ -321,7 +321,7 @@ module Pod
before do
repos = [Source.new(fixture('spec-repos/test_repo'))]
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)
end
......@@ -649,7 +649,7 @@ module Pod
pod 'JSONKit', '1.4'
end
@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)
end
end
......
......@@ -375,13 +375,13 @@ module Pod
describe 'Dependencies Resolution' do
describe 'updating spec repos' do
it 'does not updates the repositories by default' do
SourcesManager.expects(:update).never
config.sources_manager.expects(:update).never
@installer.send(:resolve_dependencies)
end
it 'updates the repositories if that was requested' do
@installer.repo_update = true
SourcesManager.expects(:update).once
config.sources_manager.expects(:update).once
@installer.send(:resolve_dependencies)
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