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
a4affd62
Commit
a4affd62
authored
Oct 29, 2013
by
Luis Ascorbe
Committed by
Samuel E. Giddins
Sep 25, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added pod repo list command
parent
acd55a06
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
121 additions
and
0 deletions
+121
-0
CHANGELOG.md
CHANGELOG.md
+7
-0
repo.rb
lib/cocoapods/command/repo.rb
+85
-0
repo_spec.rb
spec/functional/command/repo_spec.rb
+28
-0
command_spec.rb
spec/unit/command_spec.rb
+1
-0
No files found.
CHANGELOG.md
View file @
a4affd62
...
@@ -47,6 +47,13 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
...
@@ -47,6 +47,13 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[
Ladislav Martincik
](
https://github.com/martincik
)
[
Ladislav Martincik
](
https://github.com/martincik
)
[
#2482
](
https://github.com/CocoaPods/CocoaPods/issues/2482
)
[
#2482
](
https://github.com/CocoaPods/CocoaPods/issues/2482
)
##### Enhancements
*
Added the
`pod repo list`
command which lists all the repositories.
[
Luis Ascorbe
](
https://github.com/lascorbe
)
[
#1455
](
https://github.com/CocoaPods/CocoaPods/issues/1455
)
## 0.34.0.rc2
## 0.34.0.rc2
##### Bug Fixes
##### Bug Fixes
...
...
lib/cocoapods/command/repo.rb
View file @
a4affd62
...
@@ -9,6 +9,7 @@ module Pod
...
@@ -9,6 +9,7 @@ module Pod
# @todo should not show a usage banner!
# @todo should not show a usage banner!
#
#
self
.
summary
=
'Manage spec-repositories'
self
.
summary
=
'Manage spec-repositories'
self
.
default_subcommand
=
'list'
class
Add
<
Repo
class
Add
<
Repo
self
.
summary
=
'Add a spec repo.'
self
.
summary
=
'Add a spec repo.'
...
@@ -185,12 +186,96 @@ module Pod
...
@@ -185,12 +186,96 @@ module Pod
end
end
end
end
#-----------------------------------------------------------------------#
class
List
<
Repo
self
.
summary
=
'List repos'
self
.
description
=
<<-
DESC
List the repos from the local spec-repos directory at `~/.cocoapods/repos/.`
DESC
def
self
.
options
[[
"--count"
,
"Show the total number of repos"
]].
concat
(
super
)
end
def
initialize
(
argv
)
@count
=
argv
.
flag?
(
'count'
)
super
end
# @output Examples:
#
# master
# - type: git (origin)
# - URL: https://github.com/CocoaPods/Specs.git
# - path: /Users/lascorbe/.cocoapods/repos/master
#
# test
# - type: local copy
# - path: /Users/lascorbe/.cocoapods/repos/test
#
def
run
sources
=
SourcesManager
.
all
sources
.
each
do
|
source
|
path
=
source
.
data_provider
.
repo
UI
.
title
source
.
name
do
Dir
.
chdir
(
path
)
do
if
SourcesManager
.
git_repo?
(
path
)
branch_name
=
get_branch_name
remote_name
=
get_branch_remote_name
(
branch_name
)
if
remote_name
UI
.
puts
"- Type: git (
#{
remote_name
}
)"
url
=
get_url_of_git_repo
(
remote_name
)
UI
.
puts
"- URL:
#{
url
}
"
else
UI
.
puts
"- Type: git (no remote information available)"
end
else
UI
.
puts
"- Type: local copy"
end
UI
.
puts
"- Path:
#{
path
}
"
end
end
end
if
@count
number_of_repos
=
sources
.
length
repo_string
=
number_of_repos
!=
1
?
'repos'
:
'repo'
UI
.
puts
"
\n
#{
number_of_repos
}
#{
repo_string
}
"
.
green
end
end
end
extend
Executable
extend
Executable
executable
:git
executable
:git
def
dir
def
dir
config
.
repos_dir
+
@name
config
.
repos_dir
+
@name
end
end
# Returns the branch name (i.e. master)
#
def
get_branch_name
git!
(
"name-rev --name-only HEAD"
).
strip
end
# Returns the branch remote name (i.e. origin)
#
# @param [BranchName] branch_name
# The branch name to look for the remote name.
#
def
get_branch_remote_name
(
branch_name
)
`git config branch.
#{
branch_name
}
.remote`
.
strip
end
# Returns the url of the given remote name (i.e. git@github.com:CocoaPods/Specs.git)
#
# @param [RemoteName] remote_name
# The branch remote name to look for the url.
#
def
get_url_of_git_repo
(
remote_name
)
`git config remote.
#{
remote_name
}
.url`
.
strip
end
end
end
end
end
end
end
spec/functional/command/repo_spec.rb
View file @
a4affd62
...
@@ -120,6 +120,34 @@ module Pod
...
@@ -120,6 +120,34 @@ module Pod
lambda
{
run_command
(
'repo'
,
'remove'
,
upstream
)
}.
should
.
not
.
raise
lambda
{
run_command
(
'repo'
,
'remove'
,
upstream
)
}.
should
.
not
.
raise
File
.
directory?
(
test_repo_path
+
upstream
).
should
.
be
.
false?
File
.
directory?
(
test_repo_path
+
upstream
).
should
.
be
.
false?
end
end
end
describe
Command
::
Repo
::
List
do
extend
SpecHelper
::
Command
extend
SpecHelper
::
TemporaryRepos
before
do
set_up_test_repo
config
.
repos_dir
=
SpecHelper
.
tmp_repos_path
end
it
'lists a repository'
do
lambda
{
run_command
(
'repo'
,
'list'
)
}.
should
.
not
.
raise
end
it
'lists a repository (checking the output)'
do
config
.
repos_dir
=
fixture
(
'spec-repos'
)
output
=
run_command
(
'repo'
,
'list'
)
output
.
should
.
include?
'- Type:'
end
it
'lists a repository with count'
do
config
.
repos_dir
=
fixture
(
'spec-repos'
)
output
=
run_command
(
'repo'
,
'list'
,
'--count'
)
output
.
should
.
include?
'repo'
end
end
end
end
end
end
end
spec/unit/command_spec.rb
View file @
a4affd62
...
@@ -9,6 +9,7 @@ module Pod
...
@@ -9,6 +9,7 @@ module Pod
Command
.
parse
(
%w(repo )
).
should
.
be
.
instance_of
Command
::
Repo
Command
.
parse
(
%w(repo )
).
should
.
be
.
instance_of
Command
::
Repo
Command
.
parse
(
%w(repo add )
).
should
.
be
.
instance_of
Command
::
Repo
::
Add
Command
.
parse
(
%w(repo add )
).
should
.
be
.
instance_of
Command
::
Repo
::
Add
Command
.
parse
(
%w(repo lint )
).
should
.
be
.
instance_of
Command
::
Repo
::
Lint
Command
.
parse
(
%w(repo lint )
).
should
.
be
.
instance_of
Command
::
Repo
::
Lint
Command
.
parse
(
%w(repo list )
).
should
.
be
.
instance_of
Command
::
Repo
::
List
Command
.
parse
(
%w(repo update )
).
should
.
be
.
instance_of
Command
::
Repo
::
Update
Command
.
parse
(
%w(repo update )
).
should
.
be
.
instance_of
Command
::
Repo
::
Update
Command
.
parse
(
%w(repo remove )
).
should
.
be
.
instance_of
Command
::
Repo
::
Remove
Command
.
parse
(
%w(repo remove )
).
should
.
be
.
instance_of
Command
::
Repo
::
Remove
Command
.
parse
(
%w(search )
).
should
.
be
.
instance_of
Command
::
Search
Command
.
parse
(
%w(search )
).
should
.
be
.
instance_of
Command
::
Search
...
...
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