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
0c8d53a4
Commit
0c8d53a4
authored
Oct 12, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Specification#platform.
parent
e70377c0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
16 deletions
+62
-16
Rakefile
Rakefile
+9
-0
TODO
TODO
+2
-1
specification.rb
lib/cocoapods/specification.rb
+24
-12
banana-lib.tar.gz
spec/fixtures/banana-lib.tar.gz
+0
-0
master.tar.gz
spec/fixtures/spec-repos/master.tar.gz
+0
-0
specification_spec.rb
spec/unit/specification_spec.rb
+27
-3
No files found.
Rakefile
View file @
0c8d53a4
...
...
@@ -65,6 +65,15 @@ namespace :spec do
task
:all
do
sh
"macbacon -a"
end
desc
"Rebuild all the fixture tarballs"
task
:rebuild_fixture_tarballs
do
tarballs
=
FileList
[
'spec/fixtures/**/*.tar.gz'
]
tarballs
.
each
do
|
tarball
|
basename
=
File
.
basename
(
tarball
)
sh
"cd
#{
File
.
dirname
(
tarball
)
}
&& rm
#{
basename
}
&& tar -zcf
#{
basename
}
#{
basename
[
0
..-
8
]
}
"
end
end
end
desc
"Run all specs"
...
...
TODO
View file @
0c8d53a4
* Check exit statuses of commands performed and raise when necessary.
* The user *has* to specify the platform of the project in the Podfile.
* Based on the platform setting of the Podfile the appropriate xcode project template should be used.
lib/cocoapods/specification.rb
View file @
0c8d53a4
...
...
@@ -115,6 +115,8 @@ module Pod
flags
end
attr_accessor
:platform
# Not attributes
include
Config
::
Mixin
...
...
@@ -163,6 +165,10 @@ module Pod
@name
.
nil?
&&
@version
.
nil?
end
def
any_platform?
@platform
.
nil?
end
# Returns all source files of this pod including header files.
def
expanded_source_files
files
=
[]
...
...
@@ -227,18 +233,24 @@ module Pod
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
(
", "
)
}
"
missing
=
[]
missing
<<
"`name'"
unless
@name
missing
<<
"`version'"
unless
@version
missing
<<
"`summary'"
unless
@summary
missing
<<
"`homepage'"
unless
@homepage
missing
<<
"`author(s)'"
unless
@authors
missing
<<
"either `source' or `part_of'"
unless
@source
||
@part_of
missing
<<
"`source_files'"
unless
@source_files
incorrect
=
[]
allowed
=
[
nil
,
:ios
,
:osx
]
incorrect
<<
[
"`platform'"
,
allowed
]
unless
allowed
.
include?
(
@platform
)
unless
missing
.
empty?
&&
incorrect
.
empty?
message
=
"The following
#{
(
missing
+
incorrect
).
size
==
1
?
'attribute is'
:
'attributes are'
}
:
\n
"
message
<<
"* missing:
#{
missing
.
join
(
", "
)
}
"
unless
missing
.
empty?
message
<<
"* incorrect:
#{
incorrect
.
map
{
|
x
|
"
#{
x
[
0
]
}
(
#{
x
[
1
..-
1
]
}
)"
}
.join("
,
")}"
unless
incorrect
.
empty?
raise
Informative
,
message
end
end
...
...
spec/fixtures/banana-lib.tar.gz
View file @
0c8d53a4
No preview for this file type
spec/fixtures/spec-repos/master.tar.gz
View file @
0c8d53a4
No preview for this file type
spec/unit/specification_spec.rb
View file @
0c8d53a4
...
...
@@ -131,6 +131,7 @@ describe "A Pod::Specification loaded from a podspec" do
@spec
.
compiler_flags
=
"-Wunused-value"
@spec
.
compiler_flags
.
should
==
"-Wunused-value -fobj-arc"
end
end
describe
"A Pod::Specification that's part of another pod's source"
do
...
...
@@ -256,10 +257,33 @@ describe "A Pod::Specification, with installed source," do
end
describe
"A Pod::Specification, in general,"
do
before
do
@spec
=
Pod
::
Spec
.
new
end
def
validate
(
&
block
)
Proc
.
new
(
&
block
).
should
.
raise
(
Pod
::
Informative
)
end
it
"raises if the specification does not contain the minimum required attributes"
do
exception
=
lambda
{
Pod
::
Spec
.
new
.
validate!
}.
should
.
raise
Pod
::
Informative
exception
=
validate
{
@spec
.
validate!
}
exception
.
message
=~
/name.+?version.+?summary.+?homepage.+?authors.+?(source|part_of).+?source_files/
end
it
"raises if the platform is unrecognized"
do
validate
{
@spec
.
validate!
}.
message
.
should
.
not
.
include
'platform'
@spec
.
platform
=
:ios
validate
{
@spec
.
validate!
}.
message
.
should
.
not
.
include
'platform'
@spec
.
platform
=
:osx
validate
{
@spec
.
validate!
}.
message
.
should
.
not
.
include
'platform'
@spec
.
platform
=
:windows
validate
{
@spec
.
validate!
}.
message
.
should
.
include
'platform'
end
it
"returns the platform that the static library should be build for"
do
@spec
.
should
.
be
.
any_platform
@spec
.
platform
=
:ios
@spec
.
platform
.
should
==
:ios
@spec
.
should
.
not
.
be
.
any_platform
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