Commit 4345124a authored by Marius Rackwitz's avatar Marius Rackwitz

[Command::Project] No repo update by default on install

parent 917dcf2d
...@@ -8,6 +8,17 @@ module Pod ...@@ -8,6 +8,17 @@ module Pod
spec repos, not those from local/external sources or `:head` versions. spec repos, not those from local/external sources or `:head` versions.
DESC DESC
def self.options
[
['--no-repo-update', 'Skip running `pod repo update` before install'],
].concat(super)
end
def initialize(argv)
config.skip_repo_update = !argv.flag?('repo-update', !config.skip_repo_update)
super
end
# Run the command # Run the command
# #
# @todo the command report new dependencies added to the Podfile as # @todo the command report new dependencies added to the Podfile as
......
...@@ -36,23 +36,6 @@ module Pod ...@@ -36,23 +36,6 @@ module Pod
# commands. # commands.
# #
module Project module Project
module Options
def options
[
['--no-repo-update', 'Skip running `pod repo update` before install'],
].concat(super)
end
end
def self.included(base)
base.extend Options
end
def initialize(argv)
config.skip_repo_update = !argv.flag?('repo-update', !config.skip_repo_update)
super
end
# Runs the installer. # Runs the installer.
# #
# @param [Hash, Boolean, nil] update # @param [Hash, Boolean, nil] update
...@@ -92,6 +75,17 @@ module Pod ...@@ -92,6 +75,17 @@ module Pod
Pod resources. Pod resources.
DESC DESC
def self.options
[
['--repo-update', 'Force running `pod repo update` before install'],
].concat(super)
end
def initialize(argv)
config.skip_repo_update = !argv.flag?('repo-update', false)
super
end
def run def run
verify_podfile_exists! verify_podfile_exists!
run_install_with_update(false) run_install_with_update(false)
...@@ -118,7 +112,14 @@ module Pod ...@@ -118,7 +112,14 @@ module Pod
CLAide::Argument.new('POD_NAMES', false, true), CLAide::Argument.new('POD_NAMES', false, true),
] ]
def self.options
[
['--no-repo-update', 'Skip running `pod repo update` before install'],
].concat(super)
end
def initialize(argv) def initialize(argv)
config.skip_repo_update = !argv.flag?('repo-update', !config.skip_repo_update)
@pods = argv.arguments! unless argv.arguments.empty? @pods = argv.arguments! unless argv.arguments.empty?
super super
end end
......
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../../../spec_helper', __FILE__)
module Pod module Pod
describe Command::Project do
it 'tells the user that no Podfile or podspec was found in the current working dir' do
Command::Install.new(CLAide::ARGV.new(['--no-repo-update']))
config.skip_repo_update.should.be.true
end
end
#---------------------------------------------------------------------------#
describe Command::Install do describe Command::Install do
it 'tells the user that no Podfile or podspec was found in the project dir' do it 'tells the user that no Podfile or podspec was found in the project dir' do
exception = lambda { run_command('install', '--no-repo-update') }.should.raise Informative exception = lambda { run_command('install', '--no-repo-update') }.should.raise Informative
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
config.with_changes(:skip_repo_update => nil) do
Pod::Command.parse(['install'])
config.skip_repo_update.should.be.true
end
end
it 'updates the spec repos if that option was given' do
config.with_changes(:skip_repo_update => nil) do
Pod::Command.parse(['install', '--repo-update'])
config.skip_repo_update.should.be.false
end
end
end end
#---------------------------------------------------------------------------# #---------------------------------------------------------------------------#
...@@ -27,6 +32,20 @@ module Pod ...@@ -27,6 +32,20 @@ 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
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
file = temporary_directory + 'Podfile' file = temporary_directory + 'Podfile'
File.open(file, 'w') do |f| File.open(file, 'w') do |f|
......
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