Commit 67d7efcb authored by Luis de la Rosa's avatar Luis de la Rosa

Addressed comments from @irrationalfab:

- simplified collection of unique prefix_header_contents
- reduced sub specs in spec from 4 to 2
Removed inline documentation and added @notes and @todos.
Added entry to Changelog.
parent 0873065d
......@@ -8,6 +8,11 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
##### Enhancements
* Generated prefix header file will now have unique prefix_header_contents for
Pods with subspecs.
[Luis de la Rosa](https://github.com/luisdelarosa)
[#1449](https://github.com/CocoaPods/CocoaPods/issues/1449)
* Add version to output of `pod list`
[Stefan Damm](https://github.com/StefanDamm)
[Robert Zuber](https://github.com/z00b)
......
......@@ -40,9 +40,12 @@ module Pod
# added to the top of the prefix header. For OS X `Cocoa/Cocoa.h`
# is imported.
#
# @note Only unique prefix_header_contents are added to the prefix header.
#
# @return [String]
#
# @todo Subspecs can specify prefix header information too.
# @todo Check to see if we have a similar duplication issue with file_accessor.prefix_header.
#
def generate
result = "#ifdef __OBJC__\n"
......@@ -53,23 +56,17 @@ module Pod
result << %|\n#import "#{import}"|
end
# collect all the prefix_header_contents and only get the unique contents so that we don't have duplicates
all_prefix_header_contents = file_accessors.collect do |file_accessor|
unique_prefix_header_contents = file_accessors.collect do |file_accessor|
file_accessor.spec_consumer.prefix_header_contents
end
unique_and_non_nil_prefix_header_contents = all_prefix_header_contents.compact.uniq
end.compact.uniq
# newline to separate prefix_headers and prefix_header_contents from the imports
result << "\n"
# output those unique prefix_header_contents
unique_and_non_nil_prefix_header_contents.each do |prefix_header_contents|
unique_prefix_header_contents.each do |prefix_header_contents|
result << prefix_header_contents
result << "\n"
end
# output the prefix_headers
# todo check to see if we have a similar duplicating issue with these
file_accessors.each do |file_accessor|
if prefix_header = file_accessor.prefix_header
result << Pathname(prefix_header).read
......
......@@ -21,10 +21,10 @@ module Pod
EOS
end
# @note Declaring a subspec was found in issue #1449 to generate duplicates of the prefix_header_contents
it "does not duplicate the contents of the specification's prefix header when a subspec is declared" do
@spec.prefix_header_contents = '#import "BlocksKit.h"'
@spec.prefix_header_file = nil
# Declaring a subspec was found in issue #1449 to generate duplicates of the prefix_header_contents
@spec.subspec 'UI' do |subspec|
subspec.source_files = 'Source/UI/*.{h,m}'
end
......@@ -37,10 +37,10 @@ module Pod
EOS
end
# @note Declaring a subspec was found in issue #1449 to generate duplicates of the prefix_header_contents
it "does not duplicate the contents of the specification's prefix header when a subspec is declared multiple times" do
@spec.prefix_header_contents = '#import "BlocksKit.h"'
@spec.prefix_header_file = nil
# Declaring a subspec was found in issue #1449 to generate duplicates of the prefix_header_contents
@spec.subspec 'UI' do |su|
su.source_files = 'Source/UI/*.{h,m}'
end
......@@ -49,14 +49,6 @@ module Pod
sh.source_files = 'Source/Helpers/*.{h,m}'
end
@spec.subspec 'Additions' do |sa|
sa.source_files = 'Source/Additions/*.{h,m}'
end
@spec.subspec 'Dashboard' do |sd|
sd.source_files = 'Source/Dashboard/*.{h,m}'
sd.resources = 'Source/Dashboard/*.{xib}'
end
@gen.generate.should == <<-EOS.strip_heredoc
#ifdef __OBJC__
#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