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
88ce67b9
Commit
88ce67b9
authored
Apr 21, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Pod::Command::Spec] To lint a repo now it requires its name
parent
f71ddf59
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
25 deletions
+33
-25
spec.rb
lib/cocoapods/command/spec.rb
+33
-25
No files found.
lib/cocoapods/command/spec.rb
View file @
88ce67b9
...
...
@@ -49,46 +49,30 @@ module Pod
end
def
lint
all_valid
=
true
if
@name_or_url
==
'all'
files
=
config
.
repos_dir
.
glob
(
'**/*.podspec'
)
if
is_repo
=
@name_or_url
&&
(
config
.
repos_dir
+
@name_or_url
).
exist?
files
=
(
config
.
repos_dir
+
@name_or_url
).
glob
(
'**/*.podspec'
)
else
name
=
@name_or_url
files
=
name
?
[
Pathname
.
new
(
name
)]
:
Pathname
.
pwd
.
glob
(
'*.podspec'
)
end
puts
files
.
each
do
|
file
|
text
=
file
.
read
spec
=
Specification
.
from_file
(
file
)
spec
.
validate!
deprecations
=
[]
if
text
.
include?
(
'config.ios?'
)
||
text
.
include?
(
'config.ios?'
)
deprecations
<<
"`config.ios?' and `config.osx' will be removed in version 0.7"
end
warnings
=
[]
warnings
<<
"The name of the spec should match the name of the file"
unless
path_matches_name?
(
file
,
spec
)
warnings
<<
"Missing license[:type]"
unless
spec
.
license
&&
spec
.
license
[
:type
]
if
@name_or_url
!=
'all'
#TODO: the is here only because at the time of 0.6.0rc1
# would be triggered in all specs of if lint all is called
warnings
<<
"Missing license[:file] or [:text]"
unless
spec
.
license
&&
(
spec
.
license
[
:file
]
||
spec
.
license
[
:text
])
end
warnings
<<
"Github repositories should end in `.git'"
if
spec
.
source
&&
spec
.
source
[
:git
]
=~
/github.com/
&&
spec
.
source
[
:git
]
!~
/.*\.git/
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
=
warnings_for_spec
(
spec
,
file
,
is_repo
)
deprecations
=
deprecation_notices_for_spec
(
spec
,
file
,
is_repo
)
if
deprecations
.
empty?
&&
warnings
.
empty?
puts
" -> "
.
green
+
"
#{
spec
}
passed validation"
unless
@name_or_url
==
'all'
||
config
.
silent?
puts
" -> "
.
green
+
"
#{
spec
}
passed validation"
unless
is_repo
||
config
.
silent?
else
puts
" -> "
.
red
+
spec
.
to_s
unless
config
.
silent?
end
types
=
[
"WARN"
,
"DPRC"
]
types
=
[
"WARN"
,
"DPRC"
]
messages
=
[
warnings
,
deprecations
]
types
.
each_with_index
do
|
type
,
i
|
unless
messages
[
i
].
empty?
...
...
@@ -96,13 +80,37 @@ module Pod
all_valid
=
false
end
end
puts
unless
config
.
silent?
puts
unless
config
.
silent?
||
(
is_repo
&&
messages
.
flatten
.
empty?
)
end
all_valid
end
private
def
warnings_for_spec
(
spec
,
file
,
all
)
license
=
spec
.
license
source
=
spec
.
source
warnings
=
[]
unless
path_matches_name?
(
file
,
spec
);
warnings
<<
"The name of the spec should match the name of the file"
;
end
unless
license
&&
license
[
:type
];
warnings
<<
"Missing license[:type]"
;
end
if
source
&&
source
[
:git
]
=~
/github.com/
&&
source
[
:git
]
!~
/.*\.git/
;
warnings
<<
"Github repositories should end in `.git'"
;
end
if
spec
.
description
&&
spec
.
description
!~
/.*\./
;
warnings
<<
"The description should end with a dot"
;
end
if
spec
.
summary
!~
/.*\./
;
warnings
<<
"The summary should end with a dot"
;
end
unless
all
||
license
&&
(
license
[
:file
]
||
license
[
:text
]);
warnings
<<
"Missing license[:file] or [:text]"
;
end
#TODO: the previous ´all' is here only because at the time of 0.6.0rc1 it would trigger in all specs of if lint all is called
warnings
end
def
deprecation_notices_for_spec
(
spec
,
file
,
all
)
text
=
file
.
read
deprecations
=
[]
if
text
.
=
~
/config\..os?/
deprecations
<<
"`config.ios?' and `config.osx' will be removed in version 0.7"
end
deprecations
end
def
path_matches_name?
(
file
,
spec
)
file
.
basename
.
to_s
==
spec
.
name
+
'.podspec'
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