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
9d40f196
Commit
9d40f196
authored
Apr 26, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Pod::Command::Spec] refinements
parent
8e126d17
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
13 deletions
+16
-13
spec.rb
lib/cocoapods/command/spec.rb
+13
-11
spec_spec.rb
spec/functional/command/spec_spec.rb
+3
-2
No files found.
lib/cocoapods/command/spec.rb
View file @
9d40f196
...
...
@@ -6,16 +6,16 @@ module Pod
def
self
.
banner
%{Managing PodSpec files:
$ pod spec create [ NAME | https://github.com/USER/REPO ]
$ pod spec create [ NAME | https://github.com/USER/REPO ]
Creates a PodSpec, in the current working dir, called `NAME.podspec'.
If a GitHub url is passed the spec is prepopulated.
Creates a PodSpec, in the current working dir, called `NAME.podspec'.
If a GitHub url is passed the spec is prepopulated.
$ pod spec lint [ NAME.podspec | REPO ]
$ pod spec lint [ NAME.podspec | REPO ]
Validates `NAME.podspec'. In case `NAME.podspec' is omitted, it defaults
to `*.podspec' in the current working dir. If the name of a repo is
provided it validates all its specs.}
Validates `NAME.podspec'. In case `NAME.podspec' is omitted, it defaults
to `*.podspec' in the current working dir. If the name of a repo is
provided it validates all its specs.}
end
def
self
.
options
...
...
@@ -66,7 +66,7 @@ module Pod
else
if
@repo_or_podspec
files
=
[
Pathname
.
new
(
@repo_or_podspec
)]
raise
Informative
,
"[!] Unable to find a spec named
#{
@repo_or_podspec
}
"
.
red
unless
files
[
0
].
exist?
raise
Informative
,
"[!] Unable to find a spec named
#{
@repo_or_podspec
}
"
.
red
unless
files
[
0
].
exist?
&&
@repo_or_podspec
.
include?
(
'.podspec'
)
else
files
=
Pathname
.
pwd
.
glob
(
'*.podspec'
)
raise
Informative
,
"[!] No specs found in the current directory"
.
red
if
files
.
empty?
...
...
@@ -75,7 +75,7 @@ module Pod
puts
all_valid
=
lint_specs_files
(
files
,
is_repo
)
if
all_valid
puts
(
files
.
count
==
1
?
"
#{
@repo_or_podspec
}
passed validation"
:
"All the specs passed validation"
).
green
puts
(
files
.
count
==
1
?
"
#{
files
[
0
].
basename
}
passed validation"
:
"All the specs passed validation"
).
green
else
message
=
(
files
.
count
==
1
?
"[!] The spec did not pass validation"
:
"[!] Not all specs passed validation"
).
red
raise
Informative
,
message
...
...
@@ -85,7 +85,7 @@ module Pod
private
def
repo_with_name_exist
(
name
)
name
&&
(
config
.
repos_dir
+
name
).
exist?
name
&&
(
config
.
repos_dir
+
name
).
exist?
&&
!
name
.
include?
(
'/'
)
end
# Takes an array of podspec files and lints them all
...
...
@@ -107,6 +107,7 @@ module Pod
# If the spec doesn't validate it raises and informative
spec
.
validate!
warnings
=
warnings_for_spec
(
spec
,
file
,
is_repo
)
deprecations
=
deprecation_notices_for_spec
(
spec
,
file
,
is_repo
)
if
is_repo
||
@quick
...
...
@@ -159,6 +160,7 @@ module Pod
end
def
set_up_lint_environment
tmp_dir
.
rmtree
if
tmp_dir
.
exist?
tmp_dir
.
mkpath
@original_config
=
Config
.
instance
.
clone
config
.
project_root
=
tmp_dir
...
...
@@ -196,11 +198,11 @@ module Pod
warnings
<<
"The name of the spec should match the name of the file"
unless
path_matches_name?
(
file
,
spec
)
warnings
<<
"Missing license[:type]"
unless
license
&&
license
[
:type
]
warnings
<<
"Github repositories should end in `.git'"
if
source
&&
source
[
:git
]
=~
/github.com/
&&
source
[
:git
]
!~
/.*\.git/
warnings
<<
"Github repositories should start with `https'"
if
source
&&
source
[
:git
]
=~
/github.com/
&&
source
[
:git
]
!~
/https:\/\/github.com/
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
<<
"Missing license[:file] or [:text]"
unless
license
&&
(
license
[
:file
]
||
license
[
:text
])
warnings
<<
"Comments must be deleted"
if
text
=~
/^\w*#\n\w*#/
# allow a single line comment as it is generally used in subspecs
warnings
end
...
...
spec/functional/command/spec_spec.rb
View file @
9d40f196
...
...
@@ -129,8 +129,9 @@ describe "Pod::Command::Spec lint" do
it
"lints a givent podspec"
do
spec_file
=
fixture
(
'spec-repos'
)
+
'master/JSONKit/1.4/JSONKit.podspec'
output
=
run_command
(
'spec'
,
'lint'
,
'--quick'
,
spec_file
)
output
.
should
.
include
"passed validation"
cmd
=
command
(
'spec'
,
'lint'
,
'--quick'
,
spec_file
.
to_s
)
lambda
{
cmd
.
run
}.
should
.
raise
Pod
::
Informative
cmd
.
output
.
should
.
include
"Missing license[:file] or [:text]"
end
before
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