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
Generator
class
DummySource
def
initialize
(
label
=
"Pods"
)
@label
=
label
.
gsub
(
/[^a-zA-Z]/
,
''
)
end
def
save_as
(
pathname
)
pathname
.
open
(
'w'
)
do
|
source
|
source
.
puts
"@interface
#{
@label
}
Dummy : NSObject"
source
.
puts
"@interface
Pods
Dummy : NSObject"
source
.
puts
"@end"
source
.
puts
"@implementation
#{
@label
}
Dummy"
source
.
puts
"@implementation
Pods
Dummy"
source
.
puts
"@end"
end
end
...
...
lib/cocoapods/installer.rb
View file @
274fef8c
...
...
@@ -83,6 +83,7 @@ module Pod
end
generate_lock_file!
(
pods
)
generate_dummy_source
puts
"* Running post install hooks"
if
config
.
verbose?
# Post install hooks run _before_ saving of project, so that they can alter it before saving.
...
...
@@ -152,6 +153,19 @@ module Pod
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
@specs_by_target
||=
@resolver
.
resolve
end
...
...
lib/cocoapods/installer/target_installer.rb
View file @
274fef8c
...
...
@@ -53,7 +53,7 @@ module Pod
end
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
# TODO move xcconfig related code into the xcconfig method, like copy_resources_script and generate_bridge_support.
...
...
@@ -79,7 +79,6 @@ module Pod
xcconfig_file
=
support_files_group
.
files
.
where
(
:path
=>
@target_definition
.
xcconfig_name
)
configure_build_configurations
(
xcconfig_file
)
create_files
(
pods
,
sandbox
)
add_dummy_file
(
support_files_group
)
end
def
configure_build_configurations
(
xcconfig_file
)
...
...
@@ -91,11 +90,6 @@ module Pod
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
)
if
@podfile
.
generate_bridge_support?
bridge_support_metadata_path
=
sandbox
.
root
+
@target_definition
.
bridge_support_name
...
...
@@ -109,8 +103,6 @@ module Pod
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?
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
private
...
...
lib/cocoapods/podfile.rb
View file @
274fef8c
...
...
@@ -95,10 +95,6 @@ module Pod
def
prefix_header_name
"
#{
label
}
-prefix.pch"
end
def
dummy_source_name
"
#{
label
}
Dummy.m"
end
def
bridge_support_name
"
#{
label
}
.bridgesupport"
...
...
spec/unit/generator/dummy_source_spec.rb
View file @
274fef8c
...
...
@@ -12,7 +12,7 @@ describe Pod::Generator::DummySource do
end
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'
generator
.
save_as
(
file
)
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