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
274fef8c
Commit
274fef8c
authored
Apr 27, 2012
by
Francis Chong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Instead of generate a dummy source file for each target, generate one in pod installer#install!
parent
2166feb8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
20 deletions
+18
-20
dummy_source.rb
lib/cocoapods/generator/dummy_source.rb
+2
-6
installer.rb
lib/cocoapods/installer.rb
+14
-0
target_installer.rb
lib/cocoapods/installer/target_installer.rb
+1
-9
podfile.rb
lib/cocoapods/podfile.rb
+0
-4
dummy_source_spec.rb
spec/unit/generator/dummy_source_spec.rb
+1
-1
No files found.
lib/cocoapods/generator/dummy_source.rb
View file @
274fef8c
module
Pod
module
Pod
module
Generator
module
Generator
class
DummySource
class
DummySource
def
initialize
(
label
=
"Pods"
)
@label
=
label
.
gsub
(
/[^a-zA-Z]/
,
''
)
end
def
save_as
(
pathname
)
def
save_as
(
pathname
)
pathname
.
open
(
'w'
)
do
|
source
|
pathname
.
open
(
'w'
)
do
|
source
|
source
.
puts
"@interface
#{
@label
}
Dummy : NSObject"
source
.
puts
"@interface
Pods
Dummy : NSObject"
source
.
puts
"@end"
source
.
puts
"@end"
source
.
puts
"@implementation
#{
@label
}
Dummy"
source
.
puts
"@implementation
Pods
Dummy"
source
.
puts
"@end"
source
.
puts
"@end"
end
end
end
end
...
...
lib/cocoapods/installer.rb
View file @
274fef8c
...
@@ -83,6 +83,7 @@ module Pod
...
@@ -83,6 +83,7 @@ module Pod
end
end
generate_lock_file!
(
pods
)
generate_lock_file!
(
pods
)
generate_dummy_source
puts
"* Running post install hooks"
if
config
.
verbose?
puts
"* Running post install hooks"
if
config
.
verbose?
# Post install hooks run _before_ saving of project, so that they can alter it before saving.
# Post install hooks run _before_ saving of project, so that they can alter it before saving.
...
@@ -152,6 +153,19 @@ module Pod
...
@@ -152,6 +153,19 @@ module Pod
end
end
end
end
def
generate_dummy_source
filename
=
"PodsDummy.m"
pathname
=
Pathname
.
new
(
sandbox
.
root
+
filename
)
Generator
::
DummySource
.
new
.
save_as
(
pathname
)
project_file
=
project
.
files
.
new
(
'path'
=>
filename
)
project
.
group
(
"Targets Support Files"
)
<<
project_file
target_installers
.
each
do
|
target_installer
|
target_installer
.
target
.
source_build_phases
.
first
<<
project_file
end
end
def
specs_by_target
def
specs_by_target
@specs_by_target
||=
@resolver
.
resolve
@specs_by_target
||=
@resolver
.
resolve
end
end
...
...
lib/cocoapods/installer/target_installer.rb
View file @
274fef8c
...
@@ -53,7 +53,7 @@ module Pod
...
@@ -53,7 +53,7 @@ module Pod
end
end
def
target_support_files
def
target_support_files
[
:copy_resources_script_name
,
:prefix_header_name
,
:xcconfig_name
,
:dummy_source_name
].
map
{
|
file
|
@target_definition
.
send
(
file
)
}
[
:copy_resources_script_name
,
:prefix_header_name
,
:xcconfig_name
].
map
{
|
file
|
@target_definition
.
send
(
file
)
}
end
end
# TODO move xcconfig related code into the xcconfig method, like copy_resources_script and generate_bridge_support.
# TODO move xcconfig related code into the xcconfig method, like copy_resources_script and generate_bridge_support.
...
@@ -79,7 +79,6 @@ module Pod
...
@@ -79,7 +79,6 @@ module Pod
xcconfig_file
=
support_files_group
.
files
.
where
(
:path
=>
@target_definition
.
xcconfig_name
)
xcconfig_file
=
support_files_group
.
files
.
where
(
:path
=>
@target_definition
.
xcconfig_name
)
configure_build_configurations
(
xcconfig_file
)
configure_build_configurations
(
xcconfig_file
)
create_files
(
pods
,
sandbox
)
create_files
(
pods
,
sandbox
)
add_dummy_file
(
support_files_group
)
end
end
def
configure_build_configurations
(
xcconfig_file
)
def
configure_build_configurations
(
xcconfig_file
)
...
@@ -91,11 +90,6 @@ module Pod
...
@@ -91,11 +90,6 @@ module Pod
end
end
end
end
def
add_dummy_file
(
support_files_group
)
dummy
=
Pathname
.
new
(
@target_definition
.
dummy_source_name
)
@target
.
add_source_file
(
dummy
)
end
def
create_files
(
pods
,
sandbox
)
def
create_files
(
pods
,
sandbox
)
if
@podfile
.
generate_bridge_support?
if
@podfile
.
generate_bridge_support?
bridge_support_metadata_path
=
sandbox
.
root
+
@target_definition
.
bridge_support_name
bridge_support_metadata_path
=
sandbox
.
root
+
@target_definition
.
bridge_support_name
...
@@ -109,8 +103,6 @@ module Pod
...
@@ -109,8 +103,6 @@ module Pod
save_prefix_header_as
(
sandbox
.
root
+
@target_definition
.
prefix_header_name
,
pods
)
save_prefix_header_as
(
sandbox
.
root
+
@target_definition
.
prefix_header_name
,
pods
)
puts
"* Generating copy resources script at `
#{
sandbox
.
root
+
@target_definition
.
copy_resources_script_name
}
'"
if
config
.
verbose?
puts
"* Generating copy resources script at `
#{
sandbox
.
root
+
@target_definition
.
copy_resources_script_name
}
'"
if
config
.
verbose?
copy_resources_script_for
(
pods
).
save_as
(
sandbox
.
root
+
@target_definition
.
copy_resources_script_name
)
copy_resources_script_for
(
pods
).
save_as
(
sandbox
.
root
+
@target_definition
.
copy_resources_script_name
)
puts
"* Generating dummy source at `
#{
sandbox
.
root
+
@target_definition
.
dummy_source_name
}
'"
if
config
.
verbose?
Generator
::
DummySource
.
new
(
@target_definition
.
label
).
save_as
(
sandbox
.
root
+
@target_definition
.
dummy_source_name
)
end
end
private
private
...
...
lib/cocoapods/podfile.rb
View file @
274fef8c
...
@@ -95,10 +95,6 @@ module Pod
...
@@ -95,10 +95,6 @@ module Pod
def
prefix_header_name
def
prefix_header_name
"
#{
label
}
-prefix.pch"
"
#{
label
}
-prefix.pch"
end
end
def
dummy_source_name
"
#{
label
}
Dummy.m"
end
def
bridge_support_name
def
bridge_support_name
"
#{
label
}
.bridgesupport"
"
#{
label
}
.bridgesupport"
...
...
spec/unit/generator/dummy_source_spec.rb
View file @
274fef8c
...
@@ -12,7 +12,7 @@ describe Pod::Generator::DummySource do
...
@@ -12,7 +12,7 @@ describe Pod::Generator::DummySource do
end
end
it
"generates a dummy sourcefile with the appropriate class"
do
it
"generates a dummy sourcefile with the appropriate class"
do
generator
=
Pod
::
Generator
::
DummySource
.
new
(
"Pods"
)
generator
=
Pod
::
Generator
::
DummySource
.
new
file
=
temporary_directory
+
'PodsDummy.m'
file
=
temporary_directory
+
'PodsDummy.m'
generator
.
save_as
(
file
)
generator
.
save_as
(
file
)
file
.
read
.
should
==
<<-
EOS
file
.
read
.
should
==
<<-
EOS
...
...
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