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
f8ee5112
Commit
f8ee5112
authored
Sep 10, 2014
by
Marius Rackwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support module imports in header files
parent
abf23761
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
header.rb
lib/cocoapods/generator/header.rb
+12
-0
header_spec.rb
spec/unit/generator/header_spec.rb
+10
-0
No files found.
lib/cocoapods/generator/header.rb
View file @
f8ee5112
...
...
@@ -15,12 +15,17 @@ module Pod
#
attr_accessor
:imports
# @return [Array<String>] The list of the modules to import.
#
attr_accessor
:module_imports
# @param [Symbol] platform
# @see platform
#
def
initialize
(
platform
)
@platform
=
platform
@imports
=
[]
@module_imports
=
[]
end
# Generates the contents of the header according to the platform.
...
...
@@ -41,6 +46,13 @@ module Pod
result
<<
%|#import "#{import}"\n|
end
unless
module_imports
.
empty?
module_imports
.
each
do
|
import
|
result
<<
%|\n@import #{import}|
end
result
<<
"
\n
"
end
result
end
...
...
spec/unit/generator/header_spec.rb
View file @
f8ee5112
...
...
@@ -16,6 +16,16 @@ module Pod
EOS
end
it
'includes the module imports'
do
@gen
.
module_imports
<<
'Module'
@gen
.
generate
.
should
==
<<-
EOS
.
strip_heredoc
#import <UIKit/UIKit.h>
@import Module
EOS
end
it
'imports UIKit in iOS platforms'
do
@gen
.
stubs
(
:platform
).
returns
(
Pod
::
Platform
.
ios
)
@gen
.
generate
.
should
.
include?
(
'#import <UIKit/UIKit.h>'
)
...
...
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