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
a6029d66
Commit
a6029d66
authored
Dec 18, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Integration] Cleaned specs.
parent
5190db62
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
228 additions
and
238 deletions
+228
-238
Gemfile.lock
Gemfile.lock
+2
-2
installer.rb
lib/cocoapods/installer.rb
+8
-1
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+1
-1
local_pod.rb
lib/cocoapods/local_pod.rb
+0
-0
integration_spec.rb
spec/integration_spec.rb
+194
-232
spec_helper.rb
spec/spec_helper.rb
+22
-1
bacon.rb
spec/spec_helper/bacon.rb
+1
-1
No files found.
Gemfile.lock
View file @
a6029d66
GIT
remote: git://github.com/CocoaPods/Core.git
revision:
08a308017a4fbf327143f14353cf698460088ac9
revision:
65076d5eb9b6b99ecce7b4628ce08b4c0f98f192
specs:
cocoapods-core (0.17.0.alpha)
activesupport (~> 3.2.6)
...
...
@@ -63,7 +63,7 @@ GEM
multipart-post (~> 1.1)
faraday_middleware (0.9.0)
faraday (>= 0.7.4, < 0.9)
github-markup (0.7.
4
)
github-markup (0.7.
5
)
hashie (1.2.0)
i18n (0.6.1)
json (1.7.5)
...
...
lib/cocoapods/installer.rb
View file @
a6029d66
...
...
@@ -128,6 +128,13 @@ module Pod
#-------------------------------------------------------------------------#
# @!group Hooks compatiblity
alias
:project
:pods_project
alias
:pods
:local_pods
#-------------------------------------------------------------------------#
# @!group Installation steps
private
...
...
@@ -238,7 +245,7 @@ module Pod
unless
analyzer
.
sandbox_state
.
deleted
.
empty?
UI
.
section
"Removing deleted dependencies"
do
pods_deleted_from_the_lockfile
.
each
do
|
pod_name
|
analyzer
.
sandbox_state
.
deleted
.
each
do
|
pod_name
|
UI
.
section
(
"Removing
#{
pod_name
}
"
,
"-> "
.
red
)
do
path
=
sandbox
.
root
+
pod_name
path
.
rmtree
if
path
.
exist?
...
...
lib/cocoapods/installer/analyzer.rb
View file @
a6029d66
...
...
@@ -203,7 +203,7 @@ module Pod
lib
.
user_targets
=
[]
lib
.
user_build_configurations
=
{}
lib
.
platform
=
target_definition
.
platform
raise
Informative
"It is necessary to specify the platform in the Podfile if not integrating."
unless
target_definition
.
platform
raise
Informative
,
"It is necessary to specify the platform in the Podfile if not integrating."
unless
target_definition
.
platform
end
libraries
<<
lib
end
...
...
lib/cocoapods/local_pod.rb
View file @
a6029d66
spec/integration_spec.rb
View file @
a6029d66
...
...
@@ -3,195 +3,150 @@ require 'yaml'
# TODO Make specs faster by limiting remote network connections
module
SpecHelper
class
Installer
<
Pod
::
Installer
# Here we override the `source' of the pod specifications to point to the integration fixtures.
def
specs_by_target
@specs_by_target
||=
super
.
tap
do
|
hash
|
hash
.
values
.
flatten
.
each
do
|
spec
|
next
if
spec
.
subspec?
source
=
spec
.
source
source
[
:git
]
=
SpecHelper
.
fixture
(
"integration/
#{
spec
.
name
}
"
).
to_s
spec
.
source
=
source
end
end
end
end
end
unless
SpecHelper
.
fixture
(
'integration/ASIHTTPRequest/Classes'
).
exist?
puts
"[!] You must run `git submodule update --init` for the integration spec to work, skipping."
else
[
:ios
,
:osx
].
each
do
|
platform
|
describe
"A full (integration spec) installation for platform `
#{
platform
}
'"
do
extend
SpecHelper
::
TemporaryDirectory
#-----------------------------------------------------------------------------#
def
create_config!
config
.
repos_dir
=
fixture
(
'spec-repos'
)
config
.
project_root
=
temporary_directory
config
.
integrate_targets
=
false
end
# @!group Helpers
before
do
fixture
(
'spec-repos/master'
)
# ensure the archive is unpacked
create_config!
end
def
should_successfully_perform
(
command
)
output
=
`
#{
command
}
2>&1`
puts
output
unless
$?
.
success?
$?
.
should
.
be
.
success
end
def
skip_xcodebuild?
ENV
[
'SKIP_XCODEBUILD'
]
end
puts
" !
"
.
red
<<
"Skipping xcodebuild based checks, because it can't be found."
if
skip_xcodebuild?
puts
" [!]
"
.
red
<<
"Skipping xcodebuild based checks, because it can't be found."
if
skip_xcodebuild?
def
should_xcodebuild
(
target_definition
)
def
should_xcodebuild
(
target_definition
)
return
if
skip_xcodebuild?
target
=
target_definition
Dir
.
chdir
(
config
.
project_pods_root
)
do
print
"[!] Compiling
#{
target
.
label
}
...
\r
"
should_successfully_perform
"xcodebuild -target '
#{
target
.
label
}
'"
lib_path
=
config
.
project_pods_root
+
"build/Release
#{
'-iphoneos'
if
target
.
platform
==
:ios
}
"
+
target
.
lib_name
product_name
=
"lib
#{
target_definition
.
label
}
.a"
lib_path
=
config
.
project_pods_root
+
"build/Release
#{
'-iphoneos'
if
target
.
platform
==
:ios
}
"
+
product_name
`lipo -info '
#{
lib_path
}
'`
.
should
.
include
"
#{
target
.
platform
==
:ios
?
'armv7'
:
'x86_64'
}
"
end
end
def
should_successfully_perform
(
command
)
output
=
`
#{
command
}
2>&1`
puts
output
unless
$?
.
success?
$?
.
should
.
be
.
success
end
#-----------------------------------------------------------------------------#
module
Pod
describe
"Full integration"
do
before
do
# fixture('spec-repos/master') # ensure the archive is unpacked
config
.
integrate_targets
=
false
end
# Lame way to run on one platform only
if
platform
==
:ios
#-------------------------------------------------------------------------#
describe
"Single platform"
do
extend
SpecHelper
::
TemporaryDirectory
# it "includes automatically inherited subspecs" do
# end
# it "handles different subspecs for the same Pod in different target definitions" do
# end
it
"installs a Pod directly from its repo"
do
url
=
fixture
(
'integration/sstoolkit'
).
to_s
commit
=
'2adcd0f81740d6b0cd4589af98790eee3bd1ae7b'
podfile
=
Pod
::
Podfile
.
new
do
self
.
platform
:ios
podfile
=
Podfile
.
new
do
platform
:ios
xcodeproj
'dummy'
pod
'SSToolkit'
,
:git
=>
url
,
:commit
=>
commit
end
# Note that we are *not* using the stubbed SpecHelper::Installer subclass.
installer
=
Pod
::
Installer
.
new
(
Pod
::
Sandbox
.
new
(
config
.
project_pods_root
),
podfile
)
installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
installer
.
install!
result
=
installer
.
lockfile
.
to_hash
result
[
'PODS'
].
should
==
[
'SSToolkit (0.1.3)'
]
result
[
'DEPENDENCIES'
].
should
==
[
"SSToolkit (from `
#{
url
}
', commit `
#{
commit
}
'
)"
]
result
[
'EXTERNAL SOURCES'
].
should
==
{
"SSToolkit"
=>
{
:git
=>
url
,
:commit
=>
commit
}}
lockfile
=
installer
.
lockfile
.
to_hash
lockfile
[
'PODS'
].
should
==
[
'SSToolkit (0.1.3)'
]
lockfile
[
'DEPENDENCIES'
].
should
==
[
"SSToolkit (from `
#{
url
}
`, commit `
#{
commit
}
`
)"
]
lockfile
[
'EXTERNAL SOURCES'
].
should
==
{
"SSToolkit"
=>
{
:git
=>
url
,
:commit
=>
commit
}}
end
#--------------------------------------#
# @todo Using the podspec from the repo might invalidate the test.
#
it
"installs a library with a podspec outside of the repo"
do
url
=
'https://raw.github.com/gist/1349824/3ec6aa60c19113573fc48eac19d0fafd6a69e033/Reachability.podspec'
podfile
=
Pod
::
Podfile
.
new
do
self
.
platform
:ios
url
=
fixture
(
'integration/Reachability/Reachability.podspec'
).
to_s
podfile
=
Podfile
.
new
do
platform
:ios
xcodeproj
'dummy'
# TODO use a local file instead of http?
pod
'Reachability'
,
:podspec
=>
url
end
installer
=
SpecHelper
::
Installer
.
new
(
Pod
::
Sandbox
.
new
(
config
.
project_pods_root
)
,
podfile
)
installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
installer
.
install!
result
=
installer
.
lockfile
.
to_hash
result
[
'PODS'
].
should
==
[
'Reachability (1.2.3
)'
]
result
[
'DEPENDENCIES'
].
should
==
[
"Reachability (from `
#{
url
}
'
)"
]
result
[
'EXTERNAL SOURCES'
].
should
==
{
"Reachability"
=>
{
:podspec
=>
"https://raw.github.com/gist/1349824/3ec6aa60c19113573fc48eac19d0fafd6a69e033/Reachability.podspec"
}}
lockfile
=
installer
.
lockfile
.
to_hash
lockfile
[
'PODS'
].
should
==
[
'Reachability (3.0.0
)'
]
lockfile
[
'DEPENDENCIES'
].
should
==
[
"Reachability (from `
#{
url
}
`
)"
]
lockfile
[
'EXTERNAL SOURCES'
].
should
==
{
"Reachability"
=>
{
:podspec
=>
url
}}
end
#--------------------------------------#
it
"installs a dummy source file"
do
create_config!
podfile
=
Pod
::
Podfile
.
new
do
self
.
platform
:ios
xcodeproj
'dummy'
pod
do
|
s
|
s
.
name
=
'JSONKit'
s
.
version
=
'1.2'
s
.
source
=
{
:git
=>
SpecHelper
.
fixture
(
'integration/JSONKit'
).
to_s
,
:tag
=>
'v1.2'
}
s
.
source_files
=
'JSONKit.*'
end
podfile
=
Podfile
.
new
do
platform
:ios
pod
'JSONKit'
end
resolver
=
Pod
::
Resolver
.
new
(
podfile
,
nil
,
Pod
::
Sandbox
.
new
(
config
.
project_pods_root
))
installer
=
SpecHelper
::
Installer
.
new
(
resolver
)
installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
installer
.
install!
dummy
=
(
config
.
project_pods_root
+
'PodsDummy_Pods.m'
).
read
dummy
.
should
.
include?
(
'@implementation PodsDummy_Pods'
)
end
#--------------------------------------#
it
"installs a dummy source file unique to the target"
do
create_config!
podfile
=
Pod
::
Podfile
.
new
do
self
.
platform
:ios
podfile
=
Podfile
.
new
do
platform
:ios
xcodeproj
'dummy'
pod
do
|
s
|
s
.
name
=
'JSONKit'
s
.
version
=
'1.2'
s
.
source
=
{
:git
=>
SpecHelper
.
fixture
(
'integration/JSONKit'
).
to_s
,
:tag
=>
'v1.2'
}
s
.
source_files
=
'JSONKit.*'
end
pod
'JSONKit'
target
:AnotherTarget
do
pod
'ASIHTTPRequest'
end
end
resolver
=
Pod
::
Resolver
.
new
(
podfile
,
nil
,
Pod
::
Sandbox
.
new
(
config
.
project_pods_root
))
installer
=
SpecHelper
::
Installer
.
new
(
resolver
)
installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
installer
.
install!
dummy
=
(
config
.
project_pods_root
+
'PodsDummy_Pods_AnotherTarget.m'
).
read
dummy
.
should
.
include?
(
'@implementation PodsDummy_Pods_AnotherTarget'
)
end
it
"installs a library with a podspec defined inline"
do
podfile
=
Pod
::
Podfile
.
new
do
self
.
platform
:ios
xcodeproj
'dummy'
pod
do
|
s
|
s
.
name
=
'JSONKit'
s
.
version
=
'1.2'
s
.
source
=
{
:git
=>
SpecHelper
.
fixture
(
'integration/JSONKit'
).
to_s
,
:tag
=>
'v1.2'
}
s
.
source_files
=
'JSONKit.*'
end
pod
do
|
s
|
s
.
name
=
'SSZipArchive'
s
.
version
=
'0.1.0'
s
.
source
=
{
:git
=>
SpecHelper
.
fixture
(
'integration/SSZipArchive'
).
to_s
,
:tag
=>
'0.1.0'
}
s
.
source_files
=
'SSZipArchive.*'
,
'minizip/*.{h,c}'
end
end
Pod
::
Specification
.
any_instance
.
stubs
(
:preserve_paths
).
returns
([
'CHANGELOG.md'
])
resolver
=
Pod
::
Resolver
.
new
(
podfile
,
nil
,
Pod
::
Sandbox
.
new
(
config
.
project_pods_root
))
installer
=
SpecHelper
::
Installer
.
new
(
resolver
)
installer
.
install!
installer
.
lockfile
.
to_hash
.
tap
{
|
d
|
d
.
delete
(
"COCOAPODS"
)
}.
should
==
{
'PODS'
=>
[
'JSONKit (1.2)'
,
'SSZipArchive (0.1.0)'
],
'DEPENDENCIES'
=>
[
"JSONKit (defined in Podfile)"
,
"SSZipArchive (defined in Podfile)"
]
}
change_log
=
(
config
.
project_pods_root
+
'JSONKit/CHANGELOG.md'
).
read
change_log
.
should
.
include
'1.2'
change_log
.
should
.
not
.
include
'1.3'
end
#--------------------------------------#
# @note ASIHTTPRequest depends on Reachability in iOS.
#
it
"creates targets for different platforms"
do
podfile
=
Pod
::
Podfile
.
new
do
self
.
platform
:ios
podfile
=
Podfile
.
new
do
platform
:ios
xcodeproj
'dummy'
pod
'JSONKit'
,
'1.4'
target
:ios_target
do
# This brings in Reachability on iOS
pod
'ASIHTTPRequest'
pod
'ASIHTTPRequest'
,
'1.8.1'
end
target
:osx_target
do
self
.
platform
:osx
pod
'ASIHTTPRequest
'
platform
:osx
pod
'ASIHTTPRequest'
,
'1.8.1
'
end
end
resolver
=
Pod
::
Resolver
.
new
(
podfile
,
nil
,
Pod
::
Sandbox
.
new
(
config
.
project_pods_root
))
installer
=
SpecHelper
::
Installer
.
new
(
resolver
)
installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
installer
.
install!
result
=
installer
.
lockfile
.
to_hash
result
[
'PODS'
].
should
==
[
lockfile
=
installer
.
lockfile
.
to_hash
lockfile
[
'PODS'
].
should
==
[
{
"ASIHTTPRequest (1.8.1)"
=>
[
"ASIHTTPRequest/ASIWebPageRequest (= 1.8.1)"
,
"ASIHTTPRequest/CloudFiles (= 1.8.1)"
,
...
...
@@ -205,34 +160,30 @@ else
"JSONKit (1.4)"
,
"Reachability (3.1.0)"
]
result
[
'DEPENDENCIES'
].
should
==
[
"ASIHTTPRequest"
,
"JSONKit (= 1.4)"
]
# TODO might be nicer looking to not show the dependencies of the top level spec for each subspec (Reachability).
lockfile
[
'DEPENDENCIES'
].
should
==
[
"ASIHTTPRequest (= 1.8.1)"
,
"JSONKit (= 1.4)"
]
should_xcodebuild
(
podfile
.
target_definitions
[
:ios_target
])
should_xcodebuild
(
podfile
.
target_definitions
[
:osx_target
])
end
unless
`which appledoc`
.
strip
.
empty?
it
"generates documentation of all pods by default"
do
::
Pod
::
Config
.
instance
=
nil
::
Pod
::
Config
.
instance
.
tap
do
|
c
|
ENV
[
'VERBOSE_SPECS'
]
?
c
.
verbose
=
true
:
c
.
silent
=
true
c
.
doc_install
=
false
c
.
repos_dir
=
fixture
(
'spec-repos'
)
c
.
project_root
=
temporary_directory
c
.
integrate_targets
=
false
c
.
skip_repo_update
=
true
end
#--------------------------------------#
Pod
::
Generator
::
Documentation
.
any_instance
.
stubs
(
:already_installed?
).
returns
(
false
)
if
`which appledoc`
.
strip
.
empty?
puts
" ! "
.
red
<<
"Skipping documentation generation specs, because appledoc can't be found."
else
it
"generates documentation of all pods by default"
do
podfile
=
Pod
::
Podfile
.
new
do
self
.
platform
:ios
podfile
=
Podfile
.
new
do
platform
:ios
xcodeproj
'dummy'
pod
'JSONKit'
,
'1.4'
pod
'SSToolkit'
,
'1.0.0'
end
resolver
=
Pod
::
Resolver
.
new
(
podfile
,
nil
,
Pod
::
Sandbox
.
new
(
config
.
project_pods_root
))
installer
=
SpecHelper
::
Installer
.
new
(
resolver
)
config
.
generate_docs
=
true
config
.
doc_install
=
false
Generator
::
Documentation
.
any_instance
.
stubs
(
:already_installed?
).
returns
(
false
)
installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
installer
.
install!
doc
=
(
config
.
project_pods_root
+
'Documentation/JSONKit/html/index.html'
).
read
...
...
@@ -240,34 +191,43 @@ else
doc
=
(
config
.
project_pods_root
+
'Documentation/SSToolkit/html/index.html'
).
read
doc
.
should
.
include?
(
'<title>SSToolkit 1.0.0 Reference</title>'
)
end
else
puts
" ! "
.
red
<<
"Skipping documentation generation specs, because appledoc can't be found."
end
end
#-------------------------------------------------------------------------#
[
:ios
,
:osx
].
each
do
|
test_platform
|
describe
"Multi-platform (
#{
test_platform
}
)"
do
extend
SpecHelper
::
TemporaryDirectory
before
do
FileUtils
.
cp_r
(
fixture
(
'integration/.'
),
config
.
project_pods_root
)
end
it
"runs the optional pre_install callback defined in the Podfile _before_ the targets are integrated but _after_ the pods have been downloaded"
do
podfile
=
Pod
::
Podfile
.
new
do
self
.
platform
platform
#--------------------------------------#
it
"runs the optional pre-install callback defined in the Podfile *before* the targets are integrated but *after* the pods have been downloaded"
do
podfile
=
Podfile
.
new
do
platform
test_platform
xcodeproj
'dummy'
pod
'SSZipArchive'
,
'0.1.0'
pre_install
do
|
installer
|
memo
=
"PODS:
#{
installer
.
pods
*
', '
}
TARGETS:
#{
installer
.
project
.
targets
.
to_a
*
', '
}
"
File
.
open
(
config
.
project_pods_root
+
'memo.txt'
,
'w'
)
{
|
f
|
f
.
puts
memo
}
File
.
open
(
installer
.
config
.
project_pods_root
+
'memo.txt'
,
'w'
)
{
|
f
|
f
.
puts
memo
}
end
end
resolver
=
Pod
::
Resolver
.
new
(
podfile
,
nil
,
Pod
::
Sandbox
.
new
(
config
.
project_pods_root
))
SpecHelper
::
Installer
.
new
(
resolver
).
install!
Installer
.
new
(
config
.
sandbox
,
podfile
).
install!
File
.
open
(
config
.
project_pods_root
+
'memo.txt'
,
'rb'
).
read
.
should
==
"PODS:SSZipArchive (0.1.0) TARGETS:
\n
"
end
it
"runs the optional post_install callback defined in the Podfile _before_ the project is saved to disk"
do
podfile
=
Pod
::
Podfile
.
new
do
self
.
platform
platform
#--------------------------------------#
it
"runs the optional post-install callback defined in the Podfile *before* the project is saved to disk"
do
podfile
=
Podfile
.
new
do
platform
test_platform
xcodeproj
'dummy'
pod
'SSZipArchive'
,
'0.1.0'
...
...
@@ -279,26 +239,30 @@ else
end
end
resolver
=
Pod
::
Resolver
.
new
(
podfile
,
nil
,
Pod
::
Sandbox
.
new
(
config
.
project_pods_root
))
SpecHelper
::
Installer
.
new
(
resolver
).
install!
project
=
Pod
::
Project
.
new
(
config
.
project_pods_root
+
'Pods.xcodeproj'
)
Installer
.
new
(
config
.
sandbox
,
podfile
).
install!
project
=
Project
.
new
(
config
.
project_pods_root
+
'Pods.xcodeproj'
)
project
.
targets
.
first
.
build_configurations
.
map
do
|
config
|
config
.
build_settings
[
'GCC_ENABLE_OBJC_GC'
]
end
.
should
==
%w{ supported supported }
end
#--------------------------------------#
# TODO add a simple source file which uses the compiled lib to check that it really really works
it
"activates required pods and create a working static library xcode project"
do
podfile
=
Pod
::
Podfile
.
new
do
self
.
platform
platform
podfile
=
Podfile
.
new
do
platform
test_
platform
xcodeproj
'dummy'
pod
'Reachability'
,
'> 2.0.5'
if
platform
==
:ios
if
test_platform
==
:ios
pod
'Reachability'
,
'> 2.0.5'
end
pod
'JSONKit'
,
'>= 1.0'
pod
'SSZipArchive'
,
'< 0.1.2'
end
resolver
=
Pod
::
Resolver
.
new
(
podfile
,
nil
,
Pod
::
Sandbox
.
new
(
config
.
project_pods_root
))
installer
=
SpecHelper
::
Installer
.
new
(
resolver
)
installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
installer
.
install!
lockfile_contents
=
{
...
...
@@ -312,105 +276,97 @@ else
"Reachability (> 2.0.5)"
,
"SSZipArchive (< 0.1.2)"
,
],
"COCOAPODS"
=>
Pod
::
VERSION
"COCOAPODS"
=>
VERSION
}
unless
platform
==
:ios
unless
test_platform
==
:ios
# No Reachability is required by ASIHTTPRequest on OSX
lockfile_contents
[
'DEPENDENCIES'
].
delete_at
(
1
)
lockfile_contents
[
'PODS'
].
delete_at
(
1
)
# lockfile_contents['PODS'][0] = 'ASIHTTPRequest (1.8.1)'
end
result
=
installer
.
lockfile
.
to_hash
result
.
delete
(
"SPEC CHECKSUMS"
)
result
.
should
==
lockfile_contents
lockfile
=
installer
.
lockfile
.
to_hash
lockfile
.
delete
(
"SPEC CHECKSUMS"
)
lockfile
.
should
==
lockfile_contents
root
=
config
.
project_pods_root
(
root
+
'Pods.xcconfig'
).
read
.
should
==
installer
.
target_installer
s
.
first
.
xcconfig
.
to_s
(
root
+
'Pods.xcconfig'
).
read
.
should
==
installer
.
librarie
s
.
first
.
xcconfig
.
to_s
project_file
=
(
root
+
'Pods.xcodeproj/project.pbxproj'
).
to_s
Xcodeproj
.
read_plist
(
project_file
).
should
==
installer
.
project
.
to_hash
should_xcodebuild
(
podfile
.
target_definitions
[
:default
])
end
if
platform
==
:ios
it
"does not activate pods that are only part of other pods"
do
spec
=
Pod
::
Podfile
.
new
do
self
.
platform
platform
xcodeproj
'dummy'
pod
'Reachability'
,
'2.0.4'
# only 2.0.4 is part of ASIHTTPRequest’s source.
end
resolver
=
Pod
::
Resolver
.
new
(
spec
,
nil
,
Pod
::
Sandbox
.
new
(
config
.
project_pods_root
))
installer
=
SpecHelper
::
Installer
.
new
(
resolver
)
installer
.
install!
result
=
installer
.
lockfile
.
to_hash
result
[
'PODS'
].
should
==
[
'Reachability (2.0.4)'
]
result
[
'DEPENDENCIES'
].
should
==
[
"Reachability (= 2.0.4)"
]
end
end
#--------------------------------------#
it
"adds resources to the xcode copy script"
do
spec
=
Pod
::
Podfile
.
new
do
self
.
platform
platform
podfile
=
Podfile
.
new
do
platform
test_
platform
xcodeproj
'dummy'
pod
'SSZipArchive'
,
'0.1.0'
end
resolver
=
Pod
::
Resolver
.
new
(
spec
,
nil
,
Pod
::
Sandbox
.
new
(
config
.
project_pods_root
))
installer
=
SpecHelper
::
Installer
.
new
(
resolver
)
target_definition
=
installer
.
target_installers
.
first
.
target_definition
installer
.
specs_by_target
[
target_definition
].
first
.
resources
=
'LICEN*'
,
'Readme.*'
installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
installer
.
install!
resources_value
=
{
:resources
=>
[
'LICEN*'
,
'Readme.*'
]
}
resources_pattern
=
{
:ios
=>
resources_value
,
:osx
=>
resources_value
}
Specification
.
any_instance
.
stubs
(
:resources
).
returns
(
resources_pattern
)
contents
=
(
config
.
project_pods_root
+
'Pods-resources.sh'
).
read
contents
.
should
.
include
"install_resource 'SSZipArchive/LICENSE'
\n
"
\
"install_resource 'SSZipArchive/Readme.markdown'"
end
# 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
spec
=
Pod
::
Podfile
.
new
do
self
.
platform
platform
podfile
=
Podfile
.
new
do
platform
test_
platform
xcodeproj
'dummy'
pod
'JSONKit'
end
resolver
=
Pod
::
Resolver
.
new
(
spec
,
nil
,
Pod
::
Sandbox
.
new
(
config
.
project_pods_root
))
installer
=
SpecHelper
::
Installer
.
new
(
resolver
)
installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
installer
.
install!
spec
=
Pod
::
Podfile
.
new
do
self
.
platform
platform
podfile
=
Podfile
.
new
do
platform
test_
platform
xcodeproj
'dummy'
pod
'SSZipArchive'
,
'0.1.0'
end
resolver
=
Pod
::
Resolver
.
new
(
spec
,
nil
,
Pod
::
Sandbox
.
new
(
config
.
project_pods_root
))
installer
=
SpecHelper
::
Installer
.
new
(
resolver
)
installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
installer
.
install!
project
=
Pod
::
Project
.
new
(
config
.
project_pods_root
+
'Pods.xcodeproj'
)
project
=
Project
.
new
(
config
.
project_pods_root
+
'Pods.xcodeproj'
)
disk_source_files
=
project
.
files
.
sort
.
reject
{
|
f
|
f
.
build_files
.
empty?
}
installer_source_files
=
installer
.
project
.
files
.
sort
.
reject
{
|
f
|
f
.
build_files
.
empty?
}
disk_source_files
.
should
==
installer_source_files
end
#--------------------------------------#
it
"creates a project with multiple targets"
do
podfile
=
Pod
::
Podfile
.
new
do
self
.
platform
platform
xcodeproj
'dummy'
target
(
:debug
)
{
pod
'SSZipArchive'
,
'0.1.0'
}
target
(
:test
,
:exclusive
=>
true
)
{
pod
'JSONKit'
}
podfile
=
Podfile
.
new
do
platform
test_platform
pod
'ASIHTTPRequest'
target
:debug
do
pod
'SSZipArchive'
,
'0.1.0'
end
target
:test
,
:exclusive
=>
true
do
pod
'JSONKit'
end
end
resolver
=
Pod
::
Resolver
.
new
(
podfile
,
nil
,
Pod
::
Sandbox
.
new
(
fixture
(
'integration'
)))
resolver
=
Pod
::
Resolver
.
new
(
podfile
,
nil
,
Pod
::
Sandbox
.
new
(
config
.
project_pods_root
))
installer
=
Pod
::
Installer
.
new
(
resolver
)
installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
installer
.
install!
project
=
Xcodeproj
::
Project
.
new
(
config
.
project_pods_root
+
'Pods.xcodeproj'
)
project
.
targets
.
count
.
should
==
3
project
.
targets
.
each
do
|
target
|
phase
=
target
.
build_phases
.
find
{
|
phase
|
phase
.
is_a?
(
Xcodeproj
::
Project
::
Object
::
PBXSourcesBuildPhase
)
}
phase
=
target
.
build_phases
.
find
{
|
phase
|
phase
.
isa
==
'PBXSourcesBuildPhase'
}
files
=
phase
.
files
.
map
{
|
bf
|
bf
.
file_ref
.
name
}
case
target
.
product_name
when
'Pods'
...
...
@@ -422,48 +378,54 @@ else
files
.
should
.
include
"SSZipArchive.m"
files
.
should
.
not
.
include
"JSONKit.m"
when
'Pods-test'
files
.
should
.
include
"JSONKit.m"
files
.
should
.
not
.
include
"ASIHTTPRequest.m"
files
.
should
.
not
.
include
"SSZipArchive.m"
files
.
should
.
include
"JSONKit.m"
else
raise
"ohnoes"
end
end
root
=
config
.
project_pods_root
(
root
+
'Pods.xcconfig'
).
should
.
exist
(
root
+
'Pods-debug.xcconfig'
).
should
.
exist
(
root
+
'Pods-test.xcconfig'
).
should
.
exist
(
root
+
'Pods-resources.sh'
).
should
.
exist
(
root
+
'Pods-debug-resources.sh'
).
should
.
exist
(
root
+
'Pods-test-resources.sh'
).
should
.
exist
expected_files
=
%w[
Pods.xcconfig
Pods-debug.xcconfig
Pods-test.xcconfig
Pods-resources.sh
Pods-debug-resources.sh
Pods-test-resources.sh
]
expected_files
.
each
do
|
file
|
(
config
.
project_pods_root
+
file
).
should
.
exist
end
should_xcodebuild
(
podfile
.
target_definitions
[
:default
])
should_xcodebuild
(
podfile
.
target_definitions
[
:debug
])
should_xcodebuild
(
podfile
.
target_definitions
[
:test
])
end
#--------------------------------------#
# @note The shell script should be the last phase.
#
it
"sets up an existing project with pods"
do
config
.
integrate_targets
=
true
basename
=
platform
==
:ios
?
'iPhone'
:
'Mac'
basename
=
test_
platform
==
:ios
?
'iPhone'
:
'Mac'
projpath
=
temporary_directory
+
'ASIHTTPRequest.xcodeproj'
FileUtils
.
cp_r
(
fixture
(
"integration/ASIHTTPRequest/
#{
basename
}
.xcodeproj"
),
projpath
)
podfile
=
Pod
::
Podfile
.
new
do
self
.
platform
platform
podfile
=
Podfile
.
new
do
platform
test_
platform
xcodeproj
projpath
pod
'SSZipArchive'
,
'0.1.0'
end
resolver
=
Pod
::
Resolver
.
new
(
podfile
,
nil
,
Pod
::
Sandbox
.
new
(
config
.
project_pods_root
))
installer
=
SpecHelper
::
Installer
.
new
(
resolver
)
installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
installer
.
install!
workspace
=
Xcodeproj
::
Workspace
.
new_from_xcworkspace
(
temporary_directory
+
'ASIHTTPRequest.xcworkspace'
)
workspace
.
projpaths
.
sort
.
should
==
[
'ASIHTTPRequest.xcodeproj'
,
'Pods/Pods.xcodeproj'
]
project
=
Pod
::
Project
.
new
(
projpath
)
project
=
Project
.
new
(
projpath
)
libPods
=
project
.
files
.
find
{
|
f
|
f
.
name
==
'libPods.a'
}
target
=
project
.
targets
.
first
...
...
@@ -471,21 +433,21 @@ else
config
.
base_configuration_reference
.
path
.
should
==
'Pods/Pods.xcconfig'
end
target
.
frameworks_build_phase
.
files
.
should
.
include
libPods
.
build_files
.
first
# should be the last phase
target
.
build_phases
.
last
.
shell_script
.
should
==
%{"${SRCROOT}/Pods/Pods-resources.sh"\n}
end
#--------------------------------------#
it
"should prevent duplication cleaning headers symlinks with multiple targets"
do
podfile
=
Pod
::
Podfile
.
new
do
self
.
platform
platform
podfile
=
Podfile
.
new
do
platform
test_
platform
xcodeproj
'dummy'
target
(
:debug
)
{
pod
'SSZipArchive'
,
'0.1.0'
}
target
(
:test
,
:exclusive
=>
true
)
{
pod
'JSONKit'
}
pod
'ASIHTTPRequest
'
pod
'ASIHTTPRequest'
,
'1.8.1
'
end
resolver
=
Pod
::
Resolver
.
new
(
podfile
,
nil
,
Pod
::
Sandbox
.
new
(
config
.
project_pods_root
))
installer
=
Pod
::
Installer
.
new
(
resolver
)
installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
installer
.
install!
root
=
config
.
project_pods_root
...
...
@@ -501,5 +463,5 @@ else
end
end
end
end
spec/spec_helper.rb
View file @
a6029d66
...
...
@@ -33,7 +33,6 @@ module Bacon
include
Pod
::
Config
::
Mixin
include
SpecHelper
::
Fixture
include
SpecHelper
::
Command
def
skip_xcodebuild?
ENV
[
'SKIP_XCODEBUILD'
]
end
...
...
@@ -64,6 +63,28 @@ def copy_fixture_to_pod(name, pod)
FileUtils
.
cp_r
(
path
,
pod
.
root
)
end
#-----------------------------------------------------------------------------#
# Override {Specification#source} to return sources from fixtures and limit
# network connections.
#
module
Pod
class
Specification
alias
:original_source
:source
def
source
fixture
=
SpecHelper
.
fixture
(
"integration/
#{
name
}
"
)
result
=
super
if
fixture
.
exist?
# puts "Using fixture [#{name}]"
result
[
:git
]
=
fixture
.
to_s
else
# puts "MISSING fixture [#{name}]"
end
result
end
end
end
SpecHelper
::
Fixture
.
fixture
(
'banana-lib'
)
# ensure it exists
require
"active_support/core_ext/string/strip"
spec/spec_helper/bacon.rb
View file @
a6029d66
...
...
@@ -81,7 +81,7 @@ module Bacon
end
def
handle_requirement
(
description
,
disabled
=
false
)
if
false
&&
@first_error
if
@first_error
print
Bacon
.
color
(
nil
,
'_'
)
else
error
=
yield
...
...
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