Commit c1b2dff6 authored by Marius Rackwitz's avatar Marius Rackwitz

[Command] Move Install & Update into dedicated files

parent 4ed73db0
...@@ -17,14 +17,15 @@ module Pod ...@@ -17,14 +17,15 @@ module Pod
require 'cocoapods/command/options/project_directory' require 'cocoapods/command/options/project_directory'
include Options include Options
require 'cocoapods/command/install'
require 'cocoapods/command/inter_process_communication' require 'cocoapods/command/inter_process_communication'
require 'cocoapods/command/lib' require 'cocoapods/command/lib'
require 'cocoapods/command/list' require 'cocoapods/command/list'
require 'cocoapods/command/outdated' require 'cocoapods/command/outdated'
require 'cocoapods/command/project'
require 'cocoapods/command/repo' require 'cocoapods/command/repo'
require 'cocoapods/command/setup' require 'cocoapods/command/setup'
require 'cocoapods/command/spec' require 'cocoapods/command/spec'
require 'cocoapods/command/update'
require 'cocoapods/command/init' require 'cocoapods/command/init'
require 'cocoapods/command/cache' require 'cocoapods/command/cache'
require 'cocoapods/command/env' require 'cocoapods/command/env'
......
module Pod
class Command
class Install < Command
include ProjectDirectory
self.summary = 'Install project dependencies to Podfile.lock versions'
self.description = <<-DESC
Downloads all dependencies defined in `Podfile` and creates an Xcode
Pods library project in `./Pods`.
The Xcode project file should be specified in your `Podfile` like this:
project 'path/to/XcodeProject'
If no project is specified, then a search for an Xcode project will
be made. If more than one Xcode project is found, the command will
raise an error.
This will configure the project to reference the Pods static library,
add a build configuration file, and add a post build script to copy
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!
installer = installer_for_config
installer.update = false
installer.install!
end
end
end
end
module Pod module Pod
class Command class Command
class Install < Command
include ProjectDirectory
self.summary = 'Install project dependencies to Podfile.lock versions'
self.description = <<-DESC
Downloads all dependencies defined in `Podfile` and creates an Xcode
Pods library project in `./Pods`.
The Xcode project file should be specified in your `Podfile` like this:
project 'path/to/XcodeProject'
If no project is specified, then a search for an Xcode project will
be made. If more than one Xcode project is found, the command will
raise an error.
This will configure the project to reference the Pods static library,
add a build configuration file, and add a post build script to copy
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!
installer = installer_for_config
installer.update = false
installer.install!
end
end
#-------------------------------------------------------------------------#
class Update < Command class Update < Command
include ProjectDirectory include ProjectDirectory
......
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
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
end
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../../../spec_helper', __FILE__)
module Pod module Pod
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
#---------------------------------------------------------------------------#
describe Command::Update do describe Command::Update do
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
...@@ -99,6 +76,4 @@ module Pod ...@@ -99,6 +76,4 @@ module Pod
end end
end 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