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
12b5bedc
Commit
12b5bedc
authored
Sep 10, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PodsProjectGenerator] Major improvements
parent
6d3c2c45
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
68 additions
and
30 deletions
+68
-30
pods_project_generator.rb
lib/cocoapods/installer/pods_project_generator.rb
+0
-0
target_installer.rb
...pods/installer/pods_project_generator/target_installer.rb
+0
-3
aggregate_target_installer.rb
..._generator/target_installer/aggregate_target_installer.rb
+1
-1
pod_target_installer.rb
...roject_generator/target_installer/pod_target_installer.rb
+0
-0
sandbox.rb
lib/cocoapods/sandbox.rb
+15
-0
target.rb
lib/cocoapods/target.rb
+4
-0
aggregate_target.rb
lib/cocoapods/target/aggregate_target.rb
+4
-0
pods_project_generator_spec.rb
spec/unit/installer/pods_project_generator_spec.rb
+30
-26
sandbox_spec.rb
spec/unit/sandbox_spec.rb
+14
-0
No files found.
lib/cocoapods/installer/pods_project_generator.rb
View file @
12b5bedc
This diff is collapsed.
Click to expand it.
lib/cocoapods/installer/pods_project_generator/target_installer.rb
View file @
12b5bedc
...
...
@@ -56,12 +56,9 @@ module Pod
@native_target
.
add_build_configuration
(
bc_name
,
type
)
end
target
.
target
=
@native_target
end
# @return [PBXNativeTarget] the target generated by the installation
# process.
#
...
...
lib/cocoapods/installer/pods_project_generator/target_installer/aggregate_target_installer.rb
View file @
12b5bedc
...
...
@@ -18,5 +18,5 @@ module Pod
end
end
end
end
end
end
lib/cocoapods/installer/pods_project_generator/target_installer/pod_target_installer.rb
View file @
12b5bedc
lib/cocoapods/sandbox.rb
View file @
12b5bedc
...
...
@@ -78,6 +78,21 @@ module Pod
Lockfile
.
from_file
(
manifest_path
)
if
manifest_path
.
exist?
end
# Returns whether the version of CocoaPods used to generate the sandbox is
# is major than the given version.
#
# @param [String]
#
# @return [Bool]
#
def
version_at_least?
(
version
)
if
manifest
manifest
.
cocoapods_version
>=
Version
.
new
(
version
)
else
false
end
end
# @return [Installer::Analyzer::SpecsState] The state of the sandbox
# (added, deleted, changed and unchanged pods) as computed by the
# analyzer.
...
...
lib/cocoapods/target.rb
View file @
12b5bedc
...
...
@@ -35,6 +35,10 @@ module Pod
label
.
upcase
.
gsub
(
/[^A-Z]/
,
'_'
)
+
'_'
end
def
skip_installation?
false
end
# @return [String] A string suitable for debugging.
#
def
inspect
...
...
lib/cocoapods/target/aggregate_target.rb
View file @
12b5bedc
...
...
@@ -15,6 +15,10 @@ module Pod
@file_accessors
=
[]
end
def
skip_installation?
target_definition
.
empty?
end
# @return [String] the label for the target.
#
def
label
...
...
spec/unit/installer/pods_project_generator_spec.rb
View file @
12b5bedc
...
...
@@ -4,6 +4,10 @@ module Pod
class
Installer
describe
PodsProjectGenerator
do
before
do
config
.
sandbox
.
stubs
(
:cocoapods_version
).
returns
(
Version
.
new
(
Pod
::
VERSION
))
end
#-----------------------------------------------------------------------#
describe
"In general"
do
...
...
@@ -167,7 +171,30 @@ module Pod
#-----------------------------------------------------------------------#
describe
"#sync_target_dependencies"
do
describe
"#add_missing_aggregate_targets_libraries"
do
before
do
project
=
Pod
::
Project
.
new
(
config
.
sandbox
.
project_path
)
@aggregate_native_target
=
project
.
new_target
(
:static_library
,
'Pods'
,
:ios
)
@pod_native_target
=
project
.
new_target
(
:static_library
,
'Pods-BananaLib'
,
:ios
)
pod_target
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
pod_target
.
target
=
@pod_native_target
aggregate_target
=
AggregateTarget
.
new
(
nil
,
config
.
sandbox
)
aggregate_target
.
pod_targets
=
[
pod_target
]
aggregate_target
.
target
=
@aggregate_native_target
@sut
=
PodsProjectGenerator
.
new
(
config
.
sandbox
,
[
aggregate_target
])
end
it
"links the aggregate targets to the pod targets"
do
@sut
.
send
(
:add_missing_aggregate_targets_libraries
)
@aggregate_native_target
.
frameworks_build_phase
.
files
.
map
(
&
:file_ref
).
should
.
include?
(
@pod_native_target
.
product_reference
)
end
end
#-----------------------------------------------------------------------#
describe
"#add_missing_target_dependencies"
do
before
do
project
=
Pod
::
Project
.
new
(
config
.
sandbox
.
project_path
)
...
...
@@ -188,14 +215,14 @@ module Pod
it
"sets the pod targets as dependencies of the aggregate target"
do
@sut
.
send
(
:
sync
_target_dependencies
)
@sut
.
send
(
:
add_missing
_target_dependencies
)
dependencies
=
@aggregate_target
.
target
.
dependencies
dependencies
.
map
{
|
d
|
d
.
target
.
name
}.
should
==
[
"Pods-BananaLib"
,
"Pods-monkey"
]
end
it
"sets the dependencies of the pod targets"
do
@pod_target_1
.
stubs
(
:dependencies
).
returns
([
'monkey'
])
@sut
.
send
(
:
sync
_target_dependencies
)
@sut
.
send
(
:
add_missing
_target_dependencies
)
dependencies
=
@pod_target_1
.
target
.
dependencies
dependencies
.
map
{
|
d
|
d
.
target
.
name
}.
should
==
[
"Pods-monkey"
]
end
...
...
@@ -204,29 +231,6 @@ module Pod
#-----------------------------------------------------------------------#
describe
"#sync_aggregate_targets_libraries"
do
before
do
project
=
Pod
::
Project
.
new
(
config
.
sandbox
.
project_path
)
@aggregate_native_target
=
project
.
new_target
(
:static_library
,
'Pods'
,
:ios
)
@pod_native_target
=
project
.
new_target
(
:static_library
,
'Pods-BananaLib'
,
:ios
)
pod_target
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
pod_target
.
target
=
@pod_native_target
aggregate_target
=
AggregateTarget
.
new
(
nil
,
config
.
sandbox
)
aggregate_target
.
pod_targets
=
[
pod_target
]
aggregate_target
.
target
=
@aggregate_native_target
@sut
=
PodsProjectGenerator
.
new
(
config
.
sandbox
,
[
aggregate_target
])
end
it
"links the aggregate targets to the pod targets"
do
@sut
.
send
(
:sync_aggregate_targets_libraries
)
@aggregate_native_target
.
frameworks_build_phase
.
files
.
map
(
&
:file_ref
).
should
.
include?
(
@pod_native_target
.
product_reference
)
end
end
#-----------------------------------------------------------------------#
end
end
end
spec/unit/sandbox_spec.rb
View file @
12b5bedc
...
...
@@ -19,6 +19,20 @@ module Pod
@sandbox
.
manifest
.
should
==
nil
end
describe
"#version_at_least?"
do
it
"returns whether the version of CocoaPods used to generate the sandbox is major to the given one"
do
manifest
=
stub
(
:cocoapods_version
=>
Version
.
new
(
'1.0'
))
@sandbox
.
stubs
(
:manifest
).
returns
(
manifest
)
@sandbox
.
version_at_least?
(
'1.0.0'
).
should
.
be
.
true
end
it
"returns false if the manifest is not available"
do
@sandbox
.
version_at_least?
(
'0.0.1'
).
should
.
be
.
false
end
end
it
"returns the project"
do
@sandbox
.
project
.
should
==
nil
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