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
3a8cbe64
Commit
3a8cbe64
authored
Nov 12, 2014
by
Olivier Halligon
Committed by
Olivier Halligon
Nov 13, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for CocoaPods/Core#188
parent
3cbfa114
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
5 deletions
+41
-5
search.rb
lib/cocoapods/command/search.rb
+7
-2
spec.rb
lib/cocoapods/command/spec.rb
+1
-1
Foo+Bar.podspec
...fixtures/spec-repos/test_repo/Foo+Bar/1.0/Foo+Bar.podspec
+17
-0
list_spec.rb
spec/functional/command/list_spec.rb
+4
-1
search_spec.rb
spec/functional/command/search_spec.rb
+12
-1
No files found.
lib/cocoapods/command/search.rb
View file @
3a8cbe64
...
...
@@ -15,6 +15,7 @@ module Pod
def
self
.
options
[
[
'--regex'
,
'Interpret the `QUERY` as a regular expression'
],
[
'--full'
,
'Search by name, summary, and description'
],
[
'--stats'
,
'Show additional stats (like GitHub watchers and forks)'
],
[
'--ios'
,
'Restricts the search to Pods supported on iOS'
],
...
...
@@ -24,6 +25,7 @@ module Pod
end
def
initialize
(
argv
)
@use_regex
=
argv
.
flag?
(
'regex'
)
@full_text_search
=
argv
.
flag?
(
'full'
)
@stats
=
argv
.
flag?
(
'stats'
)
@supported_on_ios
=
argv
.
flag?
(
'ios'
)
...
...
@@ -38,7 +40,7 @@ module Pod
super
help!
'A search query is required.'
unless
@query
unless
@web
unless
@web
||
!
@use_regex
begin
/
#{
@query
.
join
(
' '
).
strip
}
/
rescue
RegexpError
...
...
@@ -71,7 +73,10 @@ module Pod
end
def
local_search
sets
=
SourcesManager
.
search_by_name
(
@query
.
join
(
' '
).
strip
,
@full_text_search
)
query_regex
=
@query
.
join
(
' '
).
strip
query_regex
=
Regexp
.
escape
(
query_regex
)
unless
@use_regex
sets
=
SourcesManager
.
search_by_name
(
query_regex
,
@full_text_search
)
if
@supported_on_ios
sets
.
reject!
{
|
set
|
!
set
.
specification
.
available_platforms
.
map
(
&
:name
).
include?
(
:ios
)
}
end
...
...
lib/cocoapods/command/spec.rb
View file @
3a8cbe64
...
...
@@ -337,7 +337,7 @@ module Pod
# @return [Pathname] the absolute path or paths of the given podspec
#
def
get_path_of_spec
(
spec
,
show_all
=
false
)
sets
=
SourcesManager
.
search_by_name
(
spec
)
sets
=
SourcesManager
.
search_by_name
(
Regexp
.
escape
(
spec
)
)
if
sets
.
count
==
1
set
=
sets
.
first
...
...
spec/fixtures/spec-repos/test_repo/Foo+Bar/1.0/Foo+Bar.podspec
0 → 100644
View file @
3a8cbe64
Pod
::
Spec
.
new
do
|
s
|
s
.
name
=
'Foo+Bar'
s
.
version
=
'1.0'
s
.
authors
=
'FooBar Corp'
s
.
homepage
=
'http://foobar-corp.local/foobar.html'
s
.
summary
=
'Wohoo foobars!'
s
.
description
=
'Silly foos, silly bars.'
s
.
platform
=
:ios
s
.
source
=
{
:git
=>
'http://foobar-corp.local/foobar.git'
,
:tag
=>
'1.0'
}
s
.
source_files
=
'Classes/*.{h,m}'
s
.
license
=
{
:type
=>
'MIT'
,
:file
=>
'LICENSE'
,
:text
=>
'Permission is hereby granted ...'
}
end
spec/functional/command/list_spec.rb
View file @
3a8cbe64
...
...
@@ -22,11 +22,14 @@ module Pod
jsonkit_set
=
sets
.
find
{
|
s
|
s
.
name
==
'JSONKit'
}
dates
=
{
'BananaLib'
=>
Time
.
now
,
'JSONKit'
=>
Time
.
parse
(
'01/01/1970'
)
}
'JSONKit'
=>
Time
.
parse
(
'01/01/1970'
),
'Foo+Bar'
=>
Time
.
parse
(
'01/01/1970'
),
}
Specification
::
Set
::
Statistics
.
any_instance
.
stubs
(
:creation_dates
).
returns
(
dates
)
out
=
run_command
(
'list'
,
'new'
)
out
.
should
.
include
(
'BananaLib'
)
out
.
should
.
not
.
include
(
'JSONKit'
)
out
.
should
.
not
.
include
(
'Foo+Bar'
)
end
it
'presents the known pods with versions'
do
...
...
spec/functional/command/search_spec.rb
View file @
3a8cbe64
...
...
@@ -51,7 +51,18 @@ module Pod
end
it
'shows a friendly message when locally searching with invalid regex'
do
lambda
{
run_command
(
'search'
,
'+'
)
}.
should
.
raise
CLAide
::
Help
lambda
{
run_command
(
'search'
,
'--regex'
,
'+'
)
}.
should
.
raise
CLAide
::
Help
end
it
'uses regex when asked for regex mode'
do
output
=
run_command
(
'search'
,
'--regex'
,
'Ba(na)+Lib'
)
output
.
should
.
include?
'BananaLib'
end
it
'uses plain-text search when not asked for regex mode'
do
output
=
run_command
(
'search'
,
'Foo+Bar'
)
output
.
should
.
include?
'Foo+Bar'
output
.
should
.
not
.
include?
'BananaLib'
end
describe
'option --web'
do
...
...
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