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
da121866
Commit
da121866
authored
Feb 04, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Config] #project_root -> #installation_root & project_pods_root -> sandbox_root
parent
c8060b62
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
55 additions
and
55 deletions
+55
-55
config.rb
lib/cocoapods/config.rb
+12
-10
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+3
-3
user_project_integrator.rb
lib/cocoapods/installer/user_project_integrator.rb
+7
-7
validator.rb
lib/cocoapods/validator.rb
+4
-4
integration_spec.rb
spec/integration_spec.rb
+15
-15
pre_flight.rb
spec/spec_helper/pre_flight.rb
+7
-9
config_spec.rb
spec/unit/config_spec.rb
+3
-3
analyzer_spec.rb
spec/unit/installer/analyzer_spec.rb
+2
-2
user_project_integrator_spec.rb
spec/unit/installer/user_project_integrator_spec.rb
+2
-2
No files found.
lib/cocoapods/config.rb
View file @
da121866
...
...
@@ -121,24 +121,26 @@ module Pod
# @return [Pathname] the root of the CocoaPods installation where the
# Podfile is located.
#
def
project
_root
@
project
_root
||=
Pathname
.
pwd
def
installation
_root
@
installation
_root
||=
Pathname
.
pwd
end
attr_writer
:project_root
attr_writer
:installation_root
alias
:project_root
:installation_root
# @return [Pathname] The root of the sandbox.
#
def
project_pods
_root
@
project_pods_root
||=
@project
_root
+
'Pods'
def
sandbox
_root
@
sandbox_root
||=
installation
_root
+
'Pods'
end
attr_writer
:project_pods_root
attr_writer
:sandbox_root
alias
:project_pods_root
:sandbox_root
# @return [Sandbox] The sandbox of the current project.
#
def
sandbox
@sandbox
||=
Sandbox
.
new
(
project_pods
_root
)
@sandbox
||=
Sandbox
.
new
(
sandbox
_root
)
end
# @return [Podfile] The Podfile to use for the current execution.
...
...
@@ -190,9 +192,9 @@ module Pod
#
def
podfile_path
unless
@podfile_path
@podfile_path
=
project
_root
+
'CocoaPods.podfile'
@podfile_path
=
installation
_root
+
'CocoaPods.podfile'
unless
@podfile_path
.
exist?
@podfile_path
=
project
_root
+
'Podfile'
@podfile_path
=
installation
_root
+
'Podfile'
end
end
@podfile_path
...
...
@@ -203,7 +205,7 @@ module Pod
# @note The Lockfile is named `Podfile.lock`.
#
def
lockfile_path
@lockfile_path
||=
project
_root
+
'Podfile.lock'
@lockfile_path
||=
installation
_root
+
'Podfile.lock'
end
#--------------------------------------#
...
...
lib/cocoapods/installer/analyzer.rb
View file @
da121866
...
...
@@ -198,7 +198,7 @@ module Pod
lib
.
user_build_configurations
=
compute_user_build_configurations
(
target_definition
,
lib
.
user_targets
)
lib
.
platform
=
compute_platform_for_target_definition
(
target_definition
,
lib
.
user_targets
)
else
lib
.
user_project_path
=
config
.
project
_root
lib
.
user_project_path
=
config
.
installation
_root
lib
.
user_project
=
nil
lib
.
user_targets
=
[]
lib
.
user_build_configurations
=
{}
...
...
@@ -374,7 +374,7 @@ module Pod
#
def
compute_user_project_path
(
target_definition
)
if
target_definition
.
user_project_path
path
=
config
.
project
_root
+
target_definition
.
user_project_path
path
=
config
.
installation
_root
+
target_definition
.
user_project_path
path
=
"
#{
path
}
.xcodeproj"
unless
File
.
extname
(
path
)
==
'.xcodeproj'
path
=
Pathname
.
new
(
path
)
unless
path
.
exist?
...
...
@@ -383,7 +383,7 @@ module Pod
end
else
xcodeprojs
=
Pathname
.
glob
(
config
.
project
_root
+
'*.xcodeproj'
)
xcodeprojs
=
Pathname
.
glob
(
config
.
installation
_root
+
'*.xcodeproj'
)
if
xcodeprojs
.
size
==
1
path
=
xcodeprojs
.
first
else
...
...
lib/cocoapods/installer/user_project_integrator.rb
View file @
da121866
...
...
@@ -31,7 +31,7 @@ module Pod
# should be inferred by the project. If the workspace should be in
# the same dir of the project, this could be removed.
#
attr_reader
:
project
_root
attr_reader
:
installation
_root
# @return [Library] the libraries generated by the installer.
#
...
...
@@ -39,16 +39,16 @@ module Pod
# @param [Podfile] podfile @see #podfile
# @param [Sandbox] sandbox @see #sandbox
# @param [Pathname]
project_root @see #project
_root
# @param [Pathname]
installation_root @see #installation
_root
# @param [Library] libraries @see #libraries
#
# @todo Too many initialization arguments
#
def
initialize
(
podfile
,
sandbox
,
project
_root
,
libraries
)
@podfile
=
podfile
def
initialize
(
podfile
,
sandbox
,
installation
_root
,
libraries
)
@podfile
=
podfile
@sandbox
=
sandbox
@
project_root
=
project
_root
@libraries
=
libraries
@
installation_root
=
installation
_root
@libraries
=
libraries
end
# Integrates the user projects associated with the {TargetDefinitions}
...
...
@@ -143,7 +143,7 @@ module Pod
podfile
.
workspace_path
elsif
user_project_paths
.
count
==
1
project
=
user_project_paths
.
first
.
basename
(
'.xcodeproj'
)
project
_root
+
"
#{
project
}
.xcworkspace"
installation
_root
+
"
#{
project
}
.xcworkspace"
else
raise
Informative
,
"Could not automatically select an Xcode "
\
"workspace. Specify one in your Podfile like so:
\n\n
"
\
...
...
lib/cocoapods/validator.rb
View file @
da121866
...
...
@@ -212,8 +212,8 @@ module Pod
validation_dir
.
rmtree
if
validation_dir
.
exist?
validation_dir
.
mkpath
@original_config
=
Config
.
instance
.
clone
config
.
project_root
=
validation_dir
config
.
project_pods_root
=
validation_dir
+
'Pods'
config
.
installation_root
=
validation_dir
config
.
sandbox_root
=
validation_dir
+
'Pods'
config
.
silent
=
!
config
.
verbose
config
.
integrate_targets
=
false
config
.
generate_docs
=
false
...
...
@@ -231,7 +231,7 @@ module Pod
#
def
install_pod
podfile
=
podfile_from_spec
(
consumer
.
platform
,
spec
.
deployment_target
(
consumer
.
platform
))
sandbox
=
Sandbox
.
new
(
config
.
project_pods
_root
)
sandbox
=
Sandbox
.
new
(
config
.
sandbox
_root
)
installer
=
Installer
.
new
(
sandbox
,
podfile
)
installer
.
install!
...
...
@@ -254,7 +254,7 @@ module Pod
else
UI
.
message
"
\n
Building with xcodebuild.
\n
"
.
yellow
do
messages
=
[]
output
=
Dir
.
chdir
(
config
.
project_pods
_root
)
{
`xcodebuild clean build 2>&1`
}
output
=
Dir
.
chdir
(
config
.
sandbox
_root
)
{
`xcodebuild clean build 2>&1`
}
UI
.
puts
output
parsed_output
=
parse_xcodebuild_output
(
output
)
parsed_output
.
each
do
|
message
|
...
...
spec/integration_spec.rb
View file @
da121866
...
...
@@ -14,11 +14,11 @@ puts " [!] ".red << "Skipping xcodebuild based checks, because it can't be found
def
should_xcodebuild
(
target_definition
)
return
if
skip_xcodebuild?
target
=
target_definition
Dir
.
chdir
(
config
.
project_pods
_root
)
do
Dir
.
chdir
(
config
.
sandbox
_root
)
do
print
"[!] Compiling
#{
target
.
label
}
...
\r
"
should_successfully_perform
"xcodebuild -target '
#{
target
.
label
}
'"
product_name
=
"lib
#{
target_definition
.
label
}
.a"
lib_path
=
config
.
project_pods
_root
+
"build/Release
#{
'-iphoneos'
if
target
.
platform
==
:ios
}
"
+
product_name
lib_path
=
config
.
sandbox
_root
+
"build/Release
#{
'-iphoneos'
if
target
.
platform
==
:ios
}
"
+
product_name
`lipo -info '
#{
lib_path
}
'`
.
should
.
include
"
#{
target
.
platform
==
:ios
?
'armv7'
:
'x86_64'
}
"
end
end
...
...
@@ -94,7 +94,7 @@ module Pod
installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
installer
.
install!
dummy
=
(
config
.
project_pods
_root
+
'Pods-dummy.m'
).
read
dummy
=
(
config
.
sandbox
_root
+
'Pods-dummy.m'
).
read
dummy
.
should
.
include?
(
'@implementation PodsDummy_Pods'
)
end
...
...
@@ -113,7 +113,7 @@ module Pod
installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
installer
.
install!
dummy
=
(
config
.
project_pods
_root
+
'Pods-AnotherTarget-dummy.m'
).
read
dummy
=
(
config
.
sandbox
_root
+
'Pods-AnotherTarget-dummy.m'
).
read
dummy
.
should
.
include?
(
'@implementation PodsDummy_Pods_AnotherTarget'
)
end
...
...
@@ -180,9 +180,9 @@ module Pod
installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
installer
.
install!
doc
=
(
config
.
project_pods
_root
+
'Documentation/JSONKit/html/index.html'
).
read
doc
=
(
config
.
sandbox
_root
+
'Documentation/JSONKit/html/index.html'
).
read
doc
.
should
.
include?
(
'<title>JSONKit 1.4 Reference</title>'
)
doc
=
(
config
.
project_pods
_root
+
'Documentation/SSToolkit/html/index.html'
).
read
doc
=
(
config
.
sandbox
_root
+
'Documentation/SSToolkit/html/index.html'
).
read
doc
.
should
.
include?
(
'<title>SSToolkit 1.0.0 Reference</title>'
)
end
end
...
...
@@ -195,7 +195,7 @@ module Pod
describe
"Multi-platform (
#{
test_platform
}
)"
do
before
do
FileUtils
.
cp_r
(
fixture
(
'integration/.'
),
config
.
project_pods
_root
)
FileUtils
.
cp_r
(
fixture
(
'integration/.'
),
config
.
sandbox
_root
)
end
#--------------------------------------#
...
...
@@ -208,12 +208,12 @@ module Pod
pre_install
do
|
installer
|
memo
=
"PODS:
#{
installer
.
pods
*
', '
}
TARGETS:
#{
installer
.
project
.
targets
.
to_a
*
', '
}
"
File
.
open
(
installer
.
config
.
project_pods
_root
+
'memo.txt'
,
'w'
)
{
|
f
|
f
.
puts
memo
}
File
.
open
(
installer
.
config
.
sandbox
_root
+
'memo.txt'
,
'w'
)
{
|
f
|
f
.
puts
memo
}
end
end
Installer
.
new
(
config
.
sandbox
,
podfile
).
install!
File
.
open
(
config
.
project_pods
_root
+
'memo.txt'
,
'rb'
).
read
.
should
==
"PODS:SSZipArchive (0.1.0) TARGETS:
\n
"
File
.
open
(
config
.
sandbox
_root
+
'memo.txt'
,
'rb'
).
read
.
should
==
"PODS:SSZipArchive (0.1.0) TARGETS:
\n
"
end
#--------------------------------------#
...
...
@@ -280,7 +280,7 @@ module Pod
lockfile
.
delete
(
"SPEC CHECKSUMS"
)
lockfile
.
should
==
lockfile_contents
root
=
config
.
project_pods
_root
root
=
config
.
sandbox
_root
(
root
+
'Pods.xcconfig'
).
read
.
should
==
installer
.
libraries
.
first
.
xcconfig
.
to_s
project_file
=
(
root
+
'Pods.xcodeproj/project.pbxproj'
).
to_s
saved_project
=
Xcodeproj
.
read_plist
(
project_file
)
...
...
@@ -303,7 +303,7 @@ module Pod
installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
installer
.
install!
contents
=
(
config
.
project_pods
_root
+
'Pods-resources.sh'
).
read
contents
=
(
config
.
sandbox
_root
+
'Pods-resources.sh'
).
read
contents
.
should
.
include
"install_resource 'SSZipArchive/LICENSE'
\n
"
\
"install_resource 'SSZipArchive/Readme.markdown'"
end
...
...
@@ -327,7 +327,7 @@ module Pod
installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
installer
.
install!
project
=
Xcodeproj
::
Project
.
new
(
config
.
project_pods
_root
+
'Pods.xcodeproj'
)
project
=
Xcodeproj
::
Project
.
new
(
config
.
sandbox
_root
+
'Pods.xcodeproj'
)
disk_source_files
=
project
.
files
.
sort
.
reject
{
|
f
|
f
.
build_files
.
empty?
}
installer_source_files
=
installer
.
pods_project
.
files
.
sort
.
reject
{
|
f
|
f
.
build_files
.
empty?
}
disk_source_files
.
should
==
installer_source_files
...
...
@@ -352,7 +352,7 @@ module Pod
installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
installer
.
install!
project
=
Xcodeproj
::
Project
.
new
(
config
.
project_pods
_root
+
'Pods.xcodeproj'
)
project
=
Xcodeproj
::
Project
.
new
(
config
.
sandbox
_root
+
'Pods.xcodeproj'
)
project
.
targets
.
count
.
should
==
3
project
.
targets
.
each
do
|
target
|
phase
=
target
.
build_phases
.
find
{
|
phase
|
phase
.
isa
==
'PBXSourcesBuildPhase'
}
...
...
@@ -383,7 +383,7 @@ module Pod
]
expected_files
.
each
do
|
file
|
(
config
.
project_pods
_root
+
file
).
should
.
exist
(
config
.
sandbox
_root
+
file
).
should
.
exist
end
should_xcodebuild
(
podfile
.
target_definitions
[
:default
])
...
...
@@ -439,7 +439,7 @@ module Pod
installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
installer
.
install!
root
=
config
.
project_pods
_root
root
=
config
.
sandbox
_root
(
root
+
'Pods.xcconfig'
).
should
.
exist
(
root
+
'Headers'
).
should
.
exist
(
root
+
'Headers/SSZipArchive'
).
should
.
exist
...
...
spec/spec_helper/pre_flight.rb
View file @
da121866
...
...
@@ -7,15 +7,13 @@ module Bacon
define_method
(
:run_requirement
)
do
|
description
,
spec
|
::
Pod
::
Config
.
instance
=
nil
::
Pod
::
Config
.
instance
.
tap
do
|
c
|
# c.verbose = ENV['VERBOSE_SPECS']
# c.silent = !ENV['VERBOSE_SPECS']
c
.
verbose
=
false
c
.
silent
=
true
c
.
repos_dir
=
fixture
(
'spec-repos'
)
c
.
project_root
=
SpecHelper
.
temporary_directory
c
.
install_docs
=
false
c
.
generate_docs
=
false
c
.
skip_repo_update
=
true
c
.
verbose
=
false
c
.
silent
=
true
c
.
repos_dir
=
fixture
(
'spec-repos'
)
c
.
installation_root
=
SpecHelper
.
temporary_directory
c
.
install_docs
=
false
c
.
generate_docs
=
false
c
.
skip_repo_update
=
true
end
::
Pod
::
UI
.
output
=
''
...
...
spec/unit/config_spec.rb
View file @
da121866
...
...
@@ -20,11 +20,11 @@ module Pod
describe
"Concerning a user's project, which is expected in the current working directory"
do
before
do
config
.
project
_root
=
temporary_directory
config
.
installation
_root
=
temporary_directory
end
it
"returns the path to the project root"
do
config
.
project
_root
.
should
==
temporary_directory
config
.
installation
_root
.
should
==
temporary_directory
end
it
"returns the path to the project Podfile if it exists"
do
...
...
@@ -38,7 +38,7 @@ module Pod
end
it
"returns the path to the Pods directory that holds the dependencies"
do
config
.
project_pods
_root
.
should
==
temporary_directory
+
'Pods'
config
.
sandbox
_root
.
should
==
temporary_directory
+
'Pods'
end
end
...
...
spec/unit/installer/analyzer_spec.rb
View file @
da121866
...
...
@@ -92,7 +92,7 @@ module Pod
@analyzer
.
analyze
lib
=
@analyzer
.
libraries
.
first
lib
.
user_project_path
.
should
==
config
.
project
_root
lib
.
user_project_path
.
should
==
config
.
installation
_root
lib
.
user_project
.
should
.
be
.
nil
lib
.
user_targets
.
map
(
&
:name
).
should
==
[]
lib
.
user_build_configurations
.
should
==
{}
...
...
@@ -199,7 +199,7 @@ module Pod
it
"if not specified in the target definition if looks if there is only one project"
do
target_definition
=
Podfile
::
TargetDefinition
.
new
(
:default
,
nil
,
nil
)
config
.
project_root
=
config
.
project
_root
+
'SampleProject'
config
.
installation_root
=
config
.
installation
_root
+
'SampleProject'
path
=
@analyzer
.
send
(
:compute_user_project_path
,
target_definition
)
path
.
to_s
.
should
.
include
'SampleProject/SampleProject.xcodeproj'
...
...
spec/unit/installer/user_project_integrator_spec.rb
View file @
da121866
...
...
@@ -20,7 +20,7 @@ module Pod
end
end
@
project
_root
=
@sample_project_path
.
dirname
@
installation
_root
=
@sample_project_path
.
dirname
@pods_project
=
Project
.
new
()
config
.
sandbox
.
project
=
@pods_project
@libraries
=
@podfile
.
target_definitions
.
values
.
map
do
|
target_definition
|
...
...
@@ -32,7 +32,7 @@ module Pod
lib
.
user_project
=
sample_project
lib
end
@integrator
=
Installer
::
UserProjectIntegrator
.
new
(
@podfile
,
config
.
sandbox
,
@
project
_root
,
@libraries
)
@integrator
=
Installer
::
UserProjectIntegrator
.
new
(
@podfile
,
config
.
sandbox
,
@
installation
_root
,
@libraries
)
end
it
"uses the path of the workspace defined in the podfile"
do
...
...
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