Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
c1b2dff6
Commit
c1b2dff6
authored
Mar 12, 2016
by
Marius Rackwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Command] Move Install & Update into dedicated files
parent
4ed73db0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
69 deletions
+70
-69
command.rb
lib/cocoapods/command.rb
+2
-1
install.rb
lib/cocoapods/command/install.rb
+44
-0
update.rb
lib/cocoapods/command/update.rb
+0
-43
install_spec.rb
spec/functional/command/install_spec.rb
+24
-0
update_spec.rb
spec/functional/command/update_spec.rb
+0
-25
No files found.
lib/cocoapods/command.rb
View file @
c1b2dff6
...
...
@@ -17,14 +17,15 @@ module Pod
require
'cocoapods/command/options/project_directory'
include
Options
require
'cocoapods/command/install'
require
'cocoapods/command/inter_process_communication'
require
'cocoapods/command/lib'
require
'cocoapods/command/list'
require
'cocoapods/command/outdated'
require
'cocoapods/command/project'
require
'cocoapods/command/repo'
require
'cocoapods/command/setup'
require
'cocoapods/command/spec'
require
'cocoapods/command/update'
require
'cocoapods/command/init'
require
'cocoapods/command/cache'
require
'cocoapods/command/env'
...
...
lib/cocoapods/command/install.rb
0 → 100644
View file @
c1b2dff6
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
lib/cocoapods/command/
project
.rb
→
lib/cocoapods/command/
update
.rb
View file @
c1b2dff6
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
#-------------------------------------------------------------------------#
class
Update
<
Command
include
ProjectDirectory
...
...
spec/functional/command/install_spec.rb
0 → 100644
View file @
c1b2dff6
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
spec/functional/command/
project
_spec.rb
→
spec/functional/command/
update
_spec.rb
View file @
c1b2dff6
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
#---------------------------------------------------------------------------#
describe
Command
::
Update
do
extend
SpecHelper
::
TemporaryRepos
...
...
@@ -99,6 +76,4 @@ module Pod
end
end
end
#---------------------------------------------------------------------------#
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment