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
e91db0ae
Commit
e91db0ae
authored
Sep 19, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add shortcuts to the spec for frameworks and libraries. Closes #5.
parent
08c29794
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
8 deletions
+36
-8
specification.rb
lib/cocoapods/specification.rb
+14
-2
config.rb
lib/cocoapods/xcode/config.rb
+4
-4
command_spec.rb
spec/functional/command_spec.rb
+1
-1
specification_spec.rb
spec/unit/specification_spec.rb
+17
-1
No files found.
lib/cocoapods/specification.rb
View file @
e91db0ae
...
@@ -21,7 +21,7 @@ module Pod
...
@@ -21,7 +21,7 @@ module Pod
def
initialize
(
&
block
)
def
initialize
(
&
block
)
@dependencies
=
[]
@dependencies
=
[]
@xcconfig
=
{}
@xcconfig
=
Xcode
::
Config
.
new
instance_eval
(
&
block
)
if
block_given?
instance_eval
(
&
block
)
if
block_given?
end
end
...
@@ -87,9 +87,21 @@ module Pod
...
@@ -87,9 +87,21 @@ module Pod
end
end
def
xcconfig
(
hash
)
def
xcconfig
(
hash
)
@xcconfig
=
hash
@xcconfig
.
merge!
(
hash
)
end
end
def
frameworks
(
*
frameworks
)
frameworks
.
unshift
(
''
)
xcconfig
'OTHER_LDFLAGS'
=>
frameworks
.
join
(
' -framework '
).
strip
end
alias_method
:framework
,
:frameworks
def
libraries
(
*
libraries
)
libraries
.
unshift
(
''
)
xcconfig
'OTHER_LDFLAGS'
=>
libraries
.
join
(
' -l '
).
strip
end
alias_method
:library
,
:libraries
# Not attributes
# Not attributes
include
Config
::
Mixin
include
Config
::
Mixin
...
...
lib/cocoapods/xcode/config.rb
View file @
e91db0ae
module
Pod
module
Pod
module
Xcode
module
Xcode
class
Config
class
Config
def
initialize
(
xcconfig
_hash
=
{})
def
initialize
(
xcconfig
=
{})
@attributes
=
{}
@attributes
=
{}
merge!
(
xcconfig
_hash
)
merge!
(
xcconfig
)
end
end
def
to_hash
def
to_hash
@attributes
@attributes
end
end
def
merge!
(
xcconfig
_hash
)
def
merge!
(
xcconfig
)
xcconfig_hash
.
each
do
|
key
,
value
|
xcconfig
.
to
_hash
.
each
do
|
key
,
value
|
if
existing_value
=
@attributes
[
key
]
if
existing_value
=
@attributes
[
key
]
@attributes
[
key
]
=
"
#{
existing_value
}
#{
value
}
"
@attributes
[
key
]
=
"
#{
existing_value
}
#{
value
}
"
else
else
...
...
spec/functional/command_spec.rb
View file @
e91db0ae
...
@@ -52,7 +52,7 @@ describe "Pod::Command" do
...
@@ -52,7 +52,7 @@ describe "Pod::Command" do
spec
.
read
(
:source
).
should
==
{
:git
=>
'http://example.com/Bananas.git'
,
:tag
=>
'1.0.0'
}
spec
.
read
(
:source
).
should
==
{
:git
=>
'http://example.com/Bananas.git'
,
:tag
=>
'1.0.0'
}
spec
.
read
(
:description
).
should
==
'An optional longer description of Bananas.'
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
(
:source_files
).
should
==
[
Pathname
.
new
(
'Classes'
),
Pathname
.
new
(
'Classes/**/*.{h,m}'
)]
spec
.
read
(
:xcconfig
).
should
==
{
'OTHER_LDFLAGS'
=>
'-framework SomeRequiredFramework'
}
spec
.
read
(
:xcconfig
).
to_hash
.
should
==
{
'OTHER_LDFLAGS'
=>
'-framework SomeRequiredFramework'
}
spec
.
read
(
:dependencies
).
should
==
[
Pod
::
Dependency
.
new
(
'SomeLibraryThatBananasDependsOn'
,
'>= 1.0.0'
)]
spec
.
read
(
:dependencies
).
should
==
[
Pod
::
Dependency
.
new
(
'SomeLibraryThatBananasDependsOn'
,
'>= 1.0.0'
)]
end
end
...
...
spec/unit/specification_spec.rb
View file @
e91db0ae
...
@@ -92,11 +92,27 @@ describe "A Pod::Specification loaded from a podspec" do
...
@@ -92,11 +92,27 @@ describe "A Pod::Specification loaded from a podspec" do
end
end
it
"returns the pod's xcconfig settings"
do
it
"returns the pod's xcconfig settings"
do
@spec
.
read
(
:xcconfig
).
should
==
{
@spec
.
read
(
:xcconfig
).
to_hash
.
should
==
{
'OTHER_LDFLAGS'
=>
'-framework SystemConfiguration'
'OTHER_LDFLAGS'
=>
'-framework SystemConfiguration'
}
}
end
end
it
"has a shortcut to add frameworks to the xcconfig"
do
@spec
.
frameworks
(
'CFNetwork'
,
'CoreText'
)
@spec
.
read
(
:xcconfig
).
to_hash
.
should
==
{
'OTHER_LDFLAGS'
=>
'-framework SystemConfiguration '
\
'-framework CFNetwork '
\
'-framework CoreText'
}
end
it
"has a shortcut to add libraries to the xcconfig"
do
@spec
.
libraries
(
'z'
,
'xml2'
)
@spec
.
read
(
:xcconfig
).
to_hash
.
should
==
{
'OTHER_LDFLAGS'
=>
'-framework SystemConfiguration -l z -l xml2'
}
end
it
"returns that it's equal to another specification if the name and version are equal"
do
it
"returns that it's equal to another specification if the name and version are equal"
do
@spec
.
should
==
Pod
::
Spec
.
new
{
name
'BananaLib'
;
version
'1.0'
}
@spec
.
should
==
Pod
::
Spec
.
new
{
name
'BananaLib'
;
version
'1.0'
}
@spec
.
should
.
not
==
Pod
::
Spec
.
new
{
name
'OrangeLib'
;
version
'1.0'
}
@spec
.
should
.
not
==
Pod
::
Spec
.
new
{
name
'OrangeLib'
;
version
'1.0'
}
...
...
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