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
e0aee91c
Commit
e0aee91c
authored
Jun 26, 2016
by
Mark Schall
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[repo/push] --use-json to convert podspecs to JSON format when pushing
parent
3227fa60
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
2 deletions
+27
-2
push.rb
lib/cocoapods/command/repo/push.rb
+10
-1
push_spec.rb
spec/functional/command/repo/push_spec.rb
+17
-1
No files found.
lib/cocoapods/command/repo/push.rb
View file @
e0aee91c
...
@@ -31,6 +31,7 @@ module Pod
...
@@ -31,6 +31,7 @@ module Pod
[
'--no-private'
,
'Lint includes checks that apply only to public repos'
],
[
'--no-private'
,
'Lint includes checks that apply only to public repos'
],
[
'--commit-message="Fix bug in pod"'
,
'Add custom commit message. '
\
[
'--commit-message="Fix bug in pod"'
,
'Add custom commit message. '
\
'Opens default editor if no commit message is specified.'
],
'Opens default editor if no commit message is specified.'
],
[
'--use-json'
,
'Push JSON spec to repo'
],
].
concat
(
super
)
].
concat
(
super
)
end
end
...
@@ -45,6 +46,7 @@ module Pod
...
@@ -45,6 +46,7 @@ module Pod
@private
=
argv
.
flag?
(
'private'
,
true
)
@private
=
argv
.
flag?
(
'private'
,
true
)
@message
=
argv
.
option
(
'commit-message'
)
@message
=
argv
.
option
(
'commit-message'
)
@commit_message
=
argv
.
flag?
(
'commit-message'
,
false
)
@commit_message
=
argv
.
flag?
(
'commit-message'
,
false
)
@use_json
=
argv
.
flag?
(
'use-json'
)
super
super
end
end
...
@@ -177,9 +179,16 @@ module Pod
...
@@ -177,9 +179,16 @@ module Pod
else
else
message
=
"[Add]
#{
spec
}
"
message
=
"[Add]
#{
spec
}
"
end
end
FileUtils
.
mkdir_p
(
output_path
)
FileUtils
.
mkdir_p
(
output_path
)
if
@use_json
json_file_name
=
"
#{
spec
.
name
}
.podspec.json"
json_file
=
File
.
join
(
output_path
,
json_file_name
)
File
.
open
(
json_file
,
'w'
)
{
|
file
|
file
.
write
(
spec
.
to_pretty_json
)
}
else
FileUtils
.
cp
(
spec_file
,
output_path
)
FileUtils
.
cp
(
spec_file
,
output_path
)
end
Dir
.
chdir
(
repo_dir
)
do
Dir
.
chdir
(
repo_dir
)
do
# only commit if modified
# only commit if modified
if
git!
(
'status'
,
'--porcelain'
).
include?
(
spec
.
name
)
if
git!
(
'status'
,
'--porcelain'
).
include?
(
spec
.
name
)
...
...
spec/functional/command/repo/push_spec.rb
View file @
e0aee91c
...
@@ -99,7 +99,7 @@ module Pod
...
@@ -99,7 +99,7 @@ module Pod
(
@upstream
+
'PushTest/1.4/PushTest.podspec'
).
should
.
not
.
exist?
(
@upstream
+
'PushTest/1.4/PushTest.podspec'
).
should
.
not
.
exist?
end
end
it
'
successfully pushes a spec
'
do
it
'
generate a message for commit
'
do
cmd
=
command
(
'repo'
,
'push'
,
'master'
)
cmd
=
command
(
'repo'
,
'push'
,
'master'
)
Dir
.
chdir
(
@upstream
)
{
`git checkout -b tmp_for_push -q`
}
Dir
.
chdir
(
@upstream
)
{
`git checkout -b tmp_for_push -q`
}
cmd
.
expects
(
:validate_podspec_files
).
returns
(
true
)
cmd
.
expects
(
:validate_podspec_files
).
returns
(
true
)
...
@@ -107,10 +107,26 @@ module Pod
...
@@ -107,10 +107,26 @@ module Pod
Pod
::
UI
.
output
.
should
.
include
(
'[Add] PushTest (1.4)'
)
Pod
::
UI
.
output
.
should
.
include
(
'[Add] PushTest (1.4)'
)
Pod
::
UI
.
output
.
should
.
include
(
'[Fix] JSONKit (1.4)'
)
Pod
::
UI
.
output
.
should
.
include
(
'[Fix] JSONKit (1.4)'
)
Pod
::
UI
.
output
.
should
.
include
(
'[No change] BananaLib (1.0)'
)
Pod
::
UI
.
output
.
should
.
include
(
'[No change] BananaLib (1.0)'
)
end
it
'successfully pushes a spec'
do
cmd
=
command
(
'repo'
,
'push'
,
'master'
)
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`
}
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 converted JSON podspec'
do
cmd
=
command
(
'repo'
,
'push'
,
'master'
,
'--use-json'
)
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.json'
).
read
.
should
.
include
(
'PushTest'
)
end
it
'initializes with default sources if no custom sources specified'
do
it
'initializes with default sources if no custom sources specified'
do
cmd
=
command
(
'repo'
,
'push'
,
'master'
)
cmd
=
command
(
'repo'
,
'push'
,
'master'
)
cmd
.
instance_variable_get
(
:@source_urls
).
should
.
equal
[
@upstream
.
to_s
]
cmd
.
instance_variable_get
(
:@source_urls
).
should
.
equal
[
@upstream
.
to_s
]
...
...
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