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
a587e4c4
Commit
a587e4c4
authored
Apr 23, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Pod::Command::Spec] support for subspecs
parent
deb70fb0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
21 deletions
+28
-21
spec.rb
lib/cocoapods/command/spec.rb
+27
-20
specification.rb
lib/cocoapods/specification.rb
+1
-1
No files found.
lib/cocoapods/command/spec.rb
View file @
a587e4c4
...
@@ -18,7 +18,6 @@ module Pod
...
@@ -18,7 +18,6 @@ module Pod
provided it validates all its specs.}
provided it validates all its specs.}
end
end
def
self
.
options
def
self
.
options
[
[
"--no-install"
,
"Lint skips checks that would require to donwload the spec"
],
[
[
"--no-install"
,
"Lint skips checks that would require to donwload the spec"
],
[
"--only-errors"
,
"Lint validates even if warnings are present"
]
].
concat
(
super
)
[
"--only-errors"
,
"Lint validates even if warnings are present"
]
].
concat
(
super
)
...
@@ -68,7 +67,6 @@ module Pod
...
@@ -68,7 +67,6 @@ module Pod
end
end
puts
puts
all_valid
=
lint_specs_files
(
files
,
is_repo
)
all_valid
=
lint_specs_files
(
files
,
is_repo
)
raise
Informative
,
"[!] Not all specs passed validation"
.
red
unless
all_valid
raise
Informative
,
"[!] Not all specs passed validation"
.
red
unless
all_valid
end
end
...
@@ -85,9 +83,13 @@ module Pod
...
@@ -85,9 +83,13 @@ module Pod
def
lint_specs_files
(
files
,
is_repo
)
def
lint_specs_files
(
files
,
is_repo
)
tmp_dir
=
Pathname
.
new
(
'/tmp/CocoaPods/Lint'
)
tmp_dir
=
Pathname
.
new
(
'/tmp/CocoaPods/Lint'
)
all_valid
=
true
all_valid
=
true
files
.
each
do
|
file
|
files
.
each
do
|
file
|
file
=
file
.
realpath
file
=
file
.
realpath
spec
=
Specification
.
from_file
(
file
)
file_spec
=
Specification
.
from_file
(
file
)
specs
=
file_spec
.
recursive_subspecs
.
any?
?
file_spec
.
recursive_subspecs
:
[
file_spec
]
specs
.
each
do
|
spec
|
# Show immediatly which pod is being processed.
# Show immediatly which pod is being processed.
# This line will be overwritten once the result is known
# This line will be overwritten once the result is known
print
" ->
#{
spec
}
\r
"
unless
config
.
silent?
||
is_repo
print
" ->
#{
spec
}
\r
"
unless
config
.
silent?
||
is_repo
...
@@ -96,7 +98,6 @@ module Pod
...
@@ -96,7 +98,6 @@ module Pod
spec
.
validate!
spec
.
validate!
warnings
=
warnings_for_spec
(
spec
,
file
,
is_repo
)
warnings
=
warnings_for_spec
(
spec
,
file
,
is_repo
)
deprecations
=
deprecation_notices_for_spec
(
spec
,
file
,
is_repo
)
deprecations
=
deprecation_notices_for_spec
(
spec
,
file
,
is_repo
)
# TODO: check that the dependencies of the spec exist
if
is_repo
||
@no_install
if
is_repo
||
@no_install
build_messages
,
file_errors
=
[],
[]
build_messages
,
file_errors
=
[],
[]
else
else
...
@@ -119,17 +120,8 @@ module Pod
...
@@ -119,17 +120,8 @@ module Pod
all_valid
=
false
unless
(
all
-
build_warnings
).
empty?
all_valid
=
false
unless
(
all
-
build_warnings
).
empty?
end
end
# Clean duplicated multiplatform messages
clean_duplicate_platfrom_messages
(
errors
)
[
errors
,
warnings
].
each
do
|
messages
|
clean_duplicate_platfrom_messages
(
warnings
)
duplicate_candiates
=
messages
.
select
{
|
l
|
l
.
include?
(
"ios: "
)}
duplicated
=
duplicate_candiates
.
select
{
|
l
|
messages
.
include?
(
l
.
gsub
(
/ios: /
,
'osx: '
))
}
duplicated
.
each
do
|
l
|
clean
=
l
.
gsub
(
/ios: /
,
''
)
messages
.
insert
(
messages
.
index
(
l
),
clean
)
messages
.
delete
(
l
)
messages
.
delete
(
'osx: '
+
clean
)
end
end
# This overwrites the previously printed text
# This overwrites the previously printed text
unless
config
.
silent?
unless
config
.
silent?
...
@@ -146,9 +138,22 @@ module Pod
...
@@ -146,9 +138,22 @@ module Pod
errors
.
each
{
|
msg
|
puts
" - ERROR |
#{
msg
}
"
}
unless
config
.
silent?
errors
.
each
{
|
msg
|
puts
" - ERROR |
#{
msg
}
"
}
unless
config
.
silent?
puts
unless
config
.
silent?
||
(
is_repo
&&
all
.
flatten
.
empty?
)
puts
unless
config
.
silent?
||
(
is_repo
&&
all
.
flatten
.
empty?
)
end
end
end
all_valid
all_valid
end
end
def
clean_duplicate_platfrom_messages
(
messages
)
duplicate_candiates
=
messages
.
select
{
|
l
|
l
.
include?
(
"ios: "
)}
duplicated
=
duplicate_candiates
.
select
{
|
l
|
messages
.
include?
(
l
.
gsub
(
/ios: /
,
'osx: '
))
}
duplicated
.
uniq
.
each
do
|
l
|
clean
=
l
.
gsub
(
/ios: /
,
''
)
puts
"duplicated: "
.
magenta
+
l
messages
.
insert
(
messages
.
index
(
l
),
clean
)
messages
.
delete
(
l
)
messages
.
delete
(
'osx: '
+
clean
)
end
end
# It checks a spec for minor non fatal defects
# It checks a spec for minor non fatal defects
#
#
# It returns a array of messages
# It returns a array of messages
...
@@ -163,14 +168,16 @@ module Pod
...
@@ -163,14 +168,16 @@ module Pod
warnings
<<
"Github repositories should end in `.git'"
if
source
&&
source
[
:git
]
=~
/github.com/
&&
source
[
:git
]
!~
/.*\.git/
warnings
<<
"Github repositories should end in `.git'"
if
source
&&
source
[
:git
]
=~
/github.com/
&&
source
[
:git
]
!~
/.*\.git/
warnings
<<
"The description should end with a dot"
if
spec
.
description
&&
spec
.
description
!~
/.*\./
warnings
<<
"The description should end with a dot"
if
spec
.
description
&&
spec
.
description
!~
/.*\./
warnings
<<
"The summary should end with a dot"
if
spec
.
summary
!~
/.*\./
warnings
<<
"The summary should end with a dot"
if
spec
.
summary
!~
/.*\./
#TODO: the following 'is_repo' and '@no_install' checks are there only because at the time of 0.6.0rc1 it would be triggered in all specs
warnings
<<
"Missing license[:file] or [:text]"
unless
is_repo
||
@no_install
||
license
&&
(
license
[
:file
]
||
license
[
:text
])
warnings
<<
"Missing license[:file] or [:text]"
unless
is_repo
||
@no_install
||
license
&&
(
license
[
:file
]
||
license
[
:text
])
warnings
<<
"Comments must be deleted"
if
text
=~
/^\w*#/
# allow a single line comment as it is generally used in subspecs
#TODO: the previous 'is_repo' and '@no_install' checks are there only because at the time of 0.6.0rc1 it would be triggered in all specs
warnings
<<
"Comments must be deleted"
if
text
=~
/^\w*#\n\w*#/
warnings
warnings
end
end
def
path_matches_name?
(
file
,
spec
)
def
path_matches_name?
(
file
,
spec
)
file
.
basename
.
to_s
==
spec
.
name
+
'.podspec'
spec_name
=
spec
.
name
.
match
(
/[^\/]*/
)[
0
]
file
.
basename
.
to_s
==
spec_name
+
'.podspec'
end
end
# It reads a podspec file and checks for strings corresponding
# It reads a podspec file and checks for strings corresponding
...
@@ -221,7 +228,7 @@ module Pod
...
@@ -221,7 +228,7 @@ module Pod
def
process_xcode_build_output
(
output
)
def
process_xcode_build_output
(
output
)
output_by_line
=
output
.
split
(
"
\n
"
)
output_by_line
=
output
.
split
(
"
\n
"
)
selected_lines
=
output_by_line
.
select
do
|
l
|
selected_lines
=
output_by_line
.
select
do
|
l
|
l
.
include?
(
'error'
)\
l
.
include?
(
'error'
)
&&
!
l
.
include?
(
'error generated.'
)
\
||
l
.
include?
(
'warning'
)
&&
!
l
.
include?
(
'warning generated.'
)\
||
l
.
include?
(
'warning'
)
&&
!
l
.
include?
(
'warning generated.'
)\
||
l
.
include?
(
'note'
)
||
l
.
include?
(
'note'
)
end
end
...
@@ -258,7 +265,7 @@ module Pod
...
@@ -258,7 +265,7 @@ module Pod
end
end
def
platform_names
(
spec
)
def
platform_names
(
spec
)
spec
.
platform
.
name
||
[
:ios
,
:osx
]
spec
.
platform
.
name
?
[
spec
.
platform
.
name
]
:
[
:ios
,
:osx
]
end
end
# Templates and github information retrival for spec create
# Templates and github information retrival for spec create
...
...
lib/cocoapods/specification.rb
View file @
a587e4c4
...
@@ -436,7 +436,7 @@ module Pod
...
@@ -436,7 +436,7 @@ module Pod
end
end
# Override the getters to always return the value of the top level parent spec.
# Override the getters to always return the value of the top level parent spec.
[
:version
,
:summary
,
:platform
,
:license
,
:authors
,
:requires_arc
,
:compiler_flags
,
:documentation
].
each
do
|
attr
|
[
:version
,
:summary
,
:platform
,
:license
,
:authors
,
:requires_arc
,
:compiler_flags
,
:documentation
,
:homepage
].
each
do
|
attr
|
define_method
(
attr
)
{
top_level_parent
.
send
(
attr
)
}
define_method
(
attr
)
{
top_level_parent
.
send
(
attr
)
}
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