Commit 33eef8d1 authored by Samuel E. Giddins's avatar Samuel E. Giddins

[Outdated] Update podfile sources

parent a286e377
...@@ -13,7 +13,7 @@ module Pod ...@@ -13,7 +13,7 @@ module Pod
end end
def initialize(argv) def initialize(argv)
config.skip_repo_update = argv.flag?('repo-update', config.skip_repo_update) config.skip_repo_update = !argv.flag?('repo-update', !config.skip_repo_update)
super super
end end
...@@ -96,6 +96,7 @@ module Pod ...@@ -96,6 +96,7 @@ module Pod
def spec_sets def spec_sets
@spec_sets ||= begin @spec_sets ||= begin
analyzer.send(:update_repositories_if_needed)
aggregate = Source::Aggregate.new(analyzer.sources.map(&:repo)) aggregate = Source::Aggregate.new(analyzer.sources.map(&:repo))
installed_pods.map do |pod_name| installed_pods.map do |pod_name|
aggregate.search(Dependency.new(pod_name)) aggregate.search(Dependency.new(pod_name))
......
...@@ -6,6 +6,7 @@ module Pod ...@@ -6,6 +6,7 @@ module Pod
before do before do
Command::Outdated.any_instance.stubs(:unlocked_pods).returns([]) Command::Outdated.any_instance.stubs(:unlocked_pods).returns([])
config.stubs(:skip_repo_update?).returns(true)
end end
it 'tells the user that no Podfile was found in the project dir' do it 'tells the user that no Podfile was found in the project dir' do
...@@ -47,5 +48,34 @@ module Pod ...@@ -47,5 +48,34 @@ module Pod
run_command('outdated', '--no-repo-update') run_command('outdated', '--no-repo-update')
UI.output.should.include('in favor of BlocksKit') UI.output.should.include('in favor of BlocksKit')
end end
it "updates the Podfile's sources by default" do
config.stubs(:podfile).returns Podfile.new do
source 'https://github.com/CocoaPods/Specs.git'
pod 'AFNetworking'
end
config.stubs(:skip_repo_update?).returns(false)
lockfile = mock
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
run_command('outdated')
end
it "doesn't updates the Podfile's sources with --no-repo-update" do
config.stubs(:podfile).returns Podfile.new do
source 'https://github.com/CocoaPods/Specs.git'
pod 'AFNetworking'
end
config.unstub(:skip_repo_update?)
config.skip_repo_update = false
lockfile = mock
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
run_command('outdated', '--no-repo-update')
end
end end
end end
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