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
c7e9aa69
Commit
c7e9aa69
authored
Oct 08, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Project] Improve Pods project organization
Closes #1420
parent
307fe1d4
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
108 additions
and
112 deletions
+108
-112
CHANGELOG.md
CHANGELOG.md
+10
-1
Gemfile.lock
Gemfile.lock
+1
-1
installer.rb
lib/cocoapods/installer.rb
+1
-1
file_references_installer.rb
lib/cocoapods/installer/file_references_installer.rb
+5
-5
pod_target_installer.rb
...oapods/installer/target_installer/pod_target_installer.rb
+2
-10
project.rb
lib/cocoapods/project.rb
+33
-38
cocoapods-integration-specs
spec/cocoapods-integration-specs
+1
-1
file_references_installer_spec.rb
spec/unit/installer/file_references_installer_spec.rb
+12
-12
aggregate_target_installer_spec.rb
...aller/target_installer/aggregate_target_installer_spec.rb
+1
-1
pod_target_installer_spec.rb
...t/installer/target_installer/pod_target_installer_spec.rb
+1
-1
project_spec.rb
spec/unit/project_spec.rb
+41
-41
No files found.
CHANGELOG.md
View file @
c7e9aa69
...
...
@@ -21,9 +21,18 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[
Fabio Pelosin
](
https://github.com/irrationalfab
)
[
#1185
](
https://github.com/CocoaPods/CocoaPods/pull/1185
)
*
The Pods project now is sorted by name.
*
Further improvements to the organization of the Pods project
-
The project is now is sorted by name with groups at the bottom.
-
Source files are now stored in the root group of the spec, subspecs are not
stored in a
`Subspec`
group anymore and the products of the Pods all are
stored in the products group of the project.
-
The frameworks are referenced relative to the Developer directory and
namespaced per platform.
[
Fabio Pelosin
](
https://github.com/irrationalfab
)
[
#1389
](
https://github.com/CocoaPods/CocoaPods/pull/1389
)
[
#1420
](
https://github.com/CocoaPods/CocoaPods/pull/1420
)
*
Added the
`documentation_url`
DSL attribute to the specifications.
[
Fabio Pelosin
](
https://github.com/irrationalfab
)
...
...
Gemfile.lock
View file @
c7e9aa69
...
...
@@ -17,7 +17,7 @@ GIT
GIT
remote: https://github.com/CocoaPods/Xcodeproj.git
revision:
c1751f473d90f7dd03c0433c88b6178ec2f1308
0
revision:
5bee3d3b08e7f8de793e7bda3851ed5f4749640
0
branch: master
specs:
xcodeproj (0.11.1)
...
...
lib/cocoapods/installer.rb
View file @
c7e9aa69
...
...
@@ -399,7 +399,7 @@ module Pod
UI
.
message
"- Writing Xcode project file to
#{
UI
.
path
sandbox
.
project_path
}
"
do
pods_project
.
pods
.
remove_from_project
if
pods_project
.
pods
.
empty?
pods_project
.
development_pods
.
remove_from_project
if
pods_project
.
development_pods
.
empty?
pods_project
.
sort
pods_project
.
sort
({
:groups_position
=>
:below
})
pods_project
.
recreate_user_schemes
(
false
)
pods_project
.
save
end
...
...
lib/cocoapods/installer/file_references_installer.rb
View file @
c7e9aa69
...
...
@@ -69,7 +69,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
,
:source_files
)
add_file_accessors_paths_to_pods_group
(
:source_files
)
end
end
...
...
@@ -79,7 +79,7 @@ module Pod
#
def
add_frameworks_bundles
UI
.
message
"- Adding frameworks to Pods project"
do
add_file_accessors_paths_to_pods_group
(
:vendored_frameworks
,
:frameworks
_and_libraries
)
add_file_accessors_paths_to_pods_group
(
:vendored_frameworks
,
:frameworks
)
end
end
...
...
@@ -88,8 +88,8 @@ module Pod
# @return [void]
#
def
add_vendored_libraries
UI
.
message
"- Adding
framework
s to Pods project"
do
add_file_accessors_paths_to_pods_group
(
:vendored_libraries
,
:frameworks
_and_libraries
)
UI
.
message
"- Adding
librarie
s to Pods project"
do
add_file_accessors_paths_to_pods_group
(
:vendored_libraries
,
:frameworks
)
end
end
...
...
@@ -156,7 +156,7 @@ module Pod
#
# @return [void]
#
def
add_file_accessors_paths_to_pods_group
(
file_accessor_key
,
group_key
)
def
add_file_accessors_paths_to_pods_group
(
file_accessor_key
,
group_key
=
nil
)
file_accessors
.
each
do
|
file_accessor
|
paths
=
file_accessor
.
send
(
file_accessor_key
)
paths
.
each
do
|
path
|
...
...
lib/cocoapods/installer/target_installer/pod_target_installer.rb
View file @
c7e9aa69
...
...
@@ -13,7 +13,6 @@ module Pod
def
install!
UI
.
message
"- Installing target `
#{
library
.
name
}
`
#{
library
.
platform
}
"
do
add_target
move_target_product_file_reference
add_files_to_build_phases
add_resources_bundle_targets
# create_suport_files_group
...
...
@@ -48,12 +47,6 @@ module Pod
end
end
def
move_target_product_file_reference
pod_name
=
library
.
pod_name
group
=
project
.
group_for_spec
(
pod_name
,
:products
)
target
.
product_reference
.
move
(
group
)
end
# Adds the resources of the Pods to the Pods project.
#
# @note The source files are grouped by Pod and in turn by subspec
...
...
@@ -72,8 +65,7 @@ module Pod
end
file_references
=
paths
.
map
{
|
sf
|
project
.
reference_for_path
(
sf
)
}
group
=
project
.
group_for_spec
(
file_accessor
.
spec
.
name
,
:products
)
product_group
=
project
.
group_for_spec
(
file_accessor
.
spec
.
name
,
:resources
)
bundle_target
=
project
.
new_resources_bundle
(
bundle_name
,
file_accessor
.
spec_consumer
.
platform_name
,
product_group
)
bundle_target
=
project
.
new_resources_bundle
(
bundle_name
,
file_accessor
.
spec_consumer
.
platform_name
)
bundle_target
.
add_resources
(
file_references
)
library
.
user_build_configurations
.
each
do
|
bc_name
,
type
|
...
...
@@ -201,7 +193,7 @@ module Pod
#
def
add_file_to_support_group
(
path
)
pod_name
=
library
.
pod_name
group
=
project
.
group_for_spec
(
pod_name
,
:support_files
)
group
=
project
.
pod_support_files_group
(
pod_name
)
group
.
new_file
(
path
)
end
...
...
lib/cocoapods/project.rb
View file @
c7e9aa69
...
...
@@ -73,8 +73,6 @@ module Pod
parent_group
=
development
?
development_pods
:
pods
source_tree
=
absolute
?
:
absolute
:
:group
group
=
parent_group
.
new_group
(
pod_name
,
path
,
source_tree
)
support_files_group
=
group
.
new_group
(
SPEC_SUBGROUPS
[
:support_files
])
support_files_group
.
source_tree
=
'SOURCE_ROOT'
group
end
...
...
@@ -98,12 +96,8 @@ module Pod
# @return [Hash] The names of the specification subgroups by key.
#
SPEC_SUBGROUPS
=
{
:source_files
=>
'Source Files'
,
:resources
=>
'Resources'
,
:frameworks_and_libraries
=>
'Frameworks & Libraries'
,
:support_files
=>
'Support Files'
,
:subspecs
=>
'Subspecs'
,
:products
=>
'Products'
,
:resources
=>
'Resources'
,
:frameworks
=>
'Frameworks'
,
}
# Returns the group for the specification with the give name creating it if
...
...
@@ -112,22 +106,44 @@ module Pod
# @param [String] spec_name
# The full name of the specification.
#
# @param [Symbol] subgroup_key
# The optional key of the subgroup (@see #{SPEC_SUBGROUPS})
#
# @return [PBXGroup] The group.
#
def
group_for_spec
(
spec_name
,
subgroup_key
=
nil
)
spec_group
=
spec_group
(
spec_name
)
pod_name
=
Specification
.
root_name
(
spec_name
)
group
=
pod_group
(
pod_name
)
raise
"[Bug] Unable to locate group for Pod named `
#{
pod_name
}
`"
unless
group
if
spec_name
!=
pod_name
subspecs_names
=
spec_name
.
gsub
(
pod_name
+
'/'
,
''
).
split
(
'/'
)
subspecs_names
.
each
do
|
name
|
group
=
group
[
name
]
||
group
.
new_group
(
name
)
end
end
if
subgroup_key
subgroup
=
SPEC_SUBGROUPS
[
subgroup_key
]
raise
ArgumentError
,
"Unrecognized subgroup `
#{
subgroup_key
}
`"
unless
subgroup
spec_group
.
find_subpath
(
subgroup
,
true
)
else
spec_group
subgroup_name
=
SPEC_SUBGROUPS
[
subgroup_key
]
raise
ArgumentError
,
"Unrecognized subgroup key `
#{
subgroup_key
}
`"
unless
subgroup_name
group
=
group
[
subgroup_name
]
||
group
.
new_group
(
subgroup_name
)
end
group
end
# Returns the support files group for the Pod with the given name.
#
# @param [String] pod_name
# The name of the Pod.
#
# @return [PBXGroup] The group.
#
def
pod_support_files_group
(
pod_name
)
group
=
pod_group
(
pod_name
)
support_files_group
=
group
[
'Support Files'
]
unless
support_files_group
support_files_group
=
group
.
new_group
(
'Support Files'
)
support_files_group
.
source_tree
=
'SOURCE_ROOT'
end
support_files_group
end
public
...
...
@@ -198,27 +214,6 @@ module Pod
#
attr_reader
:refs_by_absolute_path
# Returns the group for the given specification creating it if needed.
#
# @param [String] spec_name
# The full name of the specification.
#
# @return [PBXGroup] The group for the spec with the given name.
#
def
spec_group
(
spec_name
)
pod_name
=
Specification
.
root_name
(
spec_name
)
group
=
pod_group
(
pod_name
)
raise
"[Bug] Unable to locate group for Pod named `
#{
pod_name
}
`"
unless
group
if
spec_name
!=
pod_name
subspecs_names
=
spec_name
.
gsub
(
pod_name
+
'/'
,
''
).
split
(
'/'
)
subspecs_names
.
each
do
|
name
|
subspecs_group
=
group
[
SPEC_SUBGROUPS
[
:subspecs
]]
||
group
.
new_group
(
SPEC_SUBGROUPS
[
:subspecs
])
group
=
subspecs_group
[
name
]
||
subspecs_group
.
new_group
(
name
)
end
end
group
end
#-------------------------------------------------------------------------#
end
...
...
cocoapods-integration-specs
@
20adb550
Subproject commit
35509baa098c3d210438ca9ff412b1377eb5f994
Subproject commit
20adb5503dd764616d2ef23174e2578864b2a317
spec/unit/installer/file_references_installer_spec.rb
View file @
c7e9aa69
...
...
@@ -24,17 +24,23 @@ module Pod
it
"adds the files references of the source files the Pods project"
do
@installer
.
install!
file_ref
=
@installer
.
pods_project
[
'Pods/BananaLib/
Source Files/
Banana.m'
]
file_ref
=
@installer
.
pods_project
[
'Pods/BananaLib/Banana.m'
]
file_ref
.
should
.
be
.
not
.
nil
file_ref
.
path
.
should
==
"Classes/Banana.m"
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!
file_ref
=
@installer
.
pods_project
[
'Pods/BananaLib/Frameworks/Bananalib.framework'
]
file_ref
.
should
.
be
.
not
.
nil
file_ref
.
path
.
should
==
"Bananalib.framework"
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!
file_ref
=
@installer
.
pods_project
[
'Pods/BananaLib/Frameworks/libBananalib.a'
]
file_ref
.
should
.
be
.
not
.
nil
file_ref
.
path
.
should
==
"libBananalib.a"
end
it
"adds the files references of the resources the Pods project"
do
...
...
@@ -87,13 +93,7 @@ module Pod
end
end
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
end
end
describe
"#add_file_accessors_paths_to_pods_group"
do
describe
"#header_mappings"
do
it
"returns the header mappings"
do
headers_sandbox
=
Pathname
.
new
(
'BananaLib'
)
headers
=
[
Pathname
.
new
(
'BananaLib/Banana.h'
)]
...
...
spec/unit/installer/target_installer/aggregate_target_installer_spec.rb
View file @
c7e9aa69
...
...
@@ -16,7 +16,7 @@ module Pod
@spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
@project
.
add_pod_group
(
'BananaLib'
,
fixture
(
'banana-lib'
))
group
=
@project
.
group_for_spec
(
'BananaLib'
,
:source_files
)
group
=
@project
.
group_for_spec
(
'BananaLib'
)
file_accessor
.
source_files
.
each
do
|
file
|
@project
.
add_file_reference
(
file
,
group
)
end
...
...
spec/unit/installer/target_installer/pod_target_installer_spec.rb
View file @
c7e9aa69
...
...
@@ -16,7 +16,7 @@ module Pod
@spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
@project
.
add_pod_group
(
'BananaLib'
,
fixture
(
'banana-lib'
))
group
=
@project
.
group_for_spec
(
'BananaLib'
,
:source_files
)
group
=
@project
.
group_for_spec
(
'BananaLib'
)
file_accessor
.
source_files
.
each
do
|
file
|
@project
.
add_file_reference
(
file
,
group
)
end
...
...
spec/unit/project_spec.rb
View file @
c7e9aa69
...
...
@@ -70,11 +70,6 @@ module Pod
Pathname
.
new
(
group
.
path
).
should
.
be
.
absolute
end
it
"creates a support file group relative to the project"
do
group
=
@project
.
add_pod_group
(
'BananaLib'
,
@path
,
false
,
true
)
group
[
'Support Files'
].
source_tree
.
should
==
'SOURCE_ROOT'
group
[
'Support Files'
].
path
.
should
.
be
.
nil
end
end
#----------------------------------------#
...
...
@@ -114,25 +109,53 @@ module Pod
it
"returns the group for the spec with the given name"
do
group
=
@project
.
group_for_spec
(
'BananaLib/Tree'
)
group
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Subspecs/Tree'
group
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Tree'
end
it
"doesn't duplicate the groups"
do
group_1
=
@project
.
group_for_spec
(
'BananaLib/Tree'
)
group_2
=
@project
.
group_for_spec
(
'BananaLib/Tree'
)
group_1
.
uuid
.
should
==
group_2
.
uuid
end
it
"returns the subgroup with the given key"
do
group
=
@project
.
group_for_spec
(
'BananaLib/Tree'
,
:resources
)
group
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Tree/Resources'
end
it
"returns the requested subgroup"
do
group
=
@project
.
group_for_spec
(
'BananaLib/Tree'
,
:source_files
)
group
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Subspecs/Tree/Source Files'
it
"doesn't duplicates subgroups"
do
group_1
=
@project
.
group_for_spec
(
'BananaLib/Tree'
,
:resources
)
group_2
=
@project
.
group_for_spec
(
'BananaLib/Tree'
,
:resources
)
group_1
.
uuid
.
should
==
group_2
.
uuid
end
it
"raises if
unable to recognize the subgroup key
"
do
it
"raises if
the subgroup key is unrecognized
"
do
should
.
raise
ArgumentError
do
@project
.
group_for_spec
(
'BananaLib/Tree'
,
:unknown
)
end
.
message
.
should
.
match
/Unrecognized subgroup/
@project
.
group_for_spec
(
'BananaLib/Tree'
,
:bananaland
)
end
.
message
.
should
.
match
/Unrecognized.*key/
end
end
#----------------------------------------#
describe
"#pod_support_files_group"
do
before
do
@project
.
add_pod_group
(
'BananaLib'
,
@path
,
false
,
true
)
end
it
"creates a support file group relative to the project"
do
group
=
@project
.
pod_support_files_group
(
'BananaLib'
)
group
.
source_tree
.
should
==
'SOURCE_ROOT'
group
.
path
.
should
.
be
.
nil
end
it
"doesn't duplicate the groups"
do
group_1
=
@project
.
group_for_spec
(
'BananaLib/Tree'
,
:source_files
)
group_2
=
@project
.
group_for_spec
(
'BananaLib/Tree'
,
:source_files
)
group_1
=
@project
.
pod_support_files_group
(
'BananaLib'
)
group_2
=
@project
.
pod_support_files_group
(
'BananaLib'
)
group_1
.
uuid
.
should
==
group_2
.
uuid
end
end
end
...
...
@@ -145,12 +168,12 @@ module Pod
before
do
@project
.
add_pod_group
(
'BananaLib'
,
config
.
sandbox
.
pod_dir
(
'BananaLib'
),
false
)
@file
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
+
"file.m"
@group
=
@project
.
group_for_spec
(
'BananaLib'
,
:source_files
)
@group
=
@project
.
group_for_spec
(
'BananaLib'
)
end
it
"adds a file references to the given file"
do
ref
=
@project
.
add_file_reference
(
@file
,
@group
)
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/
Source Files/
file.m'
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/file.m'
end
it
"it doesn't duplicate file references for a single path"
do
...
...
@@ -175,13 +198,13 @@ module Pod
before
do
@project
.
add_pod_group
(
'BananaLib'
,
config
.
sandbox
.
pod_dir
(
'BananaLib'
),
false
)
@file
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
+
"file.m"
@group
=
@project
.
group_for_spec
(
'BananaLib'
,
:source_files
)
@group
=
@project
.
group_for_spec
(
'BananaLib'
)
@project
.
add_file_reference
(
@file
,
@group
)
end
it
"returns the reference for the given path"
do
ref
=
@project
.
reference_for_path
(
@file
)
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/
Source Files/
file.m'
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/file.m'
end
it
"returns nil if no reference for the given path is available"
do
...
...
@@ -212,29 +235,6 @@ module Pod
#-------------------------------------------------------------------------#
describe
"Private helpers"
do
describe
"#spec_group"
do
before
do
@project
.
add_pod_group
(
'JSONKit'
,
config
.
sandbox
.
pod_dir
(
'JSONKit'
))
end
it
"returns the Pod group for root specifications"
do
group
=
@project
.
send
(
:spec_group
,
'JSONKit'
)
group
.
hierarchy_path
.
should
==
'/Pods/JSONKit'
end
it
"returns the group for subspecs"
do
group
=
@project
.
send
(
:spec_group
,
'JSONKit/Parsing'
)
group
.
hierarchy_path
.
should
==
'/Pods/JSONKit/Subspecs/Parsing'
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