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
5eb747a9
Commit
5eb747a9
authored
Jan 19, 2018
by
Samuel Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Repo::Push] Allow disabling overwriting published specs
parent
b0ecb70b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
0 deletions
+23
-0
CHANGELOG.md
CHANGELOG.md
+4
-0
push.rb
lib/cocoapods/command/repo/push.rb
+5
-0
push_spec.rb
spec/functional/command/repo/push_spec.rb
+14
-0
No files found.
CHANGELOG.md
View file @
5eb747a9
...
...
@@ -16,6 +16,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Keith Smiley
](
https://github.com/keith
)
[
#7346
](
https://github.com/CocoaPods/CocoaPods/pull/7346
)
*
Add a
`--no-overwrite`
flag to
`pod repo push`
to disable overwriting
existing specs that have already been pushed.
[
Samuel Giddins
](
https://github.com/segiddins
)
##### Bug Fixes
*
Do not attempt compilation for pods with no sources and skipping import validation
...
...
lib/cocoapods/command/repo/push.rb
View file @
5eb747a9
...
...
@@ -36,6 +36,7 @@ module Pod
[
'--use-json'
,
'Push JSON spec to repo'
],
[
'--swift-version=VERSION'
,
'The SWIFT_VERSION that should be used when linting the spec. '
\
'This takes precedence over a .swift-version file.'
],
[
'--no-overwrite'
,
'Disallow pushing that would overwrite an existing spec.'
],
].
concat
(
super
)
end
...
...
@@ -54,6 +55,7 @@ module Pod
@swift_version
=
argv
.
option
(
'swift-version'
,
nil
)
@skip_import_validation
=
argv
.
flag?
(
'skip-import-validation'
,
false
)
@skip_tests
=
argv
.
flag?
(
'skip-tests'
,
false
)
@allow_overwrite
=
argv
.
flag?
(
'overwrite'
,
true
)
super
end
...
...
@@ -183,6 +185,9 @@ module Pod
if
@message
&&
!
@message
.
empty?
message
=
@message
elsif
output_path
.
exist?
unless
@allow_overwrite
raise
Informative
,
"
#{
spec
}
already exists and overwriting has been disabled."
end
message
=
"[Fix]
#{
spec
}
"
elsif
output_path
.
dirname
.
directory?
message
=
"[Update]
#{
spec
}
"
...
...
spec/functional/command/repo/push_spec.rb
View file @
5eb747a9
...
...
@@ -108,6 +108,20 @@ module Pod
(
@upstream
+
'PushTest/1.4/PushTest.podspec'
).
should
.
not
.
exist?
end
it
'refuses to push if --no-overwrite is passed and the spec exists'
do
cmd
=
command
(
'repo'
,
'push'
,
'master'
,
'JSONKit.podspec'
,
'--no-overwrite'
)
Dir
.
chdir
(
@upstream
)
{
`git checkout -b tmp_for_push -q`
}
cmd
.
expects
(
:validate_podspec_files
).
returns
(
true
)
e
=
lambda
{
Dir
.
chdir
(
temporary_directory
)
{
cmd
.
run
}
}.
should
.
raise
Pod
::
Informative
e
.
message
.
should
==
'[!] JSONKit (1.4) already exists and overwriting has been disabled.'
cmd
=
command
(
'repo'
,
'push'
,
'master'
,
'PushTest.podspec'
,
'--no-overwrite'
)
cmd
.
expects
(
:validate_podspec_files
).
returns
(
true
)
Dir
.
chdir
(
temporary_directory
)
{
cmd
.
run
}
Pod
::
UI
.
output
.
should
.
include
(
'[Add] PushTest (1.4)'
)
end
it
'generate a message for commit'
do
cmd
=
command
(
'repo'
,
'push'
,
'master'
)
Dir
.
chdir
(
@upstream
)
{
`git checkout -b tmp_for_push -q`
}
...
...
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