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
bbcbb05c
Commit
bbcbb05c
authored
Sep 06, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FileReferencesInstaller] clean-up
parent
f6df6216
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
25 deletions
+38
-25
file_references_installer.rb
...aller/pods_project_generator/file_references_installer.rb
+14
-13
file_references_installer_spec.rb
.../pods_project_generator/file_references_installer_spec.rb
+24
-12
No files found.
lib/cocoapods/installer/pods_project_generator/file_references_installer.rb
View file @
bbcbb05c
...
@@ -13,20 +13,15 @@ module Pod
...
@@ -13,20 +13,15 @@ module Pod
# @return [Array<Library>] The libraries of the installation.
# @return [Array<Library>] The libraries of the installation.
#
#
attr_reader
:libraries
attr_reader
:pod_targets
# @return [Project] The Pods project.
#
attr_reader
:pods_project
# @param [Sandbox] sandbox @see sandbox
# @param [Sandbox] sandbox @see sandbox
# @param [Array<Library>] libraries @see libraries
# @param [Array<Library>] libraries @see libraries
# @param [Project] libraries @see libraries
# @param [Project] libraries @see libraries
#
#
def
initialize
(
sandbox
,
libraries
,
pods_project
)
def
initialize
(
sandbox
,
pod_targets
)
@sandbox
=
sandbox
@sandbox
=
sandbox
@libraries
=
libraries
@pod_targets
=
pod_targets
@pods_project
=
pods_project
end
end
# Installs the file references.
# Installs the file references.
...
@@ -68,7 +63,7 @@ module Pod
...
@@ -68,7 +63,7 @@ module Pod
# @return [void]
# @return [void]
#
#
def
add_source_files_references
def
add_source_files_references
UI
.
message
"- Adding source files
to Pods project
"
do
UI
.
message
"- Adding source files"
do
add_file_accessors_paths_to_pods_group
(
:source_files
,
:source_files
)
add_file_accessors_paths_to_pods_group
(
:source_files
,
:source_files
)
end
end
end
end
...
@@ -78,7 +73,7 @@ module Pod
...
@@ -78,7 +73,7 @@ module Pod
# @return [void]
# @return [void]
#
#
def
add_frameworks_bundles
def
add_frameworks_bundles
UI
.
message
"- Adding frameworks
to Pods project
"
do
UI
.
message
"- Adding frameworks"
do
add_file_accessors_paths_to_pods_group
(
:vendored_frameworks
,
:frameworks_and_libraries
)
add_file_accessors_paths_to_pods_group
(
:vendored_frameworks
,
:frameworks_and_libraries
)
end
end
end
end
...
@@ -88,7 +83,7 @@ module Pod
...
@@ -88,7 +83,7 @@ module Pod
# @return [void]
# @return [void]
#
#
def
add_vendored_libraries
def
add_vendored_libraries
UI
.
message
"- Adding
frameworks to Pods project
"
do
UI
.
message
"- Adding
libraries
"
do
add_file_accessors_paths_to_pods_group
(
:vendored_libraries
,
:frameworks_and_libraries
)
add_file_accessors_paths_to_pods_group
(
:vendored_libraries
,
:frameworks_and_libraries
)
end
end
end
end
...
@@ -101,7 +96,7 @@ module Pod
...
@@ -101,7 +96,7 @@ module Pod
# @return [void]
# @return [void]
#
#
def
add_resources
def
add_resources
UI
.
message
"- Adding resources
to Pods project
"
do
UI
.
message
"- Adding resources"
do
add_file_accessors_paths_to_pods_group
(
:resources
,
:resources
)
add_file_accessors_paths_to_pods_group
(
:resources
,
:resources
)
add_file_accessors_paths_to_pods_group
(
:resource_bundle_files
,
:resources
)
add_file_accessors_paths_to_pods_group
(
:resource_bundle_files
,
:resources
)
end
end
...
@@ -114,11 +109,17 @@ module Pod
...
@@ -114,11 +109,17 @@ module Pod
# @!group Private Helpers
# @!group Private Helpers
# TODO
#
def
pods_project
sandbox
.
project
end
# @return [Array<Sandbox::FileAccessor>] The file accessors for all the
# @return [Array<Sandbox::FileAccessor>] The file accessors for all the
# specs platform combinations.
# specs platform combinations.
#
#
def
file_accessors
def
file_accessors
@file_accessors
||=
librarie
s
.
map
(
&
:file_accessors
).
flatten
.
compact
@file_accessors
||=
pod_target
s
.
map
(
&
:file_accessors
).
flatten
.
compact
end
end
# Adds file references to the list of the paths returned by the file
# Adds file references to the list of the paths returned by the file
...
...
spec/unit/installer/pods_project_generator/file_references_installer_spec.rb
View file @
bbcbb05c
...
@@ -7,9 +7,9 @@ module Pod
...
@@ -7,9 +7,9 @@ module Pod
@file_accessor
=
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)
@file_accessor
=
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)
@pod_target
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
@pod_target
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
@pod_target
.
file_accessors
=
[
@file_accessor
]
@pod_target
.
file_accessors
=
[
@file_accessor
]
@
project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
config
.
sandbox
.
project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
@
project
.
add_pod_group
(
'BananaLib'
,
fixture
(
'banana-lib'
))
config
.
sandbox
.
project
.
add_pod_group
(
'BananaLib'
,
fixture
(
'banana-lib'
))
@installer
=
Installer
::
PodsProjectGenerator
::
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
@pod_target
]
,
@project
)
@installer
=
Installer
::
PodsProjectGenerator
::
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
@pod_target
])
end
end
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
...
@@ -24,22 +24,30 @@ module Pod
...
@@ -24,22 +24,30 @@ module Pod
it
"adds the files references of the source files the Pods project"
do
it
"adds the files references of the source files the Pods project"
do
@installer
.
install!
@installer
.
install!
file_ref
=
@installer
.
pods_
project
[
'Pods/BananaLib/Source Files/Banana.m'
]
file_ref
=
config
.
sandbox
.
project
[
'Pods/BananaLib/Source Files/Banana.m'
]
file_ref
.
should
.
be
.
not
.
nil
file_ref
.
should
.
be
.
not
.
nil
file_ref
.
path
.
should
==
"Classes/Banana.m"
file_ref
.
path
.
should
==
"Classes/Banana.m"
end
end
xit
"adds the file references of the frameworks of the projet"
do
it
"adds the file references of the frameworks of the project"
do
@installer
.
install!
group
=
config
.
sandbox
.
project
.
group_for_spec
(
'BananaLib'
,
:frameworks_and_libraries
)
file_ref
=
group
[
'Bananalib.framework'
]
file_ref
.
should
.
be
.
not
.
nil
file_ref
.
path
.
should
==
"Bananalib.framework"
end
end
xit
"adds the file references of the libraries of the project"
do
it
"adds the file references of the libraries of the project"
do
@installer
.
install!
group
=
config
.
sandbox
.
project
.
group_for_spec
(
'BananaLib'
,
:frameworks_and_libraries
)
file_ref
=
group
[
'libBananalib.a'
]
file_ref
.
should
.
be
.
not
.
nil
file_ref
.
path
.
should
==
"libBananalib.a"
end
end
it
"adds the files references of the resources the Pods project"
do
it
"adds the files references of the resources the Pods project"
do
@installer
.
install!
@installer
.
install!
file_ref
=
@installer
.
pods_
project
[
'Pods/BananaLib/Resources/logo-sidebar.png'
]
file_ref
=
config
.
sandbox
.
project
[
'Pods/BananaLib/Resources/logo-sidebar.png'
]
file_ref
.
should
.
be
.
not
.
nil
file_ref
.
should
.
be
.
not
.
nil
file_ref
.
path
.
should
==
"Resources/logo-sidebar.png"
file_ref
.
path
.
should
==
"Resources/logo-sidebar.png"
end
end
...
@@ -56,7 +64,7 @@ module Pod
...
@@ -56,7 +64,7 @@ module Pod
pod_target_1
.
file_accessors
=
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)]
pod_target_1
.
file_accessors
=
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)]
pod_target_2
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
pod_target_2
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
pod_target_2
.
file_accessors
=
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)]
pod_target_2
.
file_accessors
=
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)]
installer
=
Installer
::
PodsProjectGenerator
::
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
pod_target_1
,
pod_target_2
]
,
@project
)
installer
=
Installer
::
PodsProjectGenerator
::
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
pod_target_1
,
pod_target_2
])
roots
=
installer
.
send
(
:file_accessors
).
map
{
|
fa
|
fa
.
path_list
.
root
}
roots
=
installer
.
send
(
:file_accessors
).
map
{
|
fa
|
fa
.
path_list
.
root
}
roots
.
should
==
[
fixture
(
'banana-lib'
),
fixture
(
'banana-lib'
)]
roots
.
should
==
[
fixture
(
'banana-lib'
),
fixture
(
'banana-lib'
)]
end
end
...
@@ -64,15 +72,19 @@ module Pod
...
@@ -64,15 +72,19 @@ module Pod
it
"handles libraries empty libraries without file accessors"
do
it
"handles libraries empty libraries without file accessors"
do
pod_target_1
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
pod_target_1
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
pod_target_1
.
file_accessors
=
[]
pod_target_1
.
file_accessors
=
[]
installer
=
Installer
::
PodsProjectGenerator
::
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
pod_target_1
]
,
@project
)
installer
=
Installer
::
PodsProjectGenerator
::
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
pod_target_1
])
roots
=
installer
.
send
(
:file_accessors
).
should
==
[]
roots
=
installer
.
send
(
:file_accessors
).
should
==
[]
end
end
end
end
describe
"#add_file_accessors_paths_to_pods_group"
do
describe
"#add_file_accessors_paths_to_pods_group"
do
xit
"adds the paths of the paths of the file accessor corresponding to the given key to the Pods project"
do
it
"adds the paths of the paths of the file accessor corresponding to the given key to the Pods project"
do
@installer
.
send
(
:add_file_accessors_paths_to_pods_group
,
:source_files
,
:source_files
)
group
=
config
.
sandbox
.
project
.
group_for_spec
(
'BananaLib'
,
:source_files
)
group
.
children
.
map
(
&
:name
).
sort
.
should
==
[
"Banana.h"
,
"Banana.m"
,
"BananaPrivate.h"
]
end
end
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