Commit 8cfec5a6 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #3139 from CocoaPods/seg-update-outdated

[Outdated] Update podfile sources
parents a286e377 ea68eff6
......@@ -24,6 +24,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Seán Labastille](https://github.com/flufff42)
[#3082](https://github.com/CocoaPods/CocoaPods/issues/3082)
* Correctly update sources when calling `pod outdated`, and also respect the
`--[no-]repo-update` flag.
[Samuel Giddins](https://github.com/segiddins)
[#3137](https://github.com/CocoaPods/CocoaPods/issues/3137)
## 0.36.0.beta.2
......
......@@ -13,7 +13,7 @@ module Pod
end
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
end
......@@ -96,6 +96,7 @@ module Pod
def spec_sets
@spec_sets ||= begin
analyzer.send(:update_repositories_if_needed)
aggregate = Source::Aggregate.new(analyzer.sources.map(&:repo))
installed_pods.map do |pod_name|
aggregate.search(Dependency.new(pod_name))
......
......@@ -6,6 +6,7 @@ module Pod
before do
Command::Outdated.any_instance.stubs(:unlocked_pods).returns([])
config.stubs(:skip_repo_update?).returns(true)
end
it 'tells the user that no Podfile was found in the project dir' do
......@@ -47,5 +48,34 @@ module Pod
run_command('outdated', '--no-repo-update')
UI.output.should.include('in favor of BlocksKit')
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
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