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
09ebfb1a
Commit
09ebfb1a
authored
Jul 15, 2012
by
Eloy Durán
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #402 from dlvenable/unique-dummy
Make PodsDummy class unique to each target
parents
ea64987a
c3d1e836
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
14 deletions
+57
-14
dummy_source.rb
lib/cocoapods/generator/dummy_source.rb
+9
-2
installer.rb
lib/cocoapods/installer.rb
+6
-6
integration_spec.rb
spec/integration_spec.rb
+25
-2
dummy_source_spec.rb
spec/unit/generator/dummy_source_spec.rb
+17
-4
No files found.
lib/cocoapods/generator/dummy_source.rb
View file @
09ebfb1a
module
Pod
module
Generator
class
DummySource
attr_reader
:class_name
def
initialize
(
class_name_identifier
)
validated_class_name_identifier
=
class_name_identifier
.
gsub
(
/[^0-9a-z_]/i
,
'_'
)
@class_name
=
"PodsDummy_
#{
validated_class_name_identifier
}
"
end
def
save_as
(
pathname
)
pathname
.
open
(
'w'
)
do
|
source
|
source
.
puts
"@interface
PodsDummy
: NSObject"
source
.
puts
"@interface
#{
class_name
}
: NSObject"
source
.
puts
"@end"
source
.
puts
"@implementation
PodsDummy
"
source
.
puts
"@implementation
#{
class_name
}
"
source
.
puts
"@end"
end
end
...
...
lib/cocoapods/installer.rb
View file @
09ebfb1a
...
...
@@ -107,10 +107,10 @@ module Pod
acknowledgements_path
=
target_installer
.
target_definition
.
acknowledgements_path
Generator
::
Acknowledgements
.
new
(
target_installer
.
target_definition
,
pods_for_target
).
save_as
(
acknowledgements_path
)
generate_dummy_source
(
target_installer
)
end
generate_lock_file!
(
specifications
)
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.
...
...
@@ -172,18 +172,18 @@ module Pod
end
end
def
generate_dummy_source
filename
=
"PodsDummy.m"
def
generate_dummy_source
(
target_installer
)
class_name_identifier
=
target_installer
.
target_definition
.
label
dummy_source
=
Generator
::
DummySource
.
new
(
class_name_identifier
)
filename
=
"
#{
dummy_source
.
class_name
}
.m"
pathname
=
Pathname
.
new
(
sandbox
.
root
+
filename
)
Generator
::
DummySource
.
new
.
save_as
(
pathname
)
dummy_source
.
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
...
...
spec/integration_spec.rb
View file @
09ebfb1a
...
...
@@ -114,8 +114,31 @@ else
installer
=
SpecHelper
::
Installer
.
new
(
podfile
)
installer
.
install!
dummy
=
(
config
.
project_pods_root
+
'PodsDummy.m'
).
read
dummy
.
should
.
include?
(
'@implementation PodsDummy'
)
dummy
=
(
config
.
project_pods_root
+
'PodsDummy_Pods.m'
).
read
dummy
.
should
.
include?
(
'@implementation PodsDummy_Pods'
)
end
it
"installs a dummy source file unique to the target"
do
create_config!
podfile
=
Pod
::
Podfile
.
new
do
self
.
platform
:ios
xcodeproj
'dummy'
pod
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
target
:AnotherTarget
do
pod
'ASIHTTPRequest'
end
end
installer
=
SpecHelper
::
Installer
.
new
(
podfile
)
installer
.
install!
dummy
=
(
config
.
project_pods_root
+
'PodsDummy_Pods_AnotherTarget.m'
).
read
dummy
.
should
.
include?
(
'@implementation PodsDummy_Pods_AnotherTarget'
)
end
it
"installs a library with a podspec defined inline"
do
...
...
spec/unit/generator/dummy_source_spec.rb
View file @
09ebfb1a
...
...
@@ -11,15 +11,28 @@ describe Pod::Generator::DummySource do
teardown_temporary_directory
end
it
"generates a dummy sourcefile with the appropriate class"
do
generator
=
Pod
::
Generator
::
DummySource
.
new
it
"generates a dummy sourcefile with the appropriate class
for the class name identifier
"
do
generator
=
Pod
::
Generator
::
DummySource
.
new
(
'SomeIdentification'
)
file
=
temporary_directory
+
'PodsDummy.m'
generator
.
save_as
(
file
)
file
.
read
.
should
==
<<-
EOS
@interface PodsDummy : NSObject
@interface PodsDummy
_SomeIdentification
: NSObject
@end
@implementation PodsDummy
@implementation PodsDummy
_SomeIdentification
@end
EOS
end
it
"generates a dummy sourcefile with the appropriate class, replacing non-alphanumeric characters with underscores"
do
generator
=
Pod
::
Generator
::
DummySource
.
new
(
'This!has_non-alphanumeric+characters in it.0123456789'
)
file
=
temporary_directory
+
'PodsDummy.m'
generator
.
save_as
(
file
)
file
.
read
.
should
==
<<-
EOS
@interface PodsDummy_This_has_non_alphanumeric_characters_in_it_0123456789 : NSObject
@end
@implementation PodsDummy_This_has_non_alphanumeric_characters_in_it_0123456789
@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