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
1bb68e0e
Commit
1bb68e0e
authored
Sep 19, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate that a spec has the minimum required attributes. Testing if it compiles is for later.
parent
9ba5654d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
6 deletions
+34
-6
.kick
.kick
+1
-1
spec.rb
lib/cocoapods/command/spec.rb
+7
-5
specification.rb
lib/cocoapods/specification.rb
+16
-0
command_spec.rb
spec/functional/command_spec.rb
+1
-0
specification_spec.rb
spec/unit/specification_spec.rb
+9
-0
No files found.
.kick
View file @
1bb68e0e
...
...
@@ -5,7 +5,7 @@ Ruby.runner_bin = 'macbacon'
process do |files|
specs = files.take_and_map do |file|
case file
when %r{lib/cocoa
_
pods/(.+?)\.rb$}
when %r{lib/cocoapods/(.+?)\.rb$}
s = Dir.glob("spec/**/#{$1}_spec.rb")
s unless s.empty?
end
...
...
lib/cocoapods/command/spec.rb
View file @
1bb68e0e
...
...
@@ -56,16 +56,18 @@ module Pod
source_files 'Classes', 'Classes/**/*.{h,m}'
xcconfig 'OTHER_LDFLAGS' => '-framework SomeRequiredFramework'
dependency 'SomeLibraryThat
#{
@name
}
DependsOn', '>= 1.0.0'
end
SPEC
(
Pathname
.
pwd
+
"
#{
@name
}
.podspec"
).
open
(
'w'
)
{
|
f
|
f
<<
spec
}
end
#
def lint
#
file = @name ? Pathname.new(@name) : config.project_podfile
#
spec = Specification.from_podspec(file)
#
spec.validate!
#
end
def
lint
file
=
@name
?
Pathname
.
new
(
@name
)
:
config
.
project_podfile
spec
=
Specification
.
from_podspec
(
file
)
spec
.
validate!
end
#def push
...
...
lib/cocoapods/specification.rb
View file @
1bb68e0e
...
...
@@ -144,6 +144,22 @@ module Pod
"#<
#{
self
.
class
.
name
}
for
#{
to_s
}
>"
end
def
validate!
attrs
=
[]
attrs
<<
"`name'"
unless
@name
attrs
<<
"`version'"
unless
@version
attrs
<<
"`summary'"
unless
@summary
attrs
<<
"`homepage'"
unless
@homepage
attrs
<<
"`author(s)'"
unless
@authors
attrs
<<
"either `source' or `part_of'"
unless
@source
||
@part_of
attrs
<<
"`source_files'"
unless
@source_files
unless
attrs
.
empty?
raise
Informative
,
"The following required "
\
"
#{
attrs
.
size
==
1
?
'attribute is'
:
'attributes are'
}
"
\
"missing:
#{
attrs
.
join
(
", "
)
}
"
end
end
# Install and download hooks
# Places the activated specification in the project's pods directory.
...
...
spec/functional/command_spec.rb
View file @
1bb68e0e
...
...
@@ -53,6 +53,7 @@ describe "Pod::Command" do
spec
.
read
(
:description
).
should
==
'An optional longer description of Bananas.'
spec
.
read
(
:source_files
).
should
==
[
Pathname
.
new
(
'Classes'
),
Pathname
.
new
(
'Classes/**/*.{h,m}'
)]
spec
.
read
(
:xcconfig
).
should
==
{
'OTHER_LDFLAGS'
=>
'-framework SomeRequiredFramework'
}
spec
.
read
(
:dependencies
).
should
==
[
Pod
::
Dependency
.
new
(
'SomeLibraryThatBananasDependsOn'
,
'>= 1.0.0'
)]
end
before
do
...
...
spec/unit/specification_spec.rb
View file @
1bb68e0e
...
...
@@ -138,3 +138,12 @@ describe "A Pod::Specification that's part of another pod's source" do
# @spec.pod_destroot
#end
end
describe
"A Pod::Specification, in general,"
do
it
"raises if the specification does not contain the minimum required attributes"
do
exception
=
lambda
{
Pod
::
Spec
.
new
.
validate!
}.
should
.
raise
Pod
::
Informative
exception
.
message
=~
/name.+?version.+?summary.+?homepage.+?authors.+?(source|part_of).+?source_files/
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