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
539dc7d8
Commit
539dc7d8
authored
Sep 25, 2014
by
Samuel E. Giddins
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2522 from CocoaPods/repo-list
Repo list
parents
acd55a06
1f793c53
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
165 additions
and
2 deletions
+165
-2
CHANGELOG.md
CHANGELOG.md
+8
-1
repo.rb
lib/cocoapods/command/repo.rb
+126
-0
repo_spec.rb
spec/functional/command/repo_spec.rb
+29
-0
command_spec.rb
spec/unit/command_spec.rb
+2
-1
No files found.
CHANGELOG.md
View file @
539dc7d8
...
@@ -26,6 +26,12 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
...
@@ -26,6 +26,12 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[
Core#170
](
https://github.com/CocoaPods/Core/issues/170
)
[
Core#170
](
https://github.com/CocoaPods/Core/issues/170
)
[
#2515
](
https://github.com/CocoaPods/CocoaPods/issues/2515
)
[
#2515
](
https://github.com/CocoaPods/CocoaPods/issues/2515
)
##### 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
)
##### Bug Fixes
##### Bug Fixes
*
Works around an Xcode issue where linting would fail even though
`xcodebuild`
*
Works around an Xcode issue where linting would fail even though
`xcodebuild`
...
@@ -43,10 +49,11 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
...
@@ -43,10 +49,11 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[
#2489
](
https://github.com/CocoaPods/CocoaPods/pull/2489
)
[
#2489
](
https://github.com/CocoaPods/CocoaPods/pull/2489
)
*
Fixes an issue where
`pod install`
would crash during Plist building if any
*
Fixes an issue where
`pod install`
would crash during Plist building if any
pod has invalid UTF-8 characters in their title or description.
pod has invalid UTF-8 characters in their title or description.
[
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
)
## 0.34.0.rc2
## 0.34.0.rc2
##### Bug Fixes
##### Bug Fixes
...
...
lib/cocoapods/command/repo.rb
View file @
539dc7d8
...
@@ -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,137 @@ module Pod
...
@@ -185,12 +186,137 @@ 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-only"
,
"Show the total number of repos"
]].
concat
(
super
)
end
def
initialize
(
argv
)
@count_only
=
argv
.
flag?
(
'count-only'
)
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
print_sources
(
sources
)
unless
@count_only
print_count_of_sources
(
sources
)
end
private
# Pretty-prints the source at the given path.
#
# @param [String,Pathname] path
# The path of the source to be printed.
#
# @return [void]
#
def
print_source_at_path
(
path
)
Dir
.
chdir
(
path
)
do
if
SourcesManager
.
git_repo?
(
path
)
remote_name
=
branch_remote_name
(
branch_name
)
if
remote_name
UI
.
puts
"- Type: git (
#{
remote_name
}
)"
url
=
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
# Pretty-prints the given sources.
#
# @param [Array<Source>] sources
# The sources that should be printed.
#
# @return [void]
#
def
print_sources
(
sources
)
sources
.
each
do
|
source
|
UI
.
title
source
.
name
do
print_source_at_path
source
.
data_provider
.
repo
end
end
UI
.
puts
"
\n
"
end
# Pretty-prints the number of sources.
#
# @param [Array<Source>] sources
# The sources whose count should be printed.
#
# @return [void]
#
def
print_count_of_sources
(
sources
)
number_of_repos
=
sources
.
length
repo_string
=
number_of_repos
!=
1
?
'repos'
:
'repo'
UI
.
puts
"
#{
number_of_repos
}
#{
repo_string
}
"
.
green
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).
#
# @return [String] The name of the current branch.
#
def
branch_name
`git name-rev --name-only HEAD`
.
strip
end
# Returns the branch remote name (i.e. origin).
#
# @param [#to_s] branch_name
# The branch name to look for the remote name.
#
# @return [String] The given branch's remote name.
#
def
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 [#to_s] remote_name
# The branch remote name to look for the url.
#
# @return [String] The URL of the given remote.
#
def
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 @
539dc7d8
...
@@ -120,6 +120,35 @@ module Pod
...
@@ -120,6 +120,35 @@ 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
'only prints a count when invoked with --count-only'
do
config
.
repos_dir
=
fixture
(
'spec-repos'
)
output
=
run_command
(
'repo'
,
'list'
,
'--count-only'
)
output
.
should
.
include?
'repo'
output
.
should
.
not
.
include?
'- Type:'
end
end
end
end
end
end
end
spec/unit/command_spec.rb
View file @
539dc7d8
...
@@ -6,9 +6,10 @@ module Pod
...
@@ -6,9 +6,10 @@ module Pod
Command
.
parse
(
%w(install )
).
should
.
be
.
instance_of
Command
::
Install
Command
.
parse
(
%w(install )
).
should
.
be
.
instance_of
Command
::
Install
Command
.
parse
(
%w(list )
).
should
.
be
.
instance_of
Command
::
List
Command
.
parse
(
%w(list )
).
should
.
be
.
instance_of
Command
::
List
Command
.
parse
(
%w(outdated )
).
should
.
be
.
instance_of
Command
::
Outdated
Command
.
parse
(
%w(outdated )
).
should
.
be
.
instance_of
Command
::
Outdated
Command
.
parse
(
%w(repo )
).
should
.
be
.
instance_of
Command
::
Repo
Command
.
parse
(
%w(repo )
).
should
.
be
.
instance_of
Command
::
Repo
::
List
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