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
44e3dab4
Commit
44e3dab4
authored
Dec 24, 2014
by
Kyle Fuller
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue/2145'
parents
8343cf2d
4a550710
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
7 deletions
+39
-7
CHANGELOG.md
CHANGELOG.md
+4
-0
file_references_installer.rb
lib/cocoapods/installer/file_references_installer.rb
+11
-5
project.rb
lib/cocoapods/project.rb
+18
-2
project_spec.rb
spec/unit/project_spec.rb
+6
-0
No files found.
CHANGELOG.md
View file @
44e3dab4
...
...
@@ -37,6 +37,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Samuel Giddins
](
https://github.com/segiddins
)
[
#2914
](
https://github.com/CocoaPods/CocoaPods/issues/2914
)
*
Installer changed to organize a development pod's source and resource files
into subgroups reflecting their organization in the filesystem.
[
Imre mihaly
](
https://github.com/imihaly
)
##### Bug Fixes
*
Fix updating a pod that has subspec dependencies.
...
...
lib/cocoapods/installer/file_references_installer.rb
View file @
44e3dab4
...
...
@@ -67,7 +67,7 @@ module Pod
#
def
add_source_files_references
UI
.
message
'- Adding source files to Pods project'
do
add_file_accessors_paths_to_pods_group
(
:source_files
)
add_file_accessors_paths_to_pods_group
(
:source_files
,
nil
,
true
)
end
end
...
...
@@ -100,8 +100,8 @@ module Pod
#
def
add_resources
UI
.
message
'- Adding resources to Pods project'
do
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
(
:resources
,
:resources
,
true
)
add_file_accessors_paths_to_pods_group
(
:resource_bundle_files
,
:resources
,
true
)
end
end
...
...
@@ -152,14 +152,20 @@ module Pod
# @param [Symbol] group_key
# The key of the group of the Pods project.
#
# @param [Bool] reflect_file_system_structure_for_development
# Wether organizing the a local pod's files in subgroups inside
# the pod's group is allowed.
#
# @return [void]
#
def
add_file_accessors_paths_to_pods_group
(
file_accessor_key
,
group_key
=
nil
)
def
add_file_accessors_paths_to_pods_group
(
file_accessor_key
,
group_key
=
nil
,
reflect_file_system_structure_for_development
=
false
)
file_accessors
.
each
do
|
file_accessor
|
pod_name
=
file_accessor
.
spec
.
name
local
=
sandbox
.
local?
(
pod_name
)
paths
=
file_accessor
.
send
(
file_accessor_key
)
paths
.
each
do
|
path
|
group
=
pods_project
.
group_for_spec
(
file_accessor
.
spec
.
name
,
group_key
)
pods_project
.
add_file_reference
(
path
,
group
)
pods_project
.
add_file_reference
(
path
,
group
,
local
&&
reflect_file_system_structure_for_development
)
end
end
end
...
...
lib/cocoapods/project.rb
View file @
44e3dab4
...
...
@@ -59,6 +59,7 @@ module Pod
parent_group
=
development
?
development_pods
:
pods
source_tree
=
absolute
?
:
absolute
:
:group
group
=
parent_group
.
new_group
(
pod_name
,
path
,
source_tree
)
group
end
...
...
@@ -144,13 +145,28 @@ module Pod
# @param [PBXGroup] group
# The group for the new file reference.
#
# @param [Bool] reflect_file_system_structure
# Wether group structure should reflect the file system structure.
# If yes, where needed, intermediate groups are created, similar to
# how mkdir -p operates.
#
# @return [PBXFileReference] The new file reference.
#
def
add_file_reference
(
absolute_path
,
group
)
unless
Pathname
.
new
(
absolute_path
).
absolute?
def
add_file_reference
(
absolute_path
,
group
,
reflect_file_system_structure
=
false
)
file_path_name
=
Pathname
.
new
(
absolute_path
)
unless
file_path_name
.
absolute?
raise
ArgumentError
,
"Paths must be absolute
#{
absolute_path
}
"
end
if
reflect_file_system_structure
relative_path
=
file_path_name
.
relative_path_from
(
group
.
real_path
)
relative_dir
=
relative_path
.
dirname
relative_dir
.
each_filename
do
|
name
|
next
if
name
==
'.'
group
=
group
[
name
]
||
group
.
new_group
(
name
,
name
)
end
end
if
ref
=
reference_for_path
(
absolute_path
)
ref
else
...
...
spec/unit/project_spec.rb
View file @
44e3dab4
...
...
@@ -161,6 +161,7 @@ module Pod
before
do
@project
.
add_pod_group
(
'BananaLib'
,
config
.
sandbox
.
pod_dir
(
'BananaLib'
),
false
)
@file
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
+
'file.m'
@nested_file
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
+
'Dir/SubDir/nested_file.m'
@group
=
@project
.
group_for_spec
(
'BananaLib'
)
end
...
...
@@ -169,6 +170,11 @@ module Pod
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/file.m'
end
it
"adds subgroups for a file reference if requested"
do
ref
=
@project
.
add_file_reference
(
@nested_file
,
@group
,
true
)
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Dir/SubDir/nested_file.m'
end
it
"it doesn't duplicate file references for a single path"
do
ref_1
=
@project
.
add_file_reference
(
@file
,
@group
)
ref_2
=
@project
.
add_file_reference
(
@file
,
@group
)
...
...
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