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
32735dc3
Commit
32735dc3
authored
Dec 10, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More specs fixes.
parent
88057d18
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
149 additions
and
135 deletions
+149
-135
Gemfile.lock
Gemfile.lock
+2
-2
push.rb
lib/cocoapods/command/push.rb
+12
-13
repo.rb
lib/cocoapods/command/repo.rb
+37
-22
spec.rb
lib/cocoapods/command/spec.rb
+7
-7
validator.rb
lib/cocoapods/validator.rb
+40
-32
master
spec/fixtures/spec-repos/master
+1
-1
push_spec.rb
spec/functional/command/push_spec.rb
+30
-24
repo_spec.rb
spec/functional/command/repo_spec.rb
+2
-1
search_spec.rb
spec/functional/command/search_spec.rb
+8
-23
spec_spec.rb
spec/functional/command/spec_spec.rb
+8
-8
resolver_spec.rb
spec/unit/resolver_spec.rb
+1
-1
validator_spec.rb
spec/unit/validator_spec.rb
+1
-1
No files found.
Gemfile.lock
View file @
32735dc3
GIT
GIT
remote: git://github.com/CocoaPods/Core.git
remote: git://github.com/CocoaPods/Core.git
revision:
55f2db7c1bd2a7311c47c6bd8de3132e9e8853d1
revision:
163c8f3d20aadb91b1987acb57e266ed839040ba
specs:
specs:
cocoapods-core (0.17.0.alpha)
cocoapods-core (0.17.0.alpha)
activesupport (~> 3.2.6)
activesupport (~> 3.2.6)
...
@@ -69,7 +69,7 @@ GEM
...
@@ -69,7 +69,7 @@ GEM
metaclass (~> 0.0.1)
metaclass (~> 0.0.1)
mocha-on-bacon (0.2.1)
mocha-on-bacon (0.2.1)
mocha (>= 0.9.8)
mocha (>= 0.9.8)
multi_json (1.
4
.0)
multi_json (1.
5
.0)
multipart-post (1.1.5)
multipart-post (1.1.5)
octokit (1.19.0)
octokit (1.19.0)
addressable (~> 2.2)
addressable (~> 2.2)
...
...
lib/cocoapods/command/push.rb
View file @
32735dc3
...
@@ -47,14 +47,14 @@ module Pod
...
@@ -47,14 +47,14 @@ module Pod
private
private
def
update_repo
def
update_repo
UI
.
puts
"Updating the `
#{
@repo
}
' repo
\n
"
.
yellow
unless
config
.
silent
UI
.
puts
"Updating the `
#{
@repo
}
' repo
\n
"
.
yellow
# show the output of git even if not verbose
# show the output of git even if not verbose
# TODO: use the `git!' and find a way to show the output in realtime.
# TODO: use the `git!' and find a way to show the output in realtime.
Dir
.
chdir
(
repo_dir
)
{
UI
.
puts
`git pull 2>&1`
}
Dir
.
chdir
(
repo_dir
)
{
UI
.
puts
`git pull 2>&1`
}
end
end
def
push_repo
def
push_repo
UI
.
puts
"
\n
Pushing the `
#{
@repo
}
' repo
\n
"
.
yellow
unless
config
.
silent
UI
.
puts
"
\n
Pushing the `
#{
@repo
}
' repo
\n
"
.
yellow
Dir
.
chdir
(
repo_dir
)
{
UI
.
puts
`git push 2>&1`
}
Dir
.
chdir
(
repo_dir
)
{
UI
.
puts
`git push 2>&1`
}
end
end
...
@@ -64,15 +64,16 @@ module Pod
...
@@ -64,15 +64,16 @@ module Pod
dir
dir
end
end
# @todo: add specs for staged and unstaged files
#
def
check_repo_status
def
check_repo_status
# TODO: add specs for staged and unstaged files (tested manually)
clean
=
Dir
.
chdir
(
repo_dir
)
{
`git status --porcelain 2>&1`
}
==
''
clean
=
Dir
.
chdir
(
repo_dir
)
{
`git status --porcelain 2>&1`
}
==
''
raise
Informative
,
"
[!] `
#{
@repo
}
' repo not clean"
.
red
unless
clean
raise
Informative
,
"
The repo `
#{
@repo
}
` is not clean"
unless
clean
end
end
def
podspec_files
def
podspec_files
files
=
Pathname
.
glob
(
@podspec
||
"*.podspec"
)
files
=
Pathname
.
glob
(
@podspec
||
"*.podspec"
)
raise
Informative
,
"
[!] Couldn't find any .podspec file in current directory"
.
red
if
files
.
empty?
raise
Informative
,
"
Couldn't find any .podspec file in current directory"
if
files
.
empty?
files
files
end
end
...
@@ -83,18 +84,16 @@ module Pod
...
@@ -83,18 +84,16 @@ module Pod
end
end
def
validate_podspec_files
def
validate_podspec_files
UI
.
puts
"
\n
Validating
#{
'spec'
.
pluralize
(
count
)
}
"
.
yellow
unless
config
.
silent
UI
.
puts
"
\n
Validating
#{
'spec'
.
pluralize
(
count
)
}
"
.
yellow
lint_argv
=
[
"lint"
]
lint_argv
<<
"--only-errors"
if
@allow_warnings
lint_argv
<<
"--silent"
if
config
.
silent
# all_valid = true
podspec_files
.
each
do
|
podspec
|
podspec_files
.
each
do
|
podspec
|
Spec
.
parse
(
lint_argv
+
[
podspec
.
to_s
]).
run
validator
=
Validator
.
new
(
podspec
)
validator
.
validate
raise
Informative
,
"The `
#{
podspec
}
` specification does not validate."
unless
validator
.
validated?
end
end
end
end
def
add_specs_to_repo
def
add_specs_to_repo
UI
.
puts
"
\n
Adding the
#{
'spec'
.
pluralize
(
count
)
}
to the `
#{
@repo
}
' repo
\n
"
.
yellow
unless
config
.
silent
UI
.
puts
"
\n
Adding the
#{
'spec'
.
pluralize
(
count
)
}
to the `
#{
@repo
}
' repo
\n
"
.
yellow
podspec_files
.
each
do
|
spec_file
|
podspec_files
.
each
do
|
spec_file
|
spec
=
Pod
::
Specification
.
from_file
(
spec_file
)
spec
=
Pod
::
Specification
.
from_file
(
spec_file
)
output_path
=
File
.
join
(
repo_dir
,
spec
.
name
,
spec
.
version
.
to_s
)
output_path
=
File
.
join
(
repo_dir
,
spec
.
name
,
spec
.
version
.
to_s
)
...
@@ -105,7 +104,7 @@ module Pod
...
@@ -105,7 +104,7 @@ module Pod
else
else
message
=
"[Add]
#{
spec
}
"
message
=
"[Add]
#{
spec
}
"
end
end
UI
.
puts
" -
#{
message
}
"
unless
config
.
silent
UI
.
puts
" -
#{
message
}
"
FileUtils
.
mkdir_p
(
output_path
)
FileUtils
.
mkdir_p
(
output_path
)
FileUtils
.
cp
(
Pathname
.
new
(
spec
.
name
+
'.podspec'
),
output_path
)
FileUtils
.
cp
(
Pathname
.
new
(
spec
.
name
+
'.podspec'
),
output_path
)
...
...
lib/cocoapods/command/repo.rb
View file @
32735dc3
...
@@ -40,6 +40,8 @@ module Pod
...
@@ -40,6 +40,8 @@ module Pod
end
end
end
end
#-----------------------------------------------------------------------#
class
Update
<
Repo
class
Update
<
Repo
self
.
summary
=
'Update a spec repo.'
self
.
summary
=
'Update a spec repo.'
...
@@ -73,6 +75,8 @@ module Pod
...
@@ -73,6 +75,8 @@ module Pod
end
end
end
end
#-----------------------------------------------------------------------#
class
Lint
<
Repo
class
Lint
<
Repo
self
.
summary
=
'Validates all specs in a repo.'
self
.
summary
=
'Validates all specs in a repo.'
...
@@ -106,33 +110,44 @@ module Pod
...
@@ -106,33 +110,44 @@ module Pod
podspecs
=
Pathname
.
glob
(
dir
+
'**/*.podspec'
)
podspecs
=
Pathname
.
glob
(
dir
+
'**/*.podspec'
)
invalid_count
=
0
invalid_count
=
0
messages_by_type
=
{}
podspecs
.
each
do
|
podspec
|
podspecs
.
each
do
|
podspec
|
linter
=
Validator
.
new
(
podspec
)
print
"
\033
[K ->
#{
podspec
.
relative_path_from
(
dir
)
}
\r
"
linter
.
quick
=
true
validator
=
Validator
.
new
(
podspec
)
linter
.
repo_path
=
dir
validator
.
quick
=
true
validator
.
repo_path
=
dir
linter
.
lint
validator
.
only_errors
=
@only_errors
validator
.
disable_ui_output
=
true
case
linter
.
result_type
when
:error
validator
.
validate
invalid_count
+=
1
invalid_count
+=
1
if
validator
.
result_type
==
:error
color
=
:red
unless
validator
.
validated?
should_display
=
true
if
@only_errors
when
:warning
results
=
validator
.
results
.
select
{
|
r
|
r
.
type
.
to_s
==
"error"
}
color
=
:yellow
else
should_display
=
!
@only_errors
results
=
validator
.
results
end
results
.
each
do
|
result
|
messages_by_type
[
result
.
type
]
||=
{}
messages_by_type
[
result
.
type
][
result
.
message
]
||=
[]
name
=
validator
.
spec
?
validator
.
spec
.
to_s
:
podspec
.
relative_path_from
(
dir
)
messages_by_type
[
result
.
type
][
result
.
message
]
<<
name
end
end
end
end
if
should_display
print
"
\033
[K"
UI
.
puts
" -> "
.
send
(
color
)
<<
linter
.
spec_name
messages_by_type
.
each
do
|
type
,
messages_by_type
|
print_messages
(
'ERROR'
,
linter
.
errors
)
messages_by_type
.
each
do
|
message
,
names
|
unless
@only_errors
color
=
type
==
:error
?
:
red
:
:yellow
print_messages
(
'WARN'
,
linter
.
warnings
)
UI
.
puts
"[
#{
type
}
]
#{
message
}
"
.
send
(
color
)
print_messages
(
'NOTE'
,
linter
.
notes
)
names
.
each
{
|
name
|
UI
.
puts
" -
#{
name
}
"
}
end
UI
.
puts
UI
.
puts
unless
config
.
silent?
end
end
end
end
UI
.
puts
"Analyzed
#{
podspecs
.
count
}
podspecs files.
\n\n
"
unless
config
.
silent?
UI
.
puts
"Analyzed
#{
podspecs
.
count
}
podspecs files.
\n\n
"
unless
config
.
silent?
if
invalid_count
==
0
if
invalid_count
==
0
...
...
lib/cocoapods/command/spec.rb
View file @
32735dc3
...
@@ -86,20 +86,20 @@ module Pod
...
@@ -86,20 +86,20 @@ module Pod
UI
.
puts
UI
.
puts
invalid_count
=
0
invalid_count
=
0
podspecs_to_lint
.
each
do
|
podspec
|
podspecs_to_lint
.
each
do
|
podspec
|
validator
=
Validator
.
new
(
podspec
)
validator
=
Validator
.
new
(
podspec
)
validator
.
quick
=
@quick
validator
.
quick
=
@quick
validator
.
local
=
@local
validator
.
local
=
@local
validator
.
no_clean
=
@no_clean
validator
.
no_clean
=
@no_clean
validator
.
only_errors
=
@only_errors
validator
.
validate
validator
.
validate
invalid_count
+=
1
unless
validator
.
validated?
invalid_count
+=
1
unless
validator
.
validated?
end
end
count
=
podspecs_to_lint
.
count
count
=
podspecs_to_lint
.
count
UI
.
puts
"Analyzed
#{
count
}
#{
'podspec'
.
pluralize
(
count
)
}
.
\n\n
"
unless
config
.
silent?
UI
.
puts
"Analyzed
#{
count
}
#{
'podspec'
.
pluralize
(
count
)
}
.
\n\n
"
if
invalid_count
==
0
if
invalid_count
==
0
lint_passed_message
=
count
==
1
?
"
#{
podspecs_to_lint
.
first
.
basename
}
passed validation."
:
"All the specs passed validation."
lint_passed_message
=
count
==
1
?
"
#{
podspecs_to_lint
.
first
.
basename
}
passed validation."
:
"All the specs passed validation."
UI
.
puts
lint_passed_message
.
green
<<
"
\n\n
"
unless
config
.
silent?
UI
.
puts
lint_passed_message
.
green
<<
"
\n\n
"
else
else
raise
Informative
,
count
==
1
?
"The spec did not pass validation."
:
"
#{
invalid_count
}
out of
#{
count
}
specs failed validation."
raise
Informative
,
count
==
1
?
"The spec did not pass validation."
:
"
#{
invalid_count
}
out of
#{
count
}
specs failed validation."
end
end
...
...
lib/cocoapods/validator.rb
View file @
32735dc3
...
@@ -48,14 +48,26 @@ module Pod
...
@@ -48,14 +48,26 @@ module Pod
#
#
def
validate
def
validate
@results
=
[]
@results
=
[]
print
" ->
#{
spec
.
name
}
\r
"
unless
config
.
silent?
unless
disable_ui_output
$stdout
.
flush
print
" ->
#{
spec
?
spec
.
name
:
file
.
basename
}
\r
"
unless
config
.
silent?
$stdout
.
flush
end
perform_linting
perform_linting
check_repo_path
if
repo_path
perform_extensive_analysis
unless
quick
UI
.
puts
" -> "
.
send
(
result_color
)
<<
spec
.
name
begin
print_results
if
spec
check_repo_path
if
repo_path
perform_extensive_analysis
unless
quick
end
rescue
Exception
=>
e
error
"The specification is malformed and crashed the linter."
end
unless
disable_ui_output
UI
.
puts
" -> "
.
send
(
result_color
)
<<
(
spec
?
spec
.
name
:
file
.
basename
.
to_s
)
print_results
end
validated?
validated?
end
end
...
@@ -83,10 +95,12 @@ module Pod
...
@@ -83,10 +95,12 @@ module Pod
UI
.
puts
UI
.
puts
end
end
#-----------------------------------------------------------------------#
#-----------------------------------------------------------------------
--
#
# @!group Configuration
# @!group Configuration
attr_accessor
:disable_ui_output
# @return [Pathname] whether the validation should be performed against a repo.
# @return [Pathname] whether the validation should be performed against a repo.
#
#
attr_accessor
:repo_path
attr_accessor
:repo_path
...
@@ -112,7 +126,7 @@ module Pod
...
@@ -112,7 +126,7 @@ module Pod
#
#
attr_accessor
:only_errors
attr_accessor
:only_errors
#-----------------------------------------------------------------------#
#-----------------------------------------------------------------------
--
#
# !@group Lint results
# !@group Lint results
...
@@ -124,7 +138,7 @@ module Pod
...
@@ -124,7 +138,7 @@ module Pod
#
#
def
validated?
def
validated?
return
false
if
result_type
==
:error
return
false
if
result_type
==
:error
return
false
if
result_type
==
:warning
s
&&
!
only_errors
return
false
if
result_type
==
:warning
&&
!
only_errors
return
true
return
true
end
end
...
@@ -157,7 +171,7 @@ module Pod
...
@@ -157,7 +171,7 @@ module Pod
Pathname
.
new
(
'/tmp/CocoaPods/Lint'
)
Pathname
.
new
(
'/tmp/CocoaPods/Lint'
)
end
end
#-----------------------------------------------------------------------#
#-----------------------------------------------------------------------
--
#
private
private
...
@@ -244,9 +258,9 @@ module Pod
...
@@ -244,9 +258,9 @@ module Pod
parsed_output
=
parse_xcodebuild_output
(
output
)
parsed_output
=
parse_xcodebuild_output
(
output
)
parsed_output
.
each
do
|
message
|
parsed_output
.
each
do
|
message
|
if
message
.
include?
(
'error: '
)
if
message
.
include?
(
'error: '
)
error
"
XCODEBUILD
#{
message
}
"
error
"
[xcodebuild]
#{
message
}
"
else
else
note
"
XCODEBUILD
#{
message
}
"
note
"
[xcodebuild]
#{
message
}
"
end
end
end
end
end
end
...
@@ -260,7 +274,6 @@ module Pod
...
@@ -260,7 +274,6 @@ module Pod
# @return [void]
# @return [void]
#
#
def
check_file_patterns
def
check_file_patterns
puts
spec
.
preserve_paths
[
:source_files
,
:resources
,
:preserve_paths
].
each
do
|
attr_name
|
[
:source_files
,
:resources
,
:preserve_paths
].
each
do
|
attr_name
|
attr
=
Specification
::
DSL
.
attributes
.
find
{
|
attr
|
attr
.
name
==
attr_name
}
attr
=
Specification
::
DSL
.
attributes
.
find
{
|
attr
|
attr
.
name
==
attr_name
}
if
!
attr
.
empty?
(
spec
)
&&
@pod
.
send
(
attr_name
).
empty?
if
!
attr
.
empty?
(
spec
)
&&
@pod
.
send
(
attr_name
).
empty?
...
@@ -273,11 +286,11 @@ module Pod
...
@@ -273,11 +286,11 @@ module Pod
end
end
end
end
#-----------------------------------------------------------------------#
#-----------------------------------------------------------------------
--
#
private
private
# !@group Helpers
# !@group
Result
Helpers
def
error
(
message
)
def
error
(
message
)
add_result
(
:error
,
message
)
add_result
(
:error
,
message
)
...
@@ -300,6 +313,12 @@ module Pod
...
@@ -300,6 +313,12 @@ module Pod
result
.
platforms
<<
current_platform
.
name
if
current_platform
result
.
platforms
<<
current_platform
.
name
if
current_platform
end
end
#-------------------------------------------------------------------------#
private
# !@group Helpers
# @return [Podfile] a podfile that requires the specification on the
# @return [Podfile] a podfile that requires the specification on the
# current platform.
# current platform.
#
#
...
@@ -321,17 +340,14 @@ module Pod
...
@@ -321,17 +340,14 @@ module Pod
podfile
podfile
end
end
# @return [Pathname] the root of the installed pod.
#
def
pod_dir
validation_dir
+
'Pods'
+
spec
.
name
end
# Parse the xcode build output to identify the lines which are relevant
# Parse the xcode build output to identify the lines which are relevant
# to the linter.
It also removes the indentation and the temporary path.
# to the linter.
#
#
# @param [String] output the output generated by the xcodebuild tool.
# @param [String] output the output generated by the xcodebuild tool.
#
#
# @note The indentation and the temporary path is stripped form the
# lines.
#
# @return [Array<String>] the lines that are relevant to the linter.
# @return [Array<String>] the lines that are relevant to the linter.
#
#
def
parse_xcodebuild_output
(
output
)
def
parse_xcodebuild_output
(
output
)
...
@@ -343,17 +359,9 @@ module Pod
...
@@ -343,17 +359,9 @@ module Pod
l
.
include?
(
'note: '
)
&&
(
l
!~
/expanded from macro/
)
l
.
include?
(
'note: '
)
&&
(
l
!~
/expanded from macro/
)
end
end
selected_lines
.
map
do
|
l
|
selected_lines
.
map
do
|
l
|
new
=
l
.
gsub
(
/\/tmp\/CocoaPods\/Lint\/Pods\//
,
''
)
# Remove the unnecessary tmp path
new
=
l
.
gsub
(
/\/tmp\/CocoaPods\/Lint\/Pods\//
,
''
)
new
.
gsub!
(
/^ */
,
' '
)
# Remove indentation
new
.
gsub!
(
/^ */
,
' '
)
"XCODEBUILD > "
<<
new
# Mark
end
end
end
end
#
#
def
print_messages
(
type
,
messages
)
return
if
config
.
silent?
messages
.
each
{
|
msg
|
UI
.
puts
" -
#{
type
.
ljust
(
5
)
}
|
#{
msg
}
"
}
end
end
end
end
end
master
@
7f3cc9e1
Subproject commit
84ea24c2f3a5d463da1e7945c60fd3f33f73dee2
Subproject commit
7f3cc9e12b0a459582d606baa7fc906006965f54
spec/functional/command/push_spec.rb
View file @
32735dc3
...
@@ -29,24 +29,33 @@ module Pod
...
@@ -29,24 +29,33 @@ module Pod
e
.
message
.
should
.
match
(
/Couldn't find any .podspec/
)
e
.
message
.
should
.
match
(
/Couldn't find any .podspec/
)
end
end
# TODO: the validation should not use the pod spec command
it
"it raises if the specification doesn't validate"
do
xit
"it raises if the specification doesn't validates"
do
repo_make
(
'test_repo'
)
repo_make
(
'test_repo'
)
Dir
.
chdir
(
temporary_directory
)
do
Dir
.
chdir
(
temporary_directory
)
do
spec
=
"Spec.new do |s|; s.name = 'Broken'; end"
spec
=
"Spec.new do |s|; s.name = 'Broken';
s.version = '1.0'
end"
File
.
open
(
'Broken.podspec'
,
'w'
)
{
|
f
|
f
.
write
(
spec
)
}
File
.
open
(
'Broken.podspec'
,
'w'
)
{
|
f
|
f
.
write
(
spec
)
}
cmd
=
command
(
'push'
,
'test_repo'
)
cmd
=
command
(
'push'
,
'test_repo'
)
cmd
.
expects
(
:validate_podspec_files
).
returns
(
true
)
Validator
.
any_instance
.
stubs
(
:validated?
).
returns
(
false
)
e
=
lambda
{
cmd
.
run
}.
should
.
raise
Pod
::
Informative
e
=
lambda
{
cmd
.
run
}.
should
.
raise
Pod
::
Informative
e
.
message
.
should
.
match
(
/
repo not clean
/
)
e
.
message
.
should
.
match
(
/
Broken.podspec.*does not validate
/
)
end
end
end
end
#--------------------------------------#
#--------------------------------------#
before
do
before
do
repo_make
(
'upstream'
)
set_up_test_repo
repo_clone
(
'upstream'
,
'local_repo'
)
config
.
repos_dir
=
SpecHelper
.
tmp_repos_path
@upstream
=
SpecHelper
.
temporary_directory
+
'upstream'
FileUtils
.
cp_r
(
test_repo_path
,
@upstream
)
Dir
.
chdir
(
test_repo_path
)
do
`git remote add origin
#{
@upstream
}
`
`git remote -v`
`git fetch -q`
`git branch --set-upstream master origin/master`
end
# prepare the spec
# prepare the spec
spec
=
(
fixture
(
'spec-repos'
)
+
'master/JSONKit/1.4/JSONKit.podspec'
).
read
spec
=
(
fixture
(
'spec-repos'
)
+
'master/JSONKit/1.4/JSONKit.podspec'
).
read
...
@@ -57,29 +66,26 @@ module Pod
...
@@ -57,29 +66,26 @@ module Pod
end
end
it
"refuses to push if the repo is not clean"
do
it
"refuses to push if the repo is not clean"
do
repo_make_readme_change
(
'local_repo'
,
'dirty'
)
Dir
.
chdir
(
test_repo_path
)
do
Dir
.
chdir
(
temporary_directory
)
do
`touch DIRTY_FILE`
cmd
=
command
(
'push'
,
'local_repo'
)
cmd
.
expects
(
:validate_podspec_files
).
returns
(
true
)
e
=
lambda
{
cmd
.
run
}.
should
.
raise
Pod
::
Informative
e
.
message
.
should
.
match
(
/repo not clean/
)
end
end
(
repo_path
(
'upstream'
)
+
'PushTest/1.4/PushTest.podspec'
).
should
.
not
.
exist?
cmd
=
command
(
'push'
,
'master'
)
cmd
.
expects
(
:validate_podspec_files
).
returns
(
true
)
e
=
lambda
{
cmd
.
run
}.
should
.
raise
Pod
::
Informative
e
.
message
.
should
.
match
(
/repo.*not clean/
)
(
@upstream
+
'PushTest/1.4/PushTest.podspec'
).
should
.
not
.
exist?
end
end
it
"sucessfully pushes a spec"
do
it
"successfully pushes a spec"
do
cmd
=
command
(
'push'
,
'local_repo'
)
Dir
.
chdir
(
repo_path
'upstream'
)
{
`git checkout -b tmp_for_push -q`
}
cmd
=
command
(
'push'
,
'master'
)
Dir
.
chdir
(
@upstream
)
{
`git checkout -b tmp_for_push -q`
}
cmd
.
expects
(
:validate_podspec_files
).
returns
(
true
)
cmd
.
expects
(
:validate_podspec_files
).
returns
(
true
)
Dir
.
chdir
(
temporary_directory
)
{
cmd
.
run
}
Dir
.
chdir
(
temporary_directory
)
{
cmd
.
run
}
Pod
::
UI
.
output
.
should
.
include
(
'[Add] PushTest (1.4)'
)
Pod
::
UI
.
output
.
should
.
include
(
'[Add] PushTest (1.4)'
)
Pod
::
UI
.
output
.
should
.
include
(
'[Add] JSONKit (1.4)'
)
Pod
::
UI
.
output
.
should
.
include
(
'[Fix] JSONKit (1.4)'
)
# TODO check the commit messages
Dir
.
chdir
(
@upstream
)
{
`git checkout master -q`
}
# Pod::UI.output.should.include('[Fix] JSONKit (1.4)')
(
@upstream
+
'PushTest/1.4/PushTest.podspec'
).
read
.
should
.
include
(
'PushTest'
)
Dir
.
chdir
(
repo_path
'upstream'
)
{
`git checkout master -q`
}
(
repo_path
(
'upstream'
)
+
'PushTest/1.4/PushTest.podspec'
).
read
.
should
.
include
(
'PushTest'
)
end
end
end
end
end
end
spec/functional/command/repo_spec.rb
View file @
32735dc3
...
@@ -25,7 +25,8 @@ module Pod
...
@@ -25,7 +25,8 @@ module Pod
end
end
it
"lints a repository"
do
it
"lints a repository"
do
lambda
{
run_command
(
'repo'
,
'lint'
,
temporary_directory
.
to_s
)
}.
should
.
not
.
raise
repo
=
fixture
(
'spec-repos/test_repo'
).
to_s
lambda
{
run_command
(
'repo'
,
'lint'
,
repo
)
}.
should
.
not
.
raise
end
end
it
"adds a spec-repo"
do
it
"adds a spec-repo"
do
...
...
spec/functional/command/search_spec.rb
View file @
32735dc3
...
@@ -6,12 +6,13 @@ module Pod
...
@@ -6,12 +6,13 @@ module Pod
extend
SpecHelper
::
TemporaryRepos
extend
SpecHelper
::
TemporaryRepos
before
do
before
do
config
.
repos_dir
=
fixture
(
'spec-repos'
)
set_up_test_repo
config
.
repos_dir
=
SpecHelper
.
tmp_repos_path
end
end
it
"runs with correct parameters"
do
it
"runs with correct parameters"
do
lambda
{
run_command
(
'search'
,
'
table
'
)
}.
should
.
not
.
raise
lambda
{
run_command
(
'search'
,
'
JSON
'
)
}.
should
.
not
.
raise
lambda
{
run_command
(
'search'
,
'
table
'
,
'--full'
)
}.
should
.
not
.
raise
lambda
{
run_command
(
'search'
,
'
JSON
'
,
'--full'
)
}.
should
.
not
.
raise
end
end
it
"complains for wrong parameters"
do
it
"complains for wrong parameters"
do
...
@@ -21,30 +22,14 @@ module Pod
...
@@ -21,30 +22,14 @@ module Pod
lambda
{
run_command
(
'search'
,
'--wrong'
)
}.
should
.
raise
CLAide
::
Help
lambda
{
run_command
(
'search'
,
'--wrong'
)
}.
should
.
raise
CLAide
::
Help
end
end
it
"presents the search results"
do
output
=
run_command
(
'search'
,
'table'
)
output
.
should
.
include
'EGOTableViewPullRefresh'
end
it
"searches for a pod with name matching the given query ignoring case"
do
it
"searches for a pod with name matching the given query ignoring case"
do
[
output
=
run_command
(
'search'
,
'json'
)
[
' s '
,
%w{ ASIHTTPRequest ASIWebPageRequest JSONKit SSZipArchive }
],
output
.
should
.
include?
'JSONKit'
[
'json'
,
%w{ JSONKit SBJson }
],
].
each
do
|
query
,
results
|
output
=
run_command
(
'search'
,
query
)
results
.
each
{
|
pod
|
output
.
should
.
include?
pod
}
end
end
end
it
"searches for a pod with name, summary, or description matching the given query ignoring case"
do
it
"searches for a pod with name, summary, or description matching the given query ignoring case"
do
[
output
=
run_command
(
'search'
,
'Engelhart'
,
'--full'
)
[
'dROP'
,
%w{ Reachability }
],
output
.
should
.
include?
'JSONKit'
[
'is'
,
%w{ ASIHTTPRequest SSZipArchive }
],
[
'luke redpath'
,
%w{ Kiwi libPusher LRMocky LRResty LRTableModel}
],
].
each
do
|
query
,
results
|
output
=
run_command
(
'search'
,
query
,
'--full'
)
results
.
each
{
|
pod
|
output
.
should
.
include?
pod
}
end
end
end
end
end
end
end
spec/functional/command/spec_spec.rb
View file @
32735dc3
...
@@ -118,7 +118,7 @@ module Pod
...
@@ -118,7 +118,7 @@ module Pod
before
do
before
do
text
=
(
fixture
(
'spec-repos'
)
+
'master/JSONKit/1.4/JSONKit.podspec'
).
read
text
=
(
fixture
(
'spec-repos'
)
+
'master/JSONKit/1.4/JSONKit.podspec'
).
read
text
.
gsub!
(
/.*license.*/
,
""
)
text
.
gsub!
(
/.*license.*/
,
"
s.license = { :file => 'some_file'}
"
)
file
=
temporary_directory
+
'JSONKit.podspec'
file
=
temporary_directory
+
'JSONKit.podspec'
File
.
open
(
file
,
'w'
)
{
|
f
|
f
.
write
(
text
)
}
File
.
open
(
file
,
'w'
)
{
|
f
|
f
.
write
(
text
)
}
@spec_path
=
file
.
to_s
@spec_path
=
file
.
to_s
...
@@ -136,28 +136,28 @@ module Pod
...
@@ -136,28 +136,28 @@ module Pod
UI
.
output
.
should
.
include
"Missing license type"
UI
.
output
.
should
.
include
"Missing license type"
end
end
end
end
describe
"Command::Spec#cat"
do
describe
"Command::Spec#cat"
do
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
extend
SpecHelper
::
TemporaryRepos
it
"complains it cant't find a spec to read"
do
it
"complains it cant't find a spec to read"
do
lambda
{
command
(
'spec'
,
'cat'
,
'not-exissting-spec'
).
run
}.
should
.
raise
Informative
lambda
{
command
(
'spec'
,
'cat'
,
'not-exissting-spec'
).
run
}.
should
.
raise
Informative
end
end
it
"complains provided spec name is ambigious"
do
it
"complains provided spec name is ambigious"
do
e
=
lambda
{
command
(
'spec'
,
'cat'
,
'AF'
).
run
}.
should
.
raise
Informative
e
=
lambda
{
command
(
'spec'
,
'cat'
,
'AF'
).
run
}.
should
.
raise
Informative
e
.
message
.
should
.
match
/More that one/
e
.
message
.
should
.
match
/More that one/
end
end
it
"prints the spec on standard output"
do
it
"prints the spec on standard output"
do
lambda
{
command
(
'spec'
,
'cat'
,
'JRSwizzle'
).
run
}.
should
.
not
.
raise
lambda
{
command
(
'spec'
,
'cat'
,
'JRSwizzle'
).
run
}.
should
.
not
.
raise
text
=
(
fixture
(
'spec-repos'
)
+
'master/JRSwizzle/1.0/JRSwizzle.podspec'
).
read
text
=
(
fixture
(
'spec-repos'
)
+
'master/JRSwizzle/1.0/JRSwizzle.podspec'
).
read
#output.gsub(/\n/,'').should.equsal text.gsub(/\n/,'')
#output.gsub(/\n/,'').should.equsal text.gsub(/\n/,'')
UI
.
output
.
should
.
include
text
.
gsub
(
/\n/
,
''
)
UI
.
output
.
should
.
include
text
.
gsub
(
/\n/
,
''
)
end
end
end
end
end
end
spec/unit/resolver_spec.rb
View file @
32735dc3
...
@@ -112,7 +112,7 @@ module Pod
...
@@ -112,7 +112,7 @@ module Pod
it
"includes all the subspecs of a specification node"
do
it
"includes all the subspecs of a specification node"
do
@podfile
=
Podfile
.
new
do
@podfile
=
Podfile
.
new
do
platform
:ios
platform
:ios
pod
'RestKit'
pod
'RestKit'
,
'0.10.3'
end
end
resolver
=
Resolver
.
new
(
config
.
sandbox
,
@podfile
)
resolver
=
Resolver
.
new
(
config
.
sandbox
,
@podfile
)
resolver
.
resolve
.
values
.
flatten
.
map
(
&
:name
).
sort
.
should
==
%w{
resolver
.
resolve
.
values
.
flatten
.
map
(
&
:name
).
sort
.
should
==
%w{
...
...
spec/unit/validator_spec.rb
View file @
32735dc3
...
@@ -63,7 +63,7 @@ module Pod
...
@@ -63,7 +63,7 @@ module Pod
validator
.
stubs
(
:check_file_patterns
)
validator
.
stubs
(
:check_file_patterns
)
validator
.
validate
validator
.
validate
first
=
validator
.
results
.
map
(
&
:to_s
).
first
first
=
validator
.
results
.
map
(
&
:to_s
).
first
first
.
should
.
include
"
[NOTE] XCODEBUILD
"
first
.
should
.
include
"
xcodebuild
"
first
.
should
.
include
"JSONKit/JSONKit.m:1640:27: warning: equality comparison"
first
.
should
.
include
"JSONKit/JSONKit.m:1640:27: warning: equality comparison"
first
.
should
.
include
"[OS X - iOS]"
first
.
should
.
include
"[OS X - iOS]"
validator
.
result_type
.
should
==
:note
validator
.
result_type
.
should
==
:note
...
...
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