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
058b4e6c
Commit
058b4e6c
authored
Mar 09, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Command::Push] Clean up
parent
174fea80
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
38 deletions
+70
-38
push.rb
lib/cocoapods/command/push.rb
+70
-38
No files found.
lib/cocoapods/command/push.rb
View file @
058b4e6c
...
...
@@ -48,68 +48,60 @@ module Pod
push_repo
unless
@local_only
end
#--------------------------------------#
#--------------------------------------
---------------------------------
#
private
# @!group Push sub-steps
extend
Executable
executable
:git
def
update_repo
UI
.
puts
"Updating the `
#{
@repo
}
' repo
\n
"
.
yellow
Dir
.
chdir
(
repo_dir
)
{
UI
.
puts
`git pull 2>&1`
}
end
def
push_repo
UI
.
puts
"
\n
Pushing the `
#{
@repo
}
' repo
\n
"
.
yellow
Dir
.
chdir
(
repo_dir
)
{
UI
.
puts
`git push 2>&1`
}
end
def
repo_dir
dir
=
config
.
repos_dir
+
@repo
raise
Informative
,
"`
#{
@repo
}
` repo not found"
unless
dir
.
exist?
dir
end
# @todo: Add specs for staged and unstaged files.
#
def
check_repo_status
clean
=
Dir
.
chdir
(
repo_dir
)
{
`git status --porcelain 2>&1`
}
==
''
raise
Informative
,
"The repo `
#{
@repo
}
` is not clean"
unless
clean
end
def
podspec_files
files
=
Pathname
.
glob
(
@podspec
||
"*.podspec"
)
raise
Informative
,
"Couldn't find any .podspec file in current directory"
if
files
.
empty?
files
end
# @return [Integer] The number of the podspec files to push.
# Performs a full lint against the podspecs.
#
def
count
podspec_files
.
count
end
def
validate_podspec_files
UI
.
puts
"
\n
Validating
#{
'spec'
.
pluralize
(
count
)
}
"
.
yellow
podspec_files
.
each
do
|
podspec
|
validator
=
Validator
.
new
(
podspec
)
begin
validator
.
validate
rescue
Exception
=>
e
rescue
Exception
raise
Informative
,
"The `
#{
podspec
}
` specification does not validate."
end
raise
Informative
,
"The `
#{
podspec
}
` specification does not validate."
unless
validator
.
validated?
end
end
# Checks that the repo is clean.
#
# @raise If the repo is not clean.
#
# @todo Add specs for staged and unstaged files.
#
# @todo Gracefully handle the case where source is not under git
# source control.
#
# @return [void]
#
def
check_repo_status
clean
=
Dir
.
chdir
(
repo_dir
)
{
`git status --porcelain 2>&1`
}
==
''
raise
Informative
,
"The repo `
#{
@repo
}
` is not clean"
unless
clean
end
# Updates the git repo against the remote.
#
# @return [void]
#
def
update_repo
UI
.
puts
"Updating the `
#{
@repo
}
' repo
\n
"
.
yellow
Dir
.
chdir
(
repo_dir
)
{
UI
.
puts
`git pull 2>&1`
}
end
# Commits the podspecs to the source, which should be a git repo.
#
# @note The pre commit hook of the repo is skipped as the podspecs have
# already been linted.
#
# @todo Raise if the source is not under git source control.
#
# @return [void]
#
def
add_specs_to_repo
...
...
@@ -134,6 +126,46 @@ module Pod
end
end
end
# Pushes the git repo against the remote.
#
# @return [void]
#
def
push_repo
UI
.
puts
"
\n
Pushing the `
#{
@repo
}
' repo
\n
"
.
yellow
Dir
.
chdir
(
repo_dir
)
{
UI
.
puts
`git push 2>&1`
}
end
#-----------------------------------------------------------------------#
private
# @!group Private helpers
# @return [Pathname] The directory of the repository.
#
def
repo_dir
dir
=
config
.
repos_dir
+
@repo
raise
Informative
,
"`
#{
@repo
}
` repo not found"
unless
dir
.
exist?
dir
end
# @return [Array<Pathname>] The path of the specifications to push.
#
def
podspec_files
files
=
Pathname
.
glob
(
@podspec
||
"*.podspec"
)
raise
Informative
,
"Couldn't find any .podspec file in current directory"
if
files
.
empty?
files
end
# @return [Integer] The number of the podspec files to push.
#
def
count
podspec_files
.
count
end
#-----------------------------------------------------------------------#
end
end
end
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