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
cca8cdfb
Commit
cca8cdfb
authored
Sep 11, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stash work on project creation.
parent
edd18888
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
154 additions
and
57 deletions
+154
-57
specification.rb
lib/cocoa_pods/specification.rb
+8
-3
xcode_project.rb
lib/cocoa_pods/xcode_project.rb
+84
-6
project.pbxproj
...cocoa-touch-static-library/Pods.xcodeproj/project.pbxproj
+55
-48
Pods-Prefix.pch
...templates/cocoa-touch-static-library/Pods/Pods-Prefix.pch
+7
-0
Pods.h
...-project-templates/cocoa-touch-static-library/Pods/Pods.h
+0
-0
Pods.m
...-project-templates/cocoa-touch-static-library/Pods/Pods.m
+0
-0
No files found.
lib/cocoa_pods/specification.rb
View file @
cca8cdfb
...
...
@@ -122,13 +122,18 @@ module Pod
spec
=
set
.
podspec
spec
.
read
(
:source_files
).
each
do
|
pattern
|
pattern
=
spec
.
pod_destroot
+
pattern
pattern
=
pattern
+
'*.{m,mm,c,cpp}'
if
pattern
.
directory?
source_files
.
concat
(
Dir
.
glob
(
pattern
.
to_s
))
pattern
=
pattern
+
'*.{
h,
m,mm,c,cpp}'
if
pattern
.
directory?
source_files
.
concat
(
Dir
.
glob
(
pattern
.
to_s
)
.
map
{
|
f
|
Pathname
.
new
(
f
)
}
)
end
end
project
=
XcodeProject
.
static_library
project
.
source_files
=
source_files
source_files
.
each
do
|
file
|
file
=
file
.
relative_path_from
(
config
.
project_pods_root
)
project
.
add_source_file
(
file
)
end
#project.pretty_print
project
.
create_at
(
config
.
project_pods_root
+
'Pods.xcodeproj'
)
end
include
Config
::
Mixin
...
...
lib/cocoa_pods/xcode_project.rb
View file @
cca8cdfb
...
...
@@ -6,17 +6,95 @@ module Pod
# TODO see if we really need different templates for iOS and OS X
def
self
.
static_library
new
TEMPLATES_DIR
+
'cocoa-touch-static-library.pbxproj'
new
TEMPLATES_DIR
+
'cocoa-touch-static-library
/Pods.xcodeproj/project
.pbxproj'
end
def
initialize
(
template
)
@template
=
NSDictionary
.
dictionaryWithContentsOfFile
(
template
.
to_s
)
p
@template
@template
=
NS
Mutable
Dictionary
.
dictionaryWithContentsOfFile
(
template
.
to_s
)
#pretty_print
end
def
source_files
=
(
files
)
@source_files
=
files
@load_paths
=
files
.
map
{
|
file
|
File
.
dirname
(
file
)
}.
uniq
def
add_source_file
(
file
)
file_ref_uuid
=
generate_uuid
objects
[
file_ref_uuid
]
=
{
"name"
=>
file
.
basename
.
to_s
,
"isa"
=>
"PBXFileReference"
,
"sourceTree"
=>
"SOURCE_ROOT"
,
"path"
=>
file
.
to_s
,
}
add_file_to_files_group
(
file_ref_uuid
)
if
file
.
extname
==
'.h'
add_header
(
file
,
file_ref_uuid
)
else
build_file_uuid
=
generate_uuid
objects
[
build_file_uuid
]
=
{
"isa"
=>
"PBXBuildFile"
,
"fileRef"
=>
file_ref_uuid
}
add_file_to_list
(
'PBXSourcesBuildPhase'
,
build_file_uuid
)
end
end
def
add_header
(
file
,
file_ref_uuid
)
build_file_uuid
=
generate_uuid
objects
[
build_file_uuid
]
=
{
"isa"
=>
"PBXBuildFile"
,
"fileRef"
=>
file_ref_uuid
,
"settings"
=>
{
"ATTRIBUTES"
=>
[
"Public"
]
}
}
add_file_to_list
(
'PBXHeadersBuildPhase'
,
build_file_uuid
)
end
def
to_hash
@template
end
def
create_at
(
xcodeproj
)
xcodeproj
.
mkpath
pbxproj
=
xcodeproj
+
'project.pbxproj'
@template
.
writeToFile
(
pbxproj
.
to_s
,
atomically
:true
)
end
private
def
add_file_to_list
(
isa
,
build_file_uuid
)
object_uuid
,
object
=
object_by_isa
(
isa
)
#object['files'] ||= []
object
[
'files'
]
<<
build_file_uuid
objects
[
object_uuid
]
=
object
end
def
add_file_to_files_group
(
file_ref_uuid
)
object_uuid
,
object
=
objects
.
find
do
|
_
,
object
|
object
[
'isa'
]
==
'PBXGroup'
&&
object
[
'name'
]
==
'Files'
end
#object['children'] ||= []
object
[
'children'
]
<<
file_ref_uuid
objects
[
object_uuid
]
=
object
end
def
objects
@template
[
'objects'
]
end
def
object_by_isa
(
isa
)
objects
.
find
{
|
_
,
object
|
object
[
'isa'
]
==
isa
}
end
def
generate_uuid
_uuid
=
CFUUIDCreate
(
nil
)
uuid
=
CFUUIDCreateString
(
nil
,
_uuid
)
CFRelease
(
_uuid
)
CFMakeCollectable
(
uuid
)
# Xcode's version is actually shorter, not worrying about collisions too much right now.
uuid
.
gsub
(
'-'
,
''
)[
0
..
23
]
end
public
def
pretty_print
puts
`ruby -r pp -e 'pp(
#{
@template
.
inspect
}
)'`
end
end
end
xcode-project-templates/cocoa-touch-static-library/Pods.xcodeproj/project.pbxproj
View file @
cca8cdfb
...
...
@@ -7,85 +7,93 @@
objects
=
{
/* Begin PBXBuildFile section */
515B0F8E141D3E3A001DC3E6
/* Foundation.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
515B0F8D141D3E3A001DC3E6
/* Foundation.framework */
;
};
515B0FA1141D3FB7001DC3E6
/* Pods.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
515B0F9F141D3FB7001DC3E6
/* Pods.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
515B0FA2141D3FB7001DC3E6
/* Pods.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
515B0FA0141D3FB7001DC3E6
/* Pods.m */
;
};
515B0FB9141D52E0001DC3E6
/* Foundation.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
515B0FB8141D52E0001DC3E6
/* Foundation.framework */
;
};
515B0FBF141D52E0001DC3E6
/* Pods.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
515B0FBE141D52E0001DC3E6
/* Pods.m */
;
};
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
515B0F8A141D3E3A001DC3E6
/* libPods.a */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
archive.ar
;
includeInIndex
=
0
;
path
=
libPods.a
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
515B0F8D141D3E3A001DC3E6
/* Foundation.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
Foundation.framework
;
path
=
System/Library/Frameworks/Foundation.framework
;
sourceTree
=
SDKROOT
;
};
515B0F9F141D3FB7001DC3E6
/* Pods.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
name
=
Pods.h
;
path
=
nested/files/Pods.h
;
sourceTree
=
SOURCE_ROOT
;
};
515B0FA0141D3FB7001DC3E6
/* Pods.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
name
=
Pods.m
;
path
=
nested/files/Pods.m
;
sourceTree
=
SOURCE_ROOT
;
};
515B0FB5141D52E0001DC3E6
/* libPods.a */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
archive.ar
;
includeInIndex
=
0
;
path
=
libPods.a
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
515B0FB8141D52E0001DC3E6
/* Foundation.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
Foundation.framework
;
path
=
System/Library/Frameworks/Foundation.framework
;
sourceTree
=
SDKROOT
;
};
515B0FBC141D52E0001DC3E6
/* Pods-Prefix.pch */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
"Pods-Prefix.pch"
;
sourceTree
=
"<group>"
;
};
515B0FBD141D52E0001DC3E6
/* Pods.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
Pods.h
;
sourceTree
=
"<group>"
;
};
515B0FBE141D52E0001DC3E6
/* Pods.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
Pods.m
;
sourceTree
=
"<group>"
;
};
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
515B0F
87141D3E3A
001DC3E6
/* Frameworks */
=
{
515B0F
B2141D52E0
001DC3E6
/* Frameworks */
=
{
isa
=
PBXFrameworksBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
515B0F
8E141D3E3A
001DC3E6
/* Foundation.framework in Frameworks */
,
515B0F
B9141D52E0
001DC3E6
/* Foundation.framework in Frameworks */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
515B0F
7F141D3E3A
001DC3E6
=
{
515B0F
AA141D52E0
001DC3E6
=
{
isa
=
PBXGroup
;
children
=
(
515B0F
9E141D3FA0001DC3E6
/* File
s */
,
515B0F
8C141D3E3A
001DC3E6
/* Frameworks */
,
515B0F
8B141D3E3A
001DC3E6
/* Products */
,
515B0F
BA141D52E0001DC3E6
/* Pod
s */
,
515B0F
B7141D52E0
001DC3E6
/* Frameworks */
,
515B0F
B6141D52E0
001DC3E6
/* Products */
,
);
sourceTree
=
"<group>"
;
};
515B0F
8B141D3E3A
001DC3E6
/* Products */
=
{
515B0F
B6141D52E0
001DC3E6
/* Products */
=
{
isa
=
PBXGroup
;
children
=
(
515B0F
8A141D3E3A
001DC3E6
/* libPods.a */
,
515B0F
B5141D52E0
001DC3E6
/* libPods.a */
,
);
name
=
Products
;
sourceTree
=
"<group>"
;
};
515B0F
8C141D3E3A
001DC3E6
/* Frameworks */
=
{
515B0F
B7141D52E0
001DC3E6
/* Frameworks */
=
{
isa
=
PBXGroup
;
children
=
(
515B0F
8D141D3E3A
001DC3E6
/* Foundation.framework */
,
515B0F
B8141D52E0
001DC3E6
/* Foundation.framework */
,
);
name
=
Frameworks
;
sourceTree
=
"<group>"
;
};
515B0F
9E141D3FA0001DC3E6
/* File
s */
=
{
515B0F
BA141D52E0001DC3E6
/* Pod
s */
=
{
isa
=
PBXGroup
;
children
=
(
515B0F9F141D3FB7001DC3E6
/* Pods.h */
,
515B0FA0141D3FB7001DC3E6
/* Pods.m */
,
515B0FBD141D52E0001DC3E6
/* Pods.h */
,
515B0FBE141D52E0001DC3E6
/* Pods.m */
,
515B0FBB141D52E0001DC3E6
/* Supporting Files */
,
);
name
=
Files
;
path
=
Pods
;
sourceTree
=
"<group>"
;
};
515B0FBB141D52E0001DC3E6
/* Supporting Files */
=
{
isa
=
PBXGroup
;
children
=
(
515B0FBC141D52E0001DC3E6
/* Pods-Prefix.pch */
,
);
name
=
"Supporting Files"
;
sourceTree
=
"<group>"
;
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
515B0F
88141D3E3A
001DC3E6
/* Headers */
=
{
515B0F
B3141D52E0
001DC3E6
/* Headers */
=
{
isa
=
PBXHeadersBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
515B0FA1141D3FB7001DC3E6
/* Pods.h in Headers */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
515B0F
89141D3E3A
001DC3E6
/* Pods */
=
{
515B0F
B4141D52E0
001DC3E6
/* Pods */
=
{
isa
=
PBXNativeTarget
;
buildConfigurationList
=
515B0F
97141D3E3A
001DC3E6
/* Build configuration list for PBXNativeTarget "Pods" */
;
buildConfigurationList
=
515B0F
C2141D52E0
001DC3E6
/* Build configuration list for PBXNativeTarget "Pods" */
;
buildPhases
=
(
515B0F
86141D3E3A
001DC3E6
/* Sources */
,
515B0F
87141D3E3A
001DC3E6
/* Frameworks */
,
515B0F
88141D3E3A
001DC3E6
/* Headers */
,
515B0F
B1141D52E0
001DC3E6
/* Sources */
,
515B0F
B2141D52E0
001DC3E6
/* Frameworks */
,
515B0F
B3141D52E0
001DC3E6
/* Headers */
,
);
buildRules
=
(
);
...
...
@@ -93,44 +101,44 @@
);
name
=
Pods
;
productName
=
Pods
;
productReference
=
515B0F
8A141D3E3A
001DC3E6
/* libPods.a */
;
productReference
=
515B0F
B5141D52E0
001DC3E6
/* libPods.a */
;
productType
=
"com.apple.product-type.library.static"
;
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
515B0F
81141D3E3A
001DC3E6
/* Project object */
=
{
515B0F
AC141D52E0
001DC3E6
/* Project object */
=
{
isa
=
PBXProject
;
buildConfigurationList
=
515B0F
84141D3E3A
001DC3E6
/* Build configuration list for PBXProject "Pods" */
;
buildConfigurationList
=
515B0F
AF141D52E0
001DC3E6
/* Build configuration list for PBXProject "Pods" */
;
compatibilityVersion
=
"Xcode 3.2"
;
developmentRegion
=
English
;
hasScannedForEncodings
=
0
;
knownRegions
=
(
en
,
);
mainGroup
=
515B0F
7F141D3E3A
001DC3E6
;
productRefGroup
=
515B0F
8B141D3E3A
001DC3E6
/* Products */
;
mainGroup
=
515B0F
AA141D52E0
001DC3E6
;
productRefGroup
=
515B0F
B6141D52E0
001DC3E6
/* Products */
;
projectDirPath
=
""
;
projectRoot
=
""
;
targets
=
(
515B0F
89141D3E3A
001DC3E6
/* Pods */
,
515B0F
B4141D52E0
001DC3E6
/* Pods */
,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
515B0F
86141D3E3A
001DC3E6
/* Sources */
=
{
515B0F
B1141D52E0
001DC3E6
/* Sources */
=
{
isa
=
PBXSourcesBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
515B0F
A2141D3FB7
001DC3E6
/* Pods.m in Sources */
,
515B0F
BF141D52E0
001DC3E6
/* Pods.m in Sources */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
515B0F
95141D3E3A
001DC3E6
/* Debug */
=
{
515B0F
C0141D52E0
001DC3E6
/* Debug */
=
{
isa
=
XCBuildConfiguration
;
buildSettings
=
{
ALWAYS_SEARCH_USER_PATHS
=
NO
;
...
...
@@ -153,7 +161,7 @@
};
name
=
Debug
;
};
515B0F
96141D3E3A
001DC3E6
/* Release */
=
{
515B0F
C1141D52E0
001DC3E6
/* Release */
=
{
isa
=
XCBuildConfiguration
;
buildSettings
=
{
ALWAYS_SEARCH_USER_PATHS
=
NO
;
...
...
@@ -170,7 +178,7 @@
};
name
=
Release
;
};
515B0F
98141D3E3A
001DC3E6
/* Debug */
=
{
515B0F
C3141D52E0
001DC3E6
/* Debug */
=
{
isa
=
XCBuildConfiguration
;
buildSettings
=
{
DSTROOT
=
/tmp/Pods.dst
;
...
...
@@ -182,7 +190,7 @@
};
name
=
Debug
;
};
515B0F
99141D3E3A
001DC3E6
/* Release */
=
{
515B0F
C4141D52E0
001DC3E6
/* Release */
=
{
isa
=
XCBuildConfiguration
;
buildSettings
=
{
DSTROOT
=
/tmp/Pods.dst
;
...
...
@@ -197,25 +205,24 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
515B0F
84141D3E3A
001DC3E6
/* Build configuration list for PBXProject "Pods" */
=
{
515B0F
AF141D52E0
001DC3E6
/* Build configuration list for PBXProject "Pods" */
=
{
isa
=
XCConfigurationList
;
buildConfigurations
=
(
515B0F
95141D3E3A
001DC3E6
/* Debug */
,
515B0F
96141D3E3A
001DC3E6
/* Release */
,
515B0F
C0141D52E0
001DC3E6
/* Debug */
,
515B0F
C1141D52E0
001DC3E6
/* Release */
,
);
defaultConfigurationIsVisible
=
0
;
defaultConfigurationName
=
Release
;
};
515B0F
97141D3E3A
001DC3E6
/* Build configuration list for PBXNativeTarget "Pods" */
=
{
515B0F
C2141D52E0
001DC3E6
/* Build configuration list for PBXNativeTarget "Pods" */
=
{
isa
=
XCConfigurationList
;
buildConfigurations
=
(
515B0F
98141D3E3A
001DC3E6
/* Debug */
,
515B0F
99141D3E3A
001DC3E6
/* Release */
,
515B0F
C3141D52E0
001DC3E6
/* Debug */
,
515B0F
C4141D52E0
001DC3E6
/* Release */
,
);
defaultConfigurationIsVisible
=
0
;
defaultConfigurationName
=
Release
;
};
/* End XCConfigurationList section */
};
rootObject
=
515B0F
81141D3E3A
001DC3E6
/* Project object */
;
rootObject
=
515B0F
AC141D52E0
001DC3E6
/* Project object */
;
}
xcode-project-templates/cocoa-touch-static-library/Pods/Pods-Prefix.pch
0 → 100644
View file @
cca8cdfb
//
// Prefix header for all source files of the 'Pods' target in the 'Pods' project
//
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#endif
xcode-project-templates/cocoa-touch-static-library/
nested/file
s/Pods.h
→
xcode-project-templates/cocoa-touch-static-library/
Pod
s/Pods.h
View file @
cca8cdfb
File moved
xcode-project-templates/cocoa-touch-static-library/
nested/file
s/Pods.m
→
xcode-project-templates/cocoa-touch-static-library/
Pod
s/Pods.m
View file @
cca8cdfb
File moved
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