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
spec repos, not those from local/external sources or `:head` versions.
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
#
# @todo the command report new dependencies added to the Podfile as
......
......@@ -36,23 +36,6 @@ module Pod
# commands.
#
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.
#
# @param [Hash, Boolean, nil] update
......@@ -92,6 +75,17 @@ module Pod
Pod resources.
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
verify_podfile_exists!
run_install_with_update(false)
......@@ -118,7 +112,14 @@ module Pod
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)
config.skip_repo_update = !argv.flag?('repo-update', !config.skip_repo_update)
@pods = argv.arguments! unless argv.arguments.empty?
super
end
......
require File.expand_path('../../../spec_helper', __FILE__)
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
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.message.should.include "No `Podfile' found in the project directory."
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
#---------------------------------------------------------------------------#
......@@ -27,6 +32,20 @@ module Pod
exception.message.should.include "No `Podfile' found in the project directory."
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
file = temporary_directory + 'Podfile'
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