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
4d9fecdf
Commit
4d9fecdf
authored
Oct 20, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a separate Podfile class which has a friendlier DSL. Closes #26.
parent
2716b347
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
240 additions
and
119 deletions
+240
-119
Podfile
examples/AFNetworking Example/Podfile
+4
-5
Podfile
examples/MGSplitViewController/Podfile
+3
-4
project.pbxproj
...les/MacRubySample/MacRubySample.xcodeproj/project.pbxproj
+18
-0
Podfile
examples/MacRubySample/Podfile
+6
-7
Podfile
examples/RKTwitter/Podfile
+4
-5
Podfile
examples/SSCatalog/Podfile
+4
-5
cocoapods.rb
lib/cocoapods.rb
+1
-0
bridge_support_generator.rb
lib/cocoapods/bridge_support_generator.rb
+3
-3
config.rb
lib/cocoapods/config.rb
+8
-2
installer.rb
lib/cocoapods/installer.rb
+5
-2
podfile.rb
lib/cocoapods/podfile.rb
+94
-0
resolver.rb
lib/cocoapods/resolver.rb
+1
-1
specification.rb
lib/cocoapods/specification.rb
+15
-30
copy_resources_script.rb
lib/cocoapods/xcode/copy_resources_script.rb
+2
-0
project.rb
lib/cocoapods/xcode/project.rb
+2
-2
Podfile
spec/fixtures/Podfile
+5
-7
integration_spec.rb
spec/integration_spec.rb
+17
-17
podfile_spec.rb
spec/unit/podfile_spec.rb
+48
-0
specification_spec.rb
spec/unit/specification_spec.rb
+0
-29
No files found.
examples/AFNetworking Example/Podfile
View file @
4d9fecdf
Pod
::
File
.
new
do
|
f
|
platform
:ios
f
.
platform
=
:ios
f
.
dependency
'AFNetworking'
dependency
'AFNetworking'
f
.
dependency
'FormatterKit'
dependency
'FormatterKit'
end
examples/MGSplitViewController/Podfile
View file @
4d9fecdf
Pod
::
File
.
new
do
|
f
|
platform
:ios
f
.
platform
=
:ios
f
.
dependency
'MGSplitViewController'
,
'1.0.0'
dependency
'MGSplitViewController'
,
'1.0.0'
end
examples/MacRubySample/MacRubySample.xcodeproj/project.pbxproj
View file @
4d9fecdf
...
@@ -126,6 +126,7 @@
...
@@ -126,6 +126,7 @@
51657564144AFA12002A4EFA
/* Sources */
,
51657564144AFA12002A4EFA
/* Sources */
,
51657565144AFA12002A4EFA
/* Frameworks */
,
51657565144AFA12002A4EFA
/* Frameworks */
,
51657566144AFA12002A4EFA
/* Resources */
,
51657566144AFA12002A4EFA
/* Resources */
,
51F33E491450BB7D00C19A4B
/* ShellScript */
,
);
);
buildRules
=
(
buildRules
=
(
);
);
...
@@ -177,6 +178,23 @@
...
@@ -177,6 +178,23 @@
};
};
/* End PBXResourcesBuildPhase section */
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
51F33E491450BB7D00C19A4B
/* ShellScript */
=
{
isa
=
PBXShellScriptBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
);
inputPaths
=
(
);
outputPaths
=
(
);
runOnlyForDeploymentPostprocessing
=
0
;
shellPath
=
/bin/sh
;
shellScript
=
"${SRCROOT}/Pods/PodsResources.sh"
;
showEnvVarsInLog
=
0
;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
51657564144AFA12002A4EFA
/* Sources */
=
{
51657564144AFA12002A4EFA
/* Sources */
=
{
isa
=
PBXSourcesBuildPhase
;
isa
=
PBXSourcesBuildPhase
;
...
...
examples/MacRubySample/Podfile
View file @
4d9fecdf
Pod
::
File
.
new
do
|
f
|
platform
:osx
f
.
platform
=
:osx
f
.
generate_bridge_support
=
true
generate_bridge_support!
f
.
dependency
'ASIHTTPRequest'
f
.
dependency
'AFNetworking'
dependency
'ASIHTTPRequest'
f
.
dependency
'CocoaLumberjack'
dependency
'CocoaLumberjack'
end
examples/RKTwitter/Podfile
View file @
4d9fecdf
Pod
::
File
.
new
do
|
f
|
platform
:ios
f
.
platform
=
:ios
f
.
dependency
'RestKit-ObjectMapping'
dependency
'RestKit-ObjectMapping'
f
.
dependency
'RestKit-JSON-JSONKit'
dependency
'RestKit-JSON-JSONKit'
end
examples/SSCatalog/Podfile
View file @
4d9fecdf
Pod
::
File
.
new
do
|
f
|
platform
:ios
f
.
platform
=
:ios
f
.
dependency
'SSToolkit'
dependency
'SSToolkit'
f
.
dependency
'AFNetworking'
dependency
'AFNetworking'
end
lib/cocoapods.rb
View file @
4d9fecdf
...
@@ -11,6 +11,7 @@ module Pod
...
@@ -11,6 +11,7 @@ module Pod
autoload
:Downloader
,
'cocoapods/downloader'
autoload
:Downloader
,
'cocoapods/downloader'
autoload
:Executable
,
'cocoapods/executable'
autoload
:Executable
,
'cocoapods/executable'
autoload
:Installer
,
'cocoapods/installer'
autoload
:Installer
,
'cocoapods/installer'
autoload
:Podfile
,
'cocoapods/podfile'
autoload
:Resolver
,
'cocoapods/resolver'
autoload
:Resolver
,
'cocoapods/resolver'
autoload
:Source
,
'cocoapods/source'
autoload
:Source
,
'cocoapods/source'
autoload
:Spec
,
'cocoapods/specification'
autoload
:Spec
,
'cocoapods/specification'
...
...
lib/cocoapods/bridge_support_generator.rb
View file @
4d9fecdf
...
@@ -17,9 +17,9 @@ module Pod
...
@@ -17,9 +17,9 @@ module Pod
def
create_in
(
root
)
def
create_in
(
root
)
puts
"==> Generating BridgeSupport metadata file"
unless
config
.
silent?
puts
"==> Generating BridgeSupport metadata file"
unless
config
.
silent?
cflags
=
%{-c "#{search_paths.join(' ')}"}
file
=
root
+
"Pods.bridgesupport"
output
=
%{-o '#{root + "Pods.bridgesupport"
}'}
gen_bridge_metadata
%{-c "#{search_paths.join(' ')}" -o '#{file}' '#{headers.join("' '")
}'}
gen_bridge_metadata
%{#{cflags} #{output} '#{headers.join("' '")}'}
file
end
end
end
end
end
end
lib/cocoapods/config.rb
View file @
4d9fecdf
...
@@ -16,7 +16,7 @@ module Pod
...
@@ -16,7 +16,7 @@ module Pod
alias_method
:silent?
,
:silent
alias_method
:silent?
,
:silent
def
initialize
def
initialize
@repos_dir
=
Pathname
.
new
(
::
File
.
expand_path
(
"~/.cocoapods"
))
@repos_dir
=
Pathname
.
new
(
File
.
expand_path
(
"~/.cocoapods"
))
@clean
=
true
@clean
=
true
@verbose
=
false
@verbose
=
false
@silent
=
false
@silent
=
false
...
@@ -43,7 +43,13 @@ module Pod
...
@@ -43,7 +43,13 @@ module Pod
# Returns the spec at the pat returned from `project_podfile`.
# Returns the spec at the pat returned from `project_podfile`.
def
rootspec
def
rootspec
unless
@rootspec
unless
@rootspec
@rootspec
=
Specification
.
from_file
(
project_podfile
)
if
project_podfile
if
project_podfile
if
project_podfile
.
basename
.
to_s
==
'Podfile'
@rootspec
=
Podfile
.
from_file
(
project_podfile
)
else
@rootspec
=
Specification
.
from_file
(
project_podfile
)
end
end
end
end
@rootspec
@rootspec
end
end
...
...
lib/cocoapods/installer.rb
View file @
4d9fecdf
...
@@ -62,7 +62,7 @@ module Pod
...
@@ -62,7 +62,7 @@ module Pod
end
end
def
copy_resources_script
def
copy_resources_script
Xcode
::
CopyResourcesScript
.
new
(
build_specifications
.
map
{
|
spec
|
spec
.
expanded_resources
}.
flatten
)
@copy_resources_script
||=
Xcode
::
CopyResourcesScript
.
new
(
build_specifications
.
map
{
|
spec
|
spec
.
expanded_resources
}.
flatten
)
end
end
def
bridge_support_generator
def
bridge_support_generator
...
@@ -81,8 +81,11 @@ module Pod
...
@@ -81,8 +81,11 @@ module Pod
root
=
config
.
project_pods_root
root
=
config
.
project_pods_root
xcodeproj
.
create_in
(
root
)
xcodeproj
.
create_in
(
root
)
xcconfig
.
create_in
(
root
)
xcconfig
.
create_in
(
root
)
if
@specification
.
generate_bridge_support?
path
=
bridge_support_generator
.
create_in
(
root
)
copy_resources_script
.
resources
<<
path
.
relative_path_from
(
config
.
project_pods_root
)
end
copy_resources_script
.
create_in
(
root
)
copy_resources_script
.
create_in
(
root
)
bridge_support_generator
.
create_in
(
root
)
if
@specification
.
generate_bridge_support
build_specifications
.
each
(
&
:post_install
)
build_specifications
.
each
(
&
:post_install
)
end
end
...
...
lib/cocoapods/podfile.rb
0 → 100644
View file @
4d9fecdf
module
Pod
class
Podfile
def
self
.
from_file
(
path
)
podfile
=
Podfile
.
new
do
eval
(
path
.
read
,
nil
,
path
.
to_s
)
end
podfile
.
defined_in_file
=
path
podfile
.
validate!
podfile
end
def
initialize
(
&
block
)
@dependencies
=
[]
instance_eval
(
&
block
)
end
# Specifies the platform for which a static library should be build.
#
# This can be either `:osx` for Mac OS X applications, or `:ios` for iOS
# applications.
def
platform
(
platform
=
nil
)
platform
?
@platform
=
platform
:
@platform
end
# Specifies a dependency of the project.
#
# A dependency requirement is defined by the name of the Pod and _optionally_
# a list of version requirements.
#
#
# When starting out with a project it is likely that you will want to use the
# latest version of a Pod. If this is the case, simply omit the version
# requirements.
#
# dependency 'SSZipArchive'
#
#
# Later on in the project you may want to freeze to a specific version of a
# Pod, in which case you can specify that version number.
#
# dependency 'Objection', '0.9'
#
#
# Besides no version, or a specific one, it is also possible to use operators:
#
# * `> 0.1` Any version higher than 0.1
# * `>= 0.1` Version 0.1 and any higher version
# * `< 0.1` Any version lower than 0.1
# * `<= 0.1` Version 0.1 and any lower version
# * `~> 0.1.2` Version 0.1.2 and the versions upto 0.2, not including 0.2
#
#
# Finally, a list of version requirements can be specified for even more fine
# grained control.
def
dependency
(
name
,
*
version_requirements
)
@dependencies
<<
Dependency
.
new
(
name
,
*
version_requirements
)
end
attr_reader
:dependencies
# Specifies that a BridgeSupport metadata should be generated from the
# headers of all installed Pods.
#
# This is for scripting languages such as MacRuby, Nu, and JSCocoa, which use
# it to bridge types, functions, etc better.
def
generate_bridge_support!
@generate_bridge_support
=
true
end
# This is to be compatible with a Specification for use in the Installer and
# Resolver.
def
podfile?
true
end
attr_accessor
:defined_in_file
def
generate_bridge_support?
@generate_bridge_support
end
def
dependency_by_name
(
name
)
@dependencies
.
find
{
|
d
|
d
.
name
==
name
}
end
def
validate!
lines
=
[]
lines
<<
"* the `platform` attribute should be either `:osx` or `:ios`"
unless
[
:osx
,
:ios
].
include?
(
@platform
)
lines
<<
"* no dependencies were specified, which is, well, kinda pointless"
if
@dependencies
.
empty?
raise
(
Informative
,
([
"The Podfile at `
#{
@defined_in_file
}
' is invalid:"
]
+
lines
).
join
(
"
\n
"
))
unless
lines
.
empty?
end
end
end
lib/cocoapods/resolver.rb
View file @
4d9fecdf
...
@@ -28,7 +28,7 @@ module Pod
...
@@ -28,7 +28,7 @@ module Pod
def
validate_platform!
(
set
)
def
validate_platform!
(
set
)
spec
=
set
.
specification
spec
=
set
.
specification
unless
spec
.
any_platform
?
||
spec
.
platform
==
@specification
.
platform
unless
spec
.
platform
.
nil
?
||
spec
.
platform
==
@specification
.
platform
raise
Informative
,
"The platform required by the Podfile (:
#{
@specification
.
platform
}
) "
\
raise
Informative
,
"The platform required by the Podfile (:
#{
@specification
.
platform
}
) "
\
"does not match that of
#{
spec
}
(:
#{
spec
.
platform
}
)"
"does not match that of
#{
spec
}
(:
#{
spec
.
platform
}
)"
end
end
...
...
lib/cocoapods/specification.rb
View file @
4d9fecdf
...
@@ -5,10 +5,10 @@ module Pod
...
@@ -5,10 +5,10 @@ module Pod
eval
(
path
.
read
,
nil
,
path
.
to_s
)
eval
(
path
.
read
,
nil
,
path
.
to_s
)
end
end
class
Specification
class
Specification
autoload
:Set
,
'cocoapods/specification/set'
autoload
:Set
,
'cocoapods/specification/set'
# The file is expected to define and return
either a Pods::Specification or a Pod::File
.
# The file is expected to define and return
a Pods::Specification
.
def
self
.
from_file
(
path
)
def
self
.
from_file
(
path
)
spec
=
Pod
.
_eval_podspec
(
path
)
spec
=
Pod
.
_eval_podspec
(
path
)
spec
.
defined_in_file
=
path
spec
.
defined_in_file
=
path
...
@@ -79,14 +79,6 @@ module Pod
...
@@ -79,14 +79,6 @@ module Pod
end
end
attr_reader
:clean_paths
attr_reader
:clean_paths
def
dependency
(
*
name_and_version_requirements
)
name
,
*
version_requirements
=
name_and_version_requirements
.
flatten
dep
=
Dependency
.
new
(
name
,
*
version_requirements
)
@dependencies
<<
dep
dep
end
attr_reader
:dependencies
def
xcconfig
=
(
hash
)
def
xcconfig
=
(
hash
)
@xcconfig
.
merge!
(
hash
)
@xcconfig
.
merge!
(
hash
)
end
end
...
@@ -111,8 +103,6 @@ module Pod
...
@@ -111,8 +103,6 @@ module Pod
@header_dir
||
pod_destroot_name
@header_dir
||
pod_destroot_name
end
end
attr_accessor
:requires_arc
attr_writer
:compiler_flags
attr_writer
:compiler_flags
def
compiler_flags
def
compiler_flags
flags
=
"
#{
@compiler_flags
}
"
flags
=
"
#{
@compiler_flags
}
"
...
@@ -120,9 +110,22 @@ module Pod
...
@@ -120,9 +110,22 @@ module Pod
flags
flags
end
end
# These are attributes which are also on a Podfile
attr_accessor
:platform
attr_accessor
:platform
attr_accessor
:requires_arc
attr_accessor
:generate_bridge_support
attr_accessor
:generate_bridge_support
alias_method
:generate_bridge_support?
,
:generate_bridge_support
def
dependency
(
*
name_and_version_requirements
)
name
,
*
version_requirements
=
name_and_version_requirements
.
flatten
dep
=
Dependency
.
new
(
name
,
*
version_requirements
)
@dependencies
<<
dep
dep
end
attr_reader
:dependencies
# Not attributes
# Not attributes
...
@@ -171,10 +174,6 @@ module Pod
...
@@ -171,10 +174,6 @@ module Pod
false
false
end
end
def
any_platform?
platform
.
nil?
end
# Returns all resource files of this pod, but relative to the
# Returns all resource files of this pod, but relative to the
# project pods root.
# project pods root.
def
expanded_resources
def
expanded_resources
...
@@ -342,18 +341,4 @@ module Pod
...
@@ -342,18 +341,4 @@ module Pod
end
end
Spec
=
Specification
Spec
=
Specification
class
File
<
Specification
def
podfile?
true
end
def
to_s
"podfile at `
#{
defined_in_file
}
'"
end
def
pod_destroot
# A Podfile has none
end
end
end
end
lib/cocoapods/xcode/copy_resources_script.rb
View file @
4d9fecdf
module
Pod
module
Pod
module
Xcode
module
Xcode
class
CopyResourcesScript
class
CopyResourcesScript
attr_reader
:resources
# A list of files relative to the project pods root.
# A list of files relative to the project pods root.
def
initialize
(
resources
)
def
initialize
(
resources
)
@resources
=
resources
@resources
=
resources
...
...
lib/cocoapods/xcode/project.rb
View file @
4d9fecdf
...
@@ -220,9 +220,9 @@ module Pod
...
@@ -220,9 +220,9 @@ module Pod
# TODO this is a workaround for an issue with MacRuby with compiled files
# TODO this is a workaround for an issue with MacRuby with compiled files
# that makes the use of __FILE__ impossible.
# that makes the use of __FILE__ impossible.
#
#
#TEMPLATES_DIR = Pathname.new(
::
File.expand_path('../../../../xcode-project-templates', __FILE__))
#TEMPLATES_DIR = Pathname.new(File.expand_path('../../../../xcode-project-templates', __FILE__))
file
=
$LOADED_FEATURES
.
find
{
|
file
|
file
=~
%r{cocoapods/xcode/project
\.
rbo?$}
}
file
=
$LOADED_FEATURES
.
find
{
|
file
|
file
=~
%r{cocoapods/xcode/project
\.
rbo?$}
}
TEMPLATES_DIR
=
Pathname
.
new
(
::
File
.
expand_path
(
'../../../../xcode-project-templates'
,
file
))
TEMPLATES_DIR
=
Pathname
.
new
(
File
.
expand_path
(
'../../../../xcode-project-templates'
,
file
))
def
self
.
static_library
(
platform
)
def
self
.
static_library
(
platform
)
case
platform
case
platform
...
...
spec/fixtures/Podfile
View file @
4d9fecdf
Pod
::
File
.
new
do
|
f
|
platform
:ios
f
.
platform
=
:ios
dependency
'SSZipArchive'
,
'>= 1'
f
.
dependency
'SSZipArchive'
,
'>= 1'
dependency
'ASIHTTPRequest'
,
'~> 1.8.0'
f
.
dependency
'ASIHTTPRequest'
,
'~> 1.8.0'
dependency
'Reachability'
# part of ASIHTTPRequest
f
.
dependency
'Reachability'
# part of ASIHTTPRequest
dependency
'ASIWebPageRequest'
,
'< 1.8.2'
# part of ASIHTTPRequest
f
.
dependency
'ASIWebPageRequest'
,
'< 1.8.2'
# part of ASIHTTPRequest
end
spec/integration_spec.rb
View file @
4d9fecdf
...
@@ -44,11 +44,11 @@ else
...
@@ -44,11 +44,11 @@ else
# TODO add a simple source file which uses the compiled lib to check that it really really works
# TODO add a simple source file which uses the compiled lib to check that it really really works
it
"should activate required pods and create a working static library xcode project"
do
it
"should activate required pods and create a working static library xcode project"
do
spec
=
Pod
::
File
.
new
do
|
s
|
spec
=
Pod
::
Podfile
.
new
do
s
.
platform
=
platform
s
elf
.
platform
platform
s
.
dependency
'ASIWebPageRequest'
,
'>= 1.8.1'
dependency
'ASIWebPageRequest'
,
'>= 1.8.1'
s
.
dependency
'JSONKit'
,
'>= 1.0'
dependency
'JSONKit'
,
'>= 1.0'
s
.
dependency
'SSZipArchive'
,
'< 2'
dependency
'SSZipArchive'
,
'< 2'
end
end
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
...
@@ -74,9 +74,9 @@ else
...
@@ -74,9 +74,9 @@ else
end
end
it
"does not activate pods that are only part of other pods"
do
it
"does not activate pods that are only part of other pods"
do
spec
=
Pod
::
File
.
new
do
|
s
|
spec
=
Pod
::
Podfile
.
new
do
s
.
platform
=
platform
s
elf
.
platform
platform
s
.
dependency
'Reachability'
dependency
'Reachability'
end
end
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
...
@@ -87,9 +87,9 @@ else
...
@@ -87,9 +87,9 @@ else
end
end
it
"adds resources to the xcode copy script"
do
it
"adds resources to the xcode copy script"
do
spec
=
Pod
::
File
.
new
do
|
s
|
spec
=
Pod
::
Podfile
.
new
do
s
.
platform
=
platform
s
elf
.
platform
platform
s
.
dependency
'SSZipArchive'
dependency
'SSZipArchive'
end
end
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
...
@@ -104,18 +104,18 @@ else
...
@@ -104,18 +104,18 @@ else
# TODO we need to do more cleaning and/or add a --prune task
# TODO we need to do more cleaning and/or add a --prune task
it
"overwrites an existing project.pbxproj file"
do
it
"overwrites an existing project.pbxproj file"
do
spec
=
Pod
::
File
.
new
do
|
s
|
spec
=
Pod
::
Podfile
.
new
do
s
.
platform
=
platform
s
elf
.
platform
platform
s
.
dependency
'JSONKit'
dependency
'JSONKit'
end
end
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
installer
.
install!
installer
.
install!
Pod
::
Source
.
reset!
Pod
::
Source
.
reset!
Pod
::
Spec
::
Set
.
reset!
Pod
::
Spec
::
Set
.
reset!
spec
=
Pod
::
File
.
new
do
|
s
|
spec
=
Pod
::
Podfile
.
new
do
s
.
platform
=
platform
s
elf
.
platform
platform
s
.
dependency
'SSZipArchive'
dependency
'SSZipArchive'
end
end
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
installer
.
install!
installer
.
install!
...
...
spec/unit/podfile_spec.rb
0 → 100644
View file @
4d9fecdf
require
File
.
expand_path
(
'../../spec_helper'
,
__FILE__
)
describe
"Pod::Podfile"
do
it
"loads from a file"
do
podfile
=
Pod
::
Podfile
.
from_file
(
fixture
(
'Podfile'
))
podfile
.
defined_in_file
.
should
==
fixture
(
'Podfile'
)
end
it
"assigns the platform attribute"
do
podfile
=
Pod
::
Podfile
.
new
{
platform
:ios
}
podfile
.
platform
.
should
==
:ios
end
it
"adds dependencies"
do
podfile
=
Pod
::
Podfile
.
new
{
dependency
'ASIHTTPRequest'
;
dependency
'SSZipArchive'
,
'>= 0.1'
}
podfile
.
dependencies
.
size
.
should
==
2
podfile
.
dependency_by_name
(
'ASIHTTPRequest'
).
should
==
Pod
::
Dependency
.
new
(
'ASIHTTPRequest'
)
podfile
.
dependency_by_name
(
'SSZipArchive'
).
should
==
Pod
::
Dependency
.
new
(
'SSZipArchive'
,
'>= 0.1'
)
end
it
"specifies if BridgeSupport metadata should be generated"
do
podfile
=
Pod
::
Podfile
.
new
{
generate_bridge_support!
}
podfile
.
generate_bridge_support?
.
should
==
true
end
describe
"concerning validations"
do
it
"raises if no platform is specified"
do
exception
=
lambda
{
Pod
::
Podfile
.
new
{}.
validate!
}.
should
.
raise
Pod
::
Informative
exception
.
message
.
should
.
include
"platform"
end
it
"raises if an invalid platform is specified"
do
exception
=
lambda
{
Pod
::
Podfile
.
new
{
platform
:windows
}.
validate!
}.
should
.
raise
Pod
::
Informative
exception
.
message
.
should
.
include
"platform"
end
it
"raises if no dependencies were specified"
do
exception
=
lambda
{
Pod
::
Podfile
.
new
{}.
validate!
}.
should
.
raise
Pod
::
Informative
exception
.
message
.
should
.
include
"dependencies"
end
end
end
spec/unit/specification_spec.rb
View file @
4d9fecdf
require
File
.
expand_path
(
'../../spec_helper'
,
__FILE__
)
require
File
.
expand_path
(
'../../spec_helper'
,
__FILE__
)
describe
"A Pod::Specification loaded from a Podfile"
do
before
do
@spec
=
Pod
::
Specification
.
from_file
(
fixture
(
'Podfile'
))
end
it
"lists the project's dependencies"
do
@spec
.
dependencies
.
should
==
[
Pod
::
Dependency
.
new
(
'SSZipArchive'
,
'>= 1'
),
Pod
::
Dependency
.
new
(
'ASIHTTPRequest'
,
'~> 1.8.0'
),
Pod
::
Dependency
.
new
(
'Reachability'
,
'>= 0'
),
Pod
::
Dependency
.
new
(
'ASIWebPageRequest'
,
' < 1.8.2'
)
]
end
it
"returns the path to the Podfile"
do
@spec
.
defined_in_file
.
should
==
fixture
(
'Podfile'
)
end
it
"returns that it's loaded from a Podfile"
do
@spec
.
should
.
be
.
podfile
end
it
"does not have a destroot"
do
@spec
.
pod_destroot
.
should
==
nil
end
end
describe
"A Pod::Specification loaded from a podspec"
do
describe
"A Pod::Specification loaded from a podspec"
do
before
do
before
do
@spec
=
Pod
::
Specification
.
from_file
(
fixture
(
'banana-lib/BananaLib.podspec'
))
@spec
=
Pod
::
Specification
.
from_file
(
fixture
(
'banana-lib/BananaLib.podspec'
))
...
@@ -286,9 +259,7 @@ describe "A Pod::Specification, in general," do
...
@@ -286,9 +259,7 @@ describe "A Pod::Specification, in general," do
end
end
it
"returns the platform that the static library should be build for"
do
it
"returns the platform that the static library should be build for"
do
@spec
.
should
.
be
.
any_platform
@spec
.
platform
=
:ios
@spec
.
platform
=
:ios
@spec
.
platform
.
should
==
:ios
@spec
.
platform
.
should
==
:ios
@spec
.
should
.
not
.
be
.
any_platform
end
end
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