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
38d85b09
Commit
38d85b09
authored
Apr 27, 2012
by
siuying
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #232 from siuying/dummy_source
Add dummy source file to Pod project
parents
19a75192
cdee5f90
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
3 deletions
+78
-3
cocoapods.rb
lib/cocoapods.rb
+1
-0
dummy_source.rb
lib/cocoapods/generator/dummy_source.rb
+18
-0
target_installer.rb
lib/cocoapods/installer/target_installer.rb
+10
-3
podfile.rb
lib/cocoapods/podfile.rb
+4
-0
integration_spec.rb
spec/integration_spec.rb
+20
-0
dummy_source_spec.rb
spec/unit/generator/dummy_source_spec.rb
+25
-0
No files found.
lib/cocoapods.rb
View file @
38d85b09
...
@@ -30,6 +30,7 @@ module Pod
...
@@ -30,6 +30,7 @@ module Pod
autoload
:BridgeSupport
,
'cocoapods/generator/bridge_support'
autoload
:BridgeSupport
,
'cocoapods/generator/bridge_support'
autoload
:CopyResourcesScript
,
'cocoapods/generator/copy_resources_script'
autoload
:CopyResourcesScript
,
'cocoapods/generator/copy_resources_script'
autoload
:Documentation
,
'cocoapods/generator/documentation'
autoload
:Documentation
,
'cocoapods/generator/documentation'
autoload
:DummySource
,
'cocoapods/generator/dummy_source'
end
end
end
end
...
...
lib/cocoapods/generator/dummy_source.rb
0 → 100644
View file @
38d85b09
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
"@end"
source
.
puts
"@implementation
#{
@label
}
Dummy"
source
.
puts
"@end"
end
end
end
end
end
lib/cocoapods/installer/target_installer.rb
View file @
38d85b09
...
@@ -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
].
map
{
|
file
|
@target_definition
.
send
(
file
)
}
[
:copy_resources_script_name
,
:prefix_header_name
,
:xcconfig_name
,
:dummy_source_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.
...
@@ -75,11 +75,11 @@ module Pod
...
@@ -75,11 +75,11 @@ module Pod
support_files_group
=
@project
.
group
(
"Targets Support Files"
).
create_group
(
@target_definition
.
label
)
support_files_group
=
@project
.
group
(
"Targets Support Files"
).
create_group
(
@target_definition
.
label
)
support_files_group
.
create_files
(
target_support_files
)
support_files_group
.
create_files
(
target_support_files
)
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,6 +91,11 @@ module Pod
...
@@ -91,6 +91,11 @@ 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
...
@@ -104,6 +109,8 @@ module Pod
...
@@ -104,6 +109,8 @@ 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 @
38d85b09
...
@@ -95,6 +95,10 @@ module Pod
...
@@ -95,6 +95,10 @@ 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/integration_spec.rb
View file @
38d85b09
...
@@ -118,6 +118,26 @@ else
...
@@ -118,6 +118,26 @@ else
'DEPENDENCIES'
=>
[
"Reachability (from `
#{
url
}
')"
]
'DEPENDENCIES'
=>
[
"Reachability (from `
#{
url
}
')"
]
}
}
end
end
it
"install a dummy source file"
do
create_config!
podfile
=
Pod
::
Podfile
.
new
do
self
.
platform
:ios
xcodeproj
'dummy'
dependency
do
|
s
|
s
.
name
=
'JSONKit'
s
.
version
=
'1.2'
s
.
source
=
{
:git
=>
SpecHelper
.
fixture
(
'integration/JSONKit'
).
to_s
,
:tag
=>
'v1.2'
}
s
.
source_files
=
'JSONKit.*'
end
end
installer
=
SpecHelper
::
Installer
.
new
(
podfile
)
installer
.
install!
dummy
=
(
config
.
project_pods_root
+
'PodsDummy.m'
).
read
dummy
.
should
.
include?
(
'@implementation PodsDummy'
)
end
it
"installs a library with a podspec defined inline"
do
it
"installs a library with a podspec defined inline"
do
podfile
=
Pod
::
Podfile
.
new
do
podfile
=
Pod
::
Podfile
.
new
do
...
...
spec/unit/generator/dummy_source_spec.rb
0 → 100644
View file @
38d85b09
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
describe
Pod
::
Generator
::
DummySource
do
extend
SpecHelper
::
TemporaryDirectory
before
do
setup_temporary_directory
end
after
do
teardown_temporary_directory
end
it
"generates a dummy sourcefile with the appropriate class"
do
generator
=
Pod
::
Generator
::
DummySource
.
new
(
"Pods"
)
file
=
temporary_directory
+
'PodsDummy.m'
generator
.
save_as
(
file
)
file
.
read
.
should
==
<<-
EOS
@interface PodsDummy : NSObject
@end
@implementation PodsDummy
@end
EOS
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