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
04e5845f
Commit
04e5845f
authored
Sep 02, 2016
by
Mark Schall
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] adding --sources to specify to only update pods from a repo
parent
6912516c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
12 deletions
+80
-12
update.rb
lib/cocoapods/command/update.rb
+21
-0
update_spec.rb
spec/functional/command/update_spec.rb
+59
-12
No files found.
lib/cocoapods/command/update.rb
View file @
04e5845f
...
...
@@ -19,8 +19,29 @@ module Pod
CLAide
::
Argument
.
new
(
'POD_NAMES'
,
false
,
true
),
]
def
self
.
options
[
[
'--sources=https://github.com/artsy/Specs'
,
'The sources from which to only update dependent pods '
\
'Multiple sources must be comma-delimited.'
],
].
concat
(
super
)
end
def
initialize
(
argv
)
@pods
=
argv
.
arguments!
unless
argv
.
arguments
.
empty?
source_urls
=
argv
.
option
(
'sources'
,
''
).
split
(
','
)
unless
source_urls
.
empty?
source_pods
=
source_urls
.
flat_map
{
|
url
|
config
.
sources_manager
.
source_with_name_or_url
(
url
).
pods
}
unless
source_pods
.
empty?
source_pods
=
source_pods
.
select
{
|
pod
|
config
.
lockfile
.
pod_names
.
include?
(
pod
)
}
if
@pods
@pods
+=
source_pods
else
@pods
=
source_pods
unless
source_pods
.
empty?
end
end
end
super
end
...
...
spec/functional/command/update_spec.rb
View file @
04e5845f
...
...
@@ -18,6 +18,21 @@ module Pod
end
end
def
generate_lockfile
podfile
=
Podfile
.
new
do
platform
:ios
pod
'BananaLib'
,
'1.0'
end
specs
=
[
Specification
.
new
do
|
s
|
s
.
name
=
'BananaLib'
s
.
version
=
'1.0'
end
,
]
external_sources
=
{}
Lockfile
.
generate
(
podfile
,
specs
,
external_sources
).
write_to_disk
(
temporary_directory
+
'Podfile.lock'
)
end
describe
'updates of the spec repos'
do
before
do
Installer
.
any_instance
.
expects
(
:install!
)
...
...
@@ -34,6 +49,49 @@ module Pod
end
end
describe
'installs the updates'
do
before
do
Installer
.
any_instance
.
expects
(
:install!
)
end
describe
'all pods'
do
it
'updates all pods'
do
Installer
.
any_instance
.
expects
(
:update
=
).
with
(
true
)
run_command
(
'update'
)
end
end
describe
'selected pods'
do
before
do
generate_lockfile
end
it
'updates selected pods'
do
Installer
.
any_instance
.
expects
(
:update
=
).
with
(
:pods
=>
[
'BananaLib'
])
run_command
(
'update'
,
'BananaLib'
)
end
end
describe
'selected repo'
do
before
do
generate_lockfile
set_up_test_repo
config
.
repos_dir
=
SpecHelper
.
tmp_repos_path
spec1
=
(
fixture
(
'spec-repos'
)
+
'test_repo/JSONKit/1.4/JSONKit.podspec'
).
read
spec2
=
(
fixture
(
'spec-repos'
)
+
'test_repo/BananaLib/1.0/BananaLib.podspec'
).
read
File
.
open
(
temporary_directory
+
'JSONKit.podspec'
,
'w'
)
{
|
f
|
f
.
write
(
spec1
)
}
File
.
open
(
temporary_directory
+
'BananaLib.podspec'
,
'w'
)
{
|
f
|
f
.
write
(
spec2
)
}
end
it
'updates pods in repo and in lockfile'
do
Installer
.
any_instance
.
expects
(
:update
=
).
with
(
:pods
=>
[
'BananaLib'
])
run_command
(
'update'
,
'--sources=master'
)
end
end
end
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
.
message
.
should
.
include
"No `Podfile.lock' found in the project directory"
...
...
@@ -41,18 +99,7 @@ module Pod
describe
'tells the user that the Pods cannot be updated unless they are installed'
do
before
do
podfile
=
Podfile
.
new
do
platform
:ios
pod
'BananaLib'
,
'1.0'
end
specs
=
[
Specification
.
new
do
|
s
|
s
.
name
=
'BananaLib'
s
.
version
=
'1.0'
end
,
]
external_sources
=
{}
Lockfile
.
generate
(
podfile
,
specs
,
external_sources
).
write_to_disk
(
temporary_directory
+
'Podfile.lock'
)
generate_lockfile
end
it
'for a single missing Pod'
do
...
...
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