Commit f8ee5112 authored by Marius Rackwitz's avatar Marius Rackwitz

Support module imports in header files

parent abf23761
...@@ -15,12 +15,17 @@ module Pod ...@@ -15,12 +15,17 @@ module Pod
# #
attr_accessor :imports attr_accessor :imports
# @return [Array<String>] The list of the modules to import.
#
attr_accessor :module_imports
# @param [Symbol] platform # @param [Symbol] platform
# @see platform # @see platform
# #
def initialize(platform) def initialize(platform)
@platform = platform @platform = platform
@imports = [] @imports = []
@module_imports = []
end end
# Generates the contents of the header according to the platform. # Generates the contents of the header according to the platform.
...@@ -41,6 +46,13 @@ module Pod ...@@ -41,6 +46,13 @@ module Pod
result << %|#import "#{import}"\n| result << %|#import "#{import}"\n|
end end
unless module_imports.empty?
module_imports.each do |import|
result << %|\n@import #{import}|
end
result << "\n"
end
result result
end end
......
...@@ -16,6 +16,16 @@ module Pod ...@@ -16,6 +16,16 @@ module Pod
EOS EOS
end 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 it 'imports UIKit in iOS platforms' do
@gen.stubs(:platform).returns(Pod::Platform.ios) @gen.stubs(:platform).returns(Pod::Platform.ios)
@gen.generate.should.include?('#import <UIKit/UIKit.h>') @gen.generate.should.include?('#import <UIKit/UIKit.h>')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment