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
06008efa
Commit
06008efa
authored
Dec 18, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Installer|TargetInstaller] Move code.
parent
2caeb0b4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
24 deletions
+51
-24
installer.rb
lib/cocoapods/installer.rb
+2
-23
target_installer.rb
lib/cocoapods/installer/target_installer.rb
+24
-0
library.rb
lib/cocoapods/library.rb
+6
-0
target_installer_spec.rb
spec/unit/installer/target_installer_spec.rb
+19
-1
No files found.
lib/cocoapods/installer.rb
View file @
06008efa
...
...
@@ -445,33 +445,12 @@ module Pod
# Installs the targets of the Pods projects and generates their support
# files.
#
# @todo Move the acknowledgements to the target installer?
#
def
generate_target_support_files
UI
.
message
"- Installing targets"
do
target_installers
.
each
do
|
target_installer
|
target_installer
.
install!
acknowledgements_path
=
target_installer
.
library
.
acknowledgements_path
Generator
::
Acknowledgements
.
new
(
target_installer
.
library
.
target_definition
,
target_installer
.
library
.
local_pods
).
save_as
(
acknowledgements_path
)
generate_dummy_source
(
target_installer
)
end
end
end
# Generates a dummy source file for each target so libraries that contain
# only categories build.
#
# @todo Move to the target installer?
#
def
generate_dummy_source
(
target_installer
)
class_name_identifier
=
target_installer
.
library
.
label
dummy_source
=
Generator
::
DummySource
.
new
(
class_name_identifier
)
filename
=
"
#{
dummy_source
.
class_name
}
.m"
pathname
=
Pathname
.
new
(
sandbox
.
root
+
filename
)
dummy_source
.
save_as
(
pathname
)
file
=
pods_project
.
new_file
(
filename
,
"Targets Support Files"
)
target_installer
.
target
.
source_build_phase
.
add_file_reference
(
file
)
end
# Writes the Pods project to the disk.
...
...
@@ -479,8 +458,8 @@ module Pod
# @return [void]
#
def
write_pod_project
UI
.
message
"- Writing Xcode project file to
#{
UI
.
path
@
sandbox
.
project_path
}
"
do
pods_project
.
save_as
(
@
sandbox
.
project_path
)
UI
.
message
"- Writing Xcode project file to
#{
UI
.
path
sandbox
.
project_path
}
"
do
pods_project
.
save_as
(
sandbox
.
project_path
)
end
end
...
...
lib/cocoapods/installer/target_installer.rb
View file @
06008efa
...
...
@@ -28,6 +28,8 @@ module Pod
create_prefix_header
create_bridge_support_file
create_copy_resources_script
create_acknowledgements
create_dummy_source
end
#-----------------------------------------------------------------------#
...
...
@@ -198,6 +200,28 @@ module Pod
end
end
# Generates the acknowledgement files (markdown and plist) for the target.
#
# @return [void]
#
def
create_acknowledgements
path
=
library
.
acknowledgements_path
Generator
::
Acknowledgements
.
new
(
target_definition
,
pods
).
save_as
(
path
)
end
# Generates a dummy source file for each target so libraries that contain
# only categories build.
#
# @return [void]
#
def
create_dummy_source
path
=
library
.
dummy_source_path
Generator
::
DummySource
.
new
(
library
.
label
).
save_as
(
path
)
relative_path
=
path
.
relative_path_from
(
sandbox
.
root
)
file_reference
=
project
.
new_file
(
relative_path
,
"Targets Support Files"
)
target
.
source_build_phase
.
add_file_reference
(
file_reference
)
end
#-----------------------------------------------------------------------#
# @!group Private helpers.
...
...
lib/cocoapods/library.rb
View file @
06008efa
...
...
@@ -177,6 +177,12 @@ module Pod
support_files_root
+
"
#{
label
}
-Acknowledgements"
end
# @return [Pathname] the path of the dummy source generated by CocoaPods
#
def
dummy_source_path
support_files_root
+
"PodsDummy_
#{
label
}
.m"
end
#-------------------------------------------------------------------------#
# @!group Private Helpers
...
...
spec/unit/installer/target_installer_spec.rb
View file @
06008efa
...
...
@@ -123,7 +123,7 @@ module Pod
it
'adds the source files of each pod to the target of the Pod library'
do
@installer
.
install!
names
=
@installer
.
target
.
source_build_phase
.
files
.
map
{
|
bf
|
bf
.
file_ref
.
name
}
names
.
should
==
[
"Banana.m"
]
names
.
should
.
include
(
"Banana.m"
)
end
#--------------------------------------#
...
...
@@ -159,6 +159,24 @@ module Pod
script
=
config
.
sandbox
.
root
+
'Pods-resources.sh'
script
.
read
.
should
.
include?
(
'logo-sidebar.png'
)
end
it
"creates the acknowledgements files "
do
@installer
.
install!
markdown
=
config
.
sandbox
.
root
+
'Pods-Acknowledgements.markdown'
markdown
.
read
.
should
.
include?
(
'Permission is hereby granted'
)
plist
=
config
.
sandbox
.
root
+
'Pods-Acknowledgements.plist'
plist
.
read
.
should
.
include?
(
'Permission is hereby granted'
)
end
it
"creates a dummy source to ensure the compilation of libraries with only categories"
do
@installer
.
install!
build_files
=
@installer
.
target
.
source_build_phase
.
files
build_file
=
build_files
.
find
{
|
bf
|
bf
.
file_ref
.
name
==
'PodsDummy_Pods.m'
}
build_file
.
should
.
be
.
not
.
nil
build_file
.
file_ref
.
path
.
should
==
'PodsDummy_Pods.m'
dummy
=
config
.
sandbox
.
root
+
'PodsDummy_Pods.m'
dummy
.
read
.
should
.
include?
(
'@interface PodsDummy_Pods'
)
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