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
66476792
Commit
66476792
authored
Oct 10, 2014
by
Imre Mihaly
Committed by
Kyle Fuller
Dec 24, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[installer] Group support added for Development Pods mirroring the folder structure
parent
8343cf2d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
6 deletions
+35
-6
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
+14
-1
project_spec.rb
spec/unit/project_spec.rb
+6
-0
No files found.
CHANGELOG.md
View file @
66476792
...
...
@@ -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 @
66476792
...
...
@@ -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] group_if_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
,
group_if_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
&&
group_if_development
)
end
end
end
...
...
lib/cocoapods/project.rb
View file @
66476792
...
...
@@ -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,25 @@ module Pod
# @param [PBXGroup] group
# The group for the new file reference.
#
# @param [Bool] development
# Wether the file is part of a development pod.
# If it is then groups will be created to reflect the code's structure in the filesystem.
#
# @return [PBXFileReference] The new file reference.
#
def
add_file_reference
(
absolute_path
,
group
)
def
add_file_reference
(
absolute_path
,
group
,
development
=
false
)
unless
Pathname
.
new
(
absolute_path
).
absolute?
raise
ArgumentError
,
"Paths must be absolute
#{
absolute_path
}
"
end
if
development
relative_path
=
Pathname
.
new
(
absolute_path
).
relative_path_from
(
group
.
real_path
).
dirname
relative_path
.
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 @
66476792
...
...
@@ -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