Commit 16392d46 authored by Marius Rackwitz's avatar Marius Rackwitz

Expose Installer#repo_update instead Config#skip_repo_update

parent 99d2ecf6
...@@ -30,10 +30,9 @@ module Pod ...@@ -30,10 +30,9 @@ module Pod
end end
def run def run
config.skip_repo_update = !repo_update?(:default => false)
verify_podfile_exists! verify_podfile_exists!
installer = installer_for_config installer = installer_for_config
installer.repo_update = repo_update?(:default => false)
installer.update = false installer.update = false
installer.install! installer.install!
end end
......
...@@ -45,11 +45,10 @@ module Pod ...@@ -45,11 +45,10 @@ module Pod
end end
def run def run
config.skip_repo_update = !repo_update?(:default => true)
verify_podfile_exists! verify_podfile_exists!
installer = installer_for_config installer = installer_for_config
installer.repo_update = repo_update?(:default => true)
if @pods if @pods
verify_lockfile_exists! verify_lockfile_exists!
verify_pods_are_installed! verify_pods_are_installed!
......
...@@ -14,7 +14,6 @@ module Pod ...@@ -14,7 +14,6 @@ module Pod
DEFAULTS = { DEFAULTS = {
:verbose => false, :verbose => false,
:silent => false, :silent => false,
:skip_repo_update => false,
:skip_download_cache => !ENV['COCOAPODS_SKIP_CACHE'].nil?, :skip_download_cache => !ENV['COCOAPODS_SKIP_CACHE'].nil?,
:new_version_message => ENV['COCOAPODS_SKIP_UPDATE_MESSAGE'].nil?, :new_version_message => ENV['COCOAPODS_SKIP_UPDATE_MESSAGE'].nil?,
...@@ -69,11 +68,6 @@ module Pod ...@@ -69,11 +68,6 @@ module Pod
# @!group Installation # @!group Installation
# @return [Bool] Whether the installer should skip the repos update.
#
attr_accessor :skip_repo_update
alias_method :skip_repo_update?, :skip_repo_update
# @return [Bool] Whether the installer should skip the download cache. # @return [Bool] Whether the installer should skip the download cache.
# #
attr_accessor :skip_download_cache attr_accessor :skip_download_cache
......
...@@ -84,6 +84,11 @@ module Pod ...@@ -84,6 +84,11 @@ module Pod
# #
attr_accessor :update attr_accessor :update
# @return [Bool] Whether the spec repos should be updated.
#
attr_accessor :repo_update
alias_method :repo_update?, :repo_update
# @return [Boolean] Whether default plugins should be used during # @return [Boolean] Whether default plugins should be used during
# installation. Defaults to true. # installation. Defaults to true.
# #
...@@ -140,7 +145,7 @@ module Pod ...@@ -140,7 +145,7 @@ module Pod
UI.section 'Updating local specs repositories' do UI.section 'Updating local specs repositories' do
analyzer.update_repositories analyzer.update_repositories
end unless config.skip_repo_update? end if repo_update?
UI.section 'Analyzing dependencies' do UI.section 'Analyzing dependencies' do
analyze(analyzer) analyze(analyzer)
......
...@@ -349,7 +349,6 @@ module Pod ...@@ -349,7 +349,6 @@ module Pod
@original_config = Config.instance.clone @original_config = Config.instance.clone
config.installation_root = validation_dir config.installation_root = validation_dir
config.silent = !config.verbose config.silent = !config.verbose
config.skip_repo_update = true
end end
def tear_down_validation_environment def tear_down_validation_environment
......
...@@ -7,17 +7,24 @@ module Pod ...@@ -7,17 +7,24 @@ module Pod
exception.message.should.include "No `Podfile' found in the project directory." exception.message.should.include "No `Podfile' found in the project directory."
end end
it "doesn't update the spec repos by default" do describe 'updates of the spec repos' do
config.with_changes(:skip_repo_update => nil) do before do
Pod::Command.parse(['install']) file = temporary_directory + 'Podfile'
config.skip_repo_update.should.be.true File.open(file, 'w') do |f|
f.puts('platform :ios')
f.puts('pod "Reachability"')
end
Installer.any_instance.expects(:install!)
end
it "doesn't update the spec repos by default" do
Installer.any_instance.expects(:repo_update=).with(false)
run_command('install')
end end
end
it 'updates the spec repos if that option was given' do it 'updates the spec repos if that option was given' do
config.with_changes(:skip_repo_update => nil) do Installer.any_instance.expects(:repo_update=).with(true)
Pod::Command.parse(['install', '--repo-update']) run_command('install', '--repo-update')
config.skip_repo_update.should.be.false
end end
end end
end end
......
...@@ -6,7 +6,6 @@ module Pod ...@@ -6,7 +6,6 @@ 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
...@@ -55,7 +54,6 @@ module Pod ...@@ -55,7 +54,6 @@ module Pod
pod 'AFNetworking' pod 'AFNetworking'
end end
config.stubs(:podfile).returns(podfile) config.stubs(:podfile).returns(podfile)
config.stubs(:skip_repo_update?).returns(false)
lockfile = mock lockfile = mock
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))
...@@ -69,8 +67,6 @@ module Pod ...@@ -69,8 +67,6 @@ module Pod
source 'https://github.com/CocoaPods/Specs.git' source 'https://github.com/CocoaPods/Specs.git'
pod 'AFNetworking' pod 'AFNetworking'
end end
config.unstub(:skip_repo_update?)
config.skip_repo_update = false
lockfile = mock lockfile = mock
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))
......
...@@ -7,20 +7,6 @@ module Pod ...@@ -7,20 +7,6 @@ module Pod
exception.message.should.include "No `Podfile' found in the project directory." exception.message.should.include "No `Podfile' found in the project directory."
end end
it 'updates the spec repos by default' do
config.with_changes(:skip_repo_update => nil) do
Pod::Command.parse(['update'])
config.skip_repo_update.should.be.false
end
end
it "doesn't update the spec repos if that option was given" do
config.with_changes(:skip_repo_update => nil) do
Pod::Command.parse(['update', '--no-repo-update'])
config.skip_repo_update.should.be.true
end
end
describe 'with Podfile' do describe 'with Podfile' do
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
...@@ -32,6 +18,22 @@ module Pod ...@@ -32,6 +18,22 @@ module Pod
end end
end end
describe 'updates of the spec repos' do
before do
Installer.any_instance.expects(:install!)
end
it 'updates the spec repos by default' do
Installer.any_instance.expects(:repo_update=).with(true)
run_command('update')
end
it "doesn't update the spec repos if that option was given" do
Installer.any_instance.expects(:repo_update=).with(false)
run_command('update', '--no-repo-update')
end
end
it 'tells the user that no Lockfile was found in the project dir' do it 'tells the user that no Lockfile was found in the project dir' do
exception = lambda { run_command('update', 'BananaLib', '--no-repo-update') }.should.raise Informative exception = lambda { run_command('update', 'BananaLib', '--no-repo-update') }.should.raise Informative
exception.message.should.include "No `Podfile.lock' found in the project directory" exception.message.should.include "No `Podfile.lock' found in the project directory"
......
...@@ -11,7 +11,6 @@ module Bacon ...@@ -11,7 +11,6 @@ module Bacon
c.silent = true c.silent = true
c.repos_dir = fixture('spec-repos') c.repos_dir = fixture('spec-repos')
c.installation_root = SpecHelper.temporary_directory c.installation_root = SpecHelper.temporary_directory
c.skip_repo_update = true
c.cache_root = SpecHelper.temporary_directory + 'Cache' c.cache_root = SpecHelper.temporary_directory + 'Cache'
end end
......
...@@ -105,7 +105,6 @@ module Pod ...@@ -105,7 +105,6 @@ module Pod
end end
it 'runs source provider hooks before analyzing' do it 'runs source provider hooks before analyzing' do
config.skip_repo_update = true
@installer.unstub(:resolve_dependencies) @installer.unstub(:resolve_dependencies)
@installer.stubs(:validate_build_configurations) @installer.stubs(:validate_build_configurations)
@installer.stubs(:clean_sandbox) @installer.stubs(:clean_sandbox)
...@@ -136,7 +135,6 @@ module Pod ...@@ -136,7 +135,6 @@ module Pod
@installer.stubs(:clean_sandbox) @installer.stubs(:clean_sandbox)
@installer.stubs(:ensure_plugins_are_installed!) @installer.stubs(:ensure_plugins_are_installed!)
@installer.stubs(:analyze) @installer.stubs(:analyze)
config.skip_repo_update = true
analyzer = Installer::Analyzer.new(config.sandbox, @installer.podfile, @installer.lockfile) analyzer = Installer::Analyzer.new(config.sandbox, @installer.podfile, @installer.lockfile)
analyzer.stubs(:analyze) analyzer.stubs(:analyze)
...@@ -376,14 +374,13 @@ module Pod ...@@ -376,14 +374,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 if config indicates to skip them' do it 'does not updates the repositories by default' do
config.skip_repo_update = true
SourcesManager.expects(:update).never SourcesManager.expects(:update).never
@installer.send(:resolve_dependencies) @installer.send(:resolve_dependencies)
end end
it 'updates the repositories by default' do it 'updates the repositories if that was requested' do
config.skip_repo_update = false @installer.repo_update = true
SourcesManager.expects(:update).once SourcesManager.expects(:update).once
@installer.send(:resolve_dependencies) @installer.send(:resolve_dependencies)
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