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
ed9cf9dc
Commit
ed9cf9dc
authored
Mar 10, 2016
by
Samuel Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SourcesManager] Update for new Source APIs
parent
fb544ef6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
20 deletions
+26
-20
sources_manager.rb
lib/cocoapods/sources_manager.rb
+8
-3
update_spec.rb
spec/functional/command/repo/update_spec.rb
+4
-3
sources_manager_spec.rb
spec/unit/sources_manager_spec.rb
+13
-14
validator_spec.rb
spec/unit/validator_spec.rb
+1
-0
No files found.
lib/cocoapods/sources_manager.rb
View file @
ed9cf9dc
...
@@ -323,7 +323,7 @@ module Pod
...
@@ -323,7 +323,7 @@ module Pod
changed_spec_paths
=
{}
changed_spec_paths
=
{}
sources
.
each
do
|
source
|
sources
.
each
do
|
source
|
UI
.
section
"Updating spec repo `
#{
source
.
name
}
`"
do
UI
.
section
"Updating spec repo `
#{
source
.
name
}
`"
do
changed_source_paths
=
source
.
update
(
show_output
&&
!
config
.
verbose?
)
changed_source_paths
=
source
.
update
(
show_output
)
changed_spec_paths
[
source
]
=
changed_source_paths
if
changed_source_paths
.
count
>
0
changed_spec_paths
[
source
]
=
changed_source_paths
if
changed_source_paths
.
count
>
0
check_version_information
(
source
.
repo
)
check_version_information
(
source
.
repo
)
end
end
...
@@ -620,9 +620,14 @@ module Pod
...
@@ -620,9 +620,14 @@ module Pod
extend
Executable
extend
Executable
executable
:git
executable
:git
def
git
(
args
,
include_error:
false
)
Executable
.
capture_command
(
'git'
,
args
,
:capture
=>
include_error
?
:
merge
:
:out
).
first
.
strip
end
def
update_git_repo
(
show_output
=
false
)
def
update_git_repo
(
show_output
=
false
)
output
=
git!
%w(pull --ff-only)
Config
.
instance
.
with_changes
(
:verbose
=>
show_output
)
do
UI
.
puts
output
if
show_output
git!
(
%w(pull --ff-only)
)
end
rescue
rescue
UI
.
warn
'CocoaPods was not able to update the '
\
UI
.
warn
'CocoaPods was not able to update the '
\
"`
#{
name
}
` repo. If this is an unexpected issue "
\
"`
#{
name
}
` repo. If this is an unexpected issue "
\
...
...
spec/functional/command/repo/update_spec.rb
View file @
ed9cf9dc
...
@@ -10,9 +10,10 @@ module Pod
...
@@ -10,9 +10,10 @@ module Pod
set_up_test_repo
set_up_test_repo
config
.
repos_dir
=
SpecHelper
.
tmp_repos_path
config
.
repos_dir
=
SpecHelper
.
tmp_repos_path
WebMock
::
API
.
stub_request
(
:get
,
"https://api.github.com/repos/cocoapods/specs/commits/master"
)
MasterSource
.
any_instance
.
stubs
(
:git_commit_hash
).
returns
(
'commit hash'
)
.
with
(
:headers
=>
{
'Accept'
=>
'application/vnd.github.chitauri-preview+sha'
})
WebMock
.
stub_request
(
:get
,
'https://api.github.com/repos/CocoaPods/Specs/commits/master'
).
.
to_return
(
:status
=>
200
,
:body
=>
''
,
:headers
=>
{})
with
(
:headers
=>
{
'Accept'
=>
'application/vnd.github.chitauri-preview+sha'
,
'Accept-Encoding'
=>
'gzip;q=1.0,deflate;q=0.6,identity;q=0.3'
,
'If-None-Match'
=>
'"commit hash"'
,
'User-Agent'
=>
'CocoaPods'
}).
to_return
(
:status
=>
200
,
:body
=>
''
,
:headers
=>
{})
end
end
after
do
after
do
...
...
spec/unit/sources_manager_spec.rb
View file @
ed9cf9dc
...
@@ -295,37 +295,36 @@ module Pod
...
@@ -295,37 +295,36 @@ module Pod
describe
'Updating Sources'
do
describe
'Updating Sources'
do
extend
SpecHelper
::
TemporaryRepos
extend
SpecHelper
::
TemporaryRepos
before
do
WebMock
::
API
.
stub_request
(
:get
,
"https://api.github.com/repos/cocoapods/specs/commits/master"
)
.
with
(
:headers
=>
{
'Accept'
=>
'application/vnd.github.chitauri-preview+sha'
})
.
to_return
(
:status
=>
200
,
:body
=>
''
,
:headers
=>
{})
end
after
do
before
do
WebMock
.
reset!
MasterSource
.
any_instance
.
stubs
(
:requires_update?
).
returns
(
true
)
end
end
it
'updates source backed by a git repository'
do
it
'updates source backed by a git repository'
do
set_up_test_repo_for_update
set_up_test_repo_for_update
SourcesManager
.
expects
(
:update_search_index_if_needed_in_background
).
with
({}).
returns
(
nil
)
SourcesManager
.
expects
(
:update_search_index_if_needed_in_background
).
with
({}).
returns
(
nil
)
MasterSource
.
any_instance
.
expects
(
:git!
).
with
(
%w(pull --ff-only)
)
SourcesManager
.
update
(
test_repo_path
.
basename
.
to_s
,
true
)
SourcesManager
.
update
(
test_repo_path
.
basename
.
to_s
,
true
)
UI
.
output
.
should
.
match
/is up to date/
end
end
it
'uses the only fast forward git option'
do
it
'uses the only fast forward git option'
do
set_up_test_repo_for_update
set_up_test_repo_for_update
Source
.
any_instance
.
expects
(
:git!
).
with
{
|
options
|
options
.
should
.
include?
'--ff-only'
}
Master
Source
.
any_instance
.
expects
(
:git!
).
with
{
|
options
|
options
.
should
.
include?
'--ff-only'
}
SourcesManager
.
expects
(
:update_search_index_if_needed_in_background
).
with
({}).
returns
(
nil
)
SourcesManager
.
expects
(
:update_search_index_if_needed_in_background
).
with
({}).
returns
(
nil
)
SourcesManager
.
update
(
test_repo_path
.
basename
.
to_s
,
true
)
SourcesManager
.
update
(
test_repo_path
.
basename
.
to_s
,
true
)
end
end
it
'prints a warning if the update failed'
do
it
'prints a warning if the update failed'
do
UI
.
warnings
=
''
set_up_test_repo_for_update
set_up_test_repo_for_update
Dir
.
chdir
(
test_repo_path
)
do
Source
.
any_instance
.
stubs
(
:git
).
with
(
%w(rev-parse HEAD)
).
returns
(
'aabbccd'
)
`git remote set-url origin file:///dev/null`
Source
.
any_instance
.
stubs
(
:git
).
with
(
%w(diff --name-only aabbccd..HEAD)
).
returns
(
''
)
end
MasterSource
.
any_instance
.
expects
(
:git!
).
with
(
%w(pull --ff-only)
).
raises
(
<<-
EOS
)
fatal: '/dev/null' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
EOS
SourcesManager
.
expects
(
:update_search_index_if_needed_in_background
).
with
({}).
returns
(
nil
)
SourcesManager
.
expects
(
:update_search_index_if_needed_in_background
).
with
({}).
returns
(
nil
)
SourcesManager
.
update
(
test_repo_path
.
basename
.
to_s
,
true
)
SourcesManager
.
update
(
test_repo_path
.
basename
.
to_s
,
true
)
UI
.
warnings
.
should
.
include
(
'not able to update the `master` repo'
)
UI
.
warnings
.
should
.
include
(
'not able to update the `master` repo'
)
...
...
spec/unit/validator_spec.rb
View file @
ed9cf9dc
...
@@ -418,6 +418,7 @@ module Pod
...
@@ -418,6 +418,7 @@ module Pod
validator
.
stubs
(
:validate_url
)
validator
.
stubs
(
:validate_url
)
git
=
Executable
.
which
(
:git
)
git
=
Executable
.
which
(
:git
)
Executable
.
stubs
(
:which
).
with
(
'git'
).
returns
(
git
)
Executable
.
stubs
(
:which
).
with
(
'git'
).
returns
(
git
)
Executable
.
stubs
(
:capture_command
).
with
(
'git'
,
[
'config'
,
'--get'
,
'remote.origin.url'
],
:capture
=>
:out
).
returns
([
'https://github.com/CocoaPods/Specs.git'
])
Executable
.
stubs
(
:which
).
with
(
:xcrun
)
Executable
.
stubs
(
:which
).
with
(
:xcrun
)
Executable
.
expects
(
:which
).
with
(
'xcodebuild'
).
times
(
4
).
returns
(
'/usr/bin/xcodebuild'
)
Executable
.
expects
(
:which
).
with
(
'xcodebuild'
).
times
(
4
).
returns
(
'/usr/bin/xcodebuild'
)
command
=
%w(clean build -workspace App.xcworkspace -scheme App -configuration Release)
command
=
%w(clean build -workspace App.xcworkspace -scheme App -configuration Release)
...
...
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