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
dace1b27
Commit
dace1b27
authored
Jun 27, 2016
by
Mark Schall
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[repo/push] allow passing URL instead of name when pushing to non-master repos
parent
4ab73504
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
4 deletions
+25
-4
push.rb
lib/cocoapods/command/repo/push.rb
+6
-3
push_spec.rb
spec/functional/command/repo/push_spec.rb
+19
-1
No files found.
lib/cocoapods/command/repo/push.rb
View file @
dace1b27
...
@@ -39,7 +39,10 @@ module Pod
...
@@ -39,7 +39,10 @@ module Pod
@allow_warnings
=
argv
.
flag?
(
'allow-warnings'
)
@allow_warnings
=
argv
.
flag?
(
'allow-warnings'
)
@local_only
=
argv
.
flag?
(
'local-only'
)
@local_only
=
argv
.
flag?
(
'local-only'
)
@repo
=
argv
.
shift_argument
@repo
=
argv
.
shift_argument
@source
=
config
.
sources_manager
.
sources
([
@repo
]).
first
unless
@repo
.
nil?
begin
@source
=
config
.
sources_manager
.
source_with_name_or_url
(
@repo
)
unless
@repo
.
nil?
rescue
end
@source_urls
=
argv
.
option
(
'sources'
,
config
.
sources_manager
.
all
.
map
(
&
:url
).
join
(
','
)).
split
(
','
)
@source_urls
=
argv
.
option
(
'sources'
,
config
.
sources_manager
.
all
.
map
(
&
:url
).
join
(
','
)).
split
(
','
)
@podspec
=
argv
.
shift_argument
@podspec
=
argv
.
shift_argument
@use_frameworks
=
!
argv
.
flag?
(
'use-libraries'
)
@use_frameworks
=
!
argv
.
flag?
(
'use-libraries'
)
...
@@ -52,8 +55,8 @@ module Pod
...
@@ -52,8 +55,8 @@ module Pod
def
validate!
def
validate!
super
super
help!
'A spec-repo name is required.'
unless
@repo
help!
'A spec-repo name
or url
is required.'
unless
@repo
unless
@source
.
repo
.
directory?
unless
@source
&&
@source
.
repo
.
directory?
raise
Informative
,
raise
Informative
,
"Unable to find the `
#{
@repo
}
` repo. "
\
"Unable to find the `
#{
@repo
}
` repo. "
\
'If it has not yet been cloned, add it via `pod repo add`.'
'If it has not yet been cloned, add it via `pod repo add`.'
...
...
spec/functional/command/repo/push_spec.rb
View file @
dace1b27
...
@@ -16,6 +16,15 @@ module Pod
...
@@ -16,6 +16,15 @@ module Pod
e
.
message
.
should
.
match
(
/Unable to find the `missing_repo` repo/
)
e
.
message
.
should
.
match
(
/Unable to find the `missing_repo` repo/
)
end
end
end
end
it
"complains if it can't get repo url"
do
Dir
.
chdir
(
fixture
(
'banana-lib'
))
do
Command
::
Repo
::
Add
.
any_instance
.
stubs
(
:clone_repo
)
cmd
=
command
(
'repo'
,
'push'
,
'https://github.com/foo/bar.git'
)
e
=
lambda
{
cmd
.
validate!
}.
should
.
raise
Informative
e
.
message
.
should
.
include
(
'Unable to find the `https://github.com/foo/bar.git` repo'
)
end
end
it
"complains if it can't find a spec"
do
it
"complains if it can't find a spec"
do
repo_make
(
'test_repo'
)
repo_make
(
'test_repo'
)
...
@@ -79,7 +88,7 @@ module Pod
...
@@ -79,7 +88,7 @@ module Pod
File
.
open
(
temporary_directory
+
'BananaLib.podspec'
,
'w'
)
{
|
f
|
f
.
write
(
spec_clean
)
}
File
.
open
(
temporary_directory
+
'BananaLib.podspec'
,
'w'
)
{
|
f
|
f
.
write
(
spec_clean
)
}
end
end
it
'refuses to push if the repo is
not clean
'
do
it
'refuses to push if the repo is
master
'
do
Dir
.
chdir
(
test_repo_path
)
do
Dir
.
chdir
(
test_repo_path
)
do
`git remote set-url origin https://github.com/CocoaPods/Specs.git`
`git remote set-url origin https://github.com/CocoaPods/Specs.git`
end
end
...
@@ -117,6 +126,15 @@ module Pod
...
@@ -117,6 +126,15 @@ module Pod
Dir
.
chdir
(
@upstream
)
{
`git checkout master -q`
}
Dir
.
chdir
(
@upstream
)
{
`git checkout master -q`
}
(
@upstream
+
'PushTest/1.4/PushTest.podspec'
).
read
.
should
.
include
(
'PushTest'
)
(
@upstream
+
'PushTest/1.4/PushTest.podspec'
).
read
.
should
.
include
(
'PushTest'
)
end
end
it
'successfully pushes a spec to URL'
do
cmd
=
command
(
'repo'
,
'push'
,
@upstream
)
Dir
.
chdir
(
@upstream
)
{
`git checkout -b tmp_for_push -q`
}
cmd
.
expects
(
:validate_podspec_files
).
returns
(
true
)
Dir
.
chdir
(
temporary_directory
)
{
cmd
.
run
}
Dir
.
chdir
(
@upstream
)
{
`git checkout master -q`
}
(
@upstream
+
'PushTest/1.4/PushTest.podspec'
).
read
.
should
.
include
(
'PushTest'
)
end
it
'successfully pushes converted JSON podspec'
do
it
'successfully pushes converted JSON podspec'
do
cmd
=
command
(
'repo'
,
'push'
,
'master'
,
'--use-json'
)
cmd
=
command
(
'repo'
,
'push'
,
'master'
,
'--use-json'
)
...
...
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