Last active
December 19, 2015 15:09
-
-
Save orta/5974581 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'cocoapods-downloader' | |
require 'cocoapods-core' | |
require 'cocoapods' | |
$active_folder = "active" | |
@download_location = $active_folder + "/download/#{spec.name}/#{spec.version}/#{spec.name}" | |
@spec = Pod::Spec.new do |s| | |
s.name = "MSActiveConfig" | |
s.version = "1.0.1" | |
s.summary = "Remote configuration and A/B Testing framework for iOS." | |
s.homepage = "https://github.com/mindsnacks/MSActiveConfig" | |
s.license = { :type => 'MIT', :file => 'LICENSE' } | |
s.author = { "Javier Soto" => "[email protected]" } | |
s.source = { :git => "https://github.com/mindsnacks/MSActiveConfig.git", :tag => "v1.0.1" } | |
s.platform = :ios, '6.0' | |
s.source_files = 'MSActiveConfig/Classes/*.{h,m}' | |
s.private_header_files = 'MSActiveConfig/Classes/*+Private.h' | |
s.requires_arc = true | |
end | |
# download | |
downloader = Pod::Downloader.for_target(@download_location, @spec.source) | |
downloader.cache_root = @cache_path | |
downloader.download | |
# extract headers from sandbox'd download files | |
download_location = $active_folder + "/download/#{@spec.name}/#{@spec.version}/#{@spec.name}" | |
pathlist = Pod::Sandbox::PathList.new( Pathname.new(download_location) ) | |
headers = [] | |
[@spec, *@spec.subspecs].each do |internal_spec| | |
if internal_spec.attributes_hash["source_files"] | |
internal_spec.available_platforms.each do |platform| | |
consumer = Pod::Specification::Consumer.new(internal_spec, platform) | |
accessor = Pod::Sandbox::FileAccessor.new(pathlist, consumer) | |
headers += accessor.public_headers.map{ |filepath| filepath.to_s } | |
end | |
else | |
puts "Skipping headers for #{internal_spec}".blue | |
end | |
end | |
p headers.uniq |
So with the broken spec, as it’s currently in the master spec repo, the private headers are included:
~/t/TestPrivateHeaders » ruby t.rb
> GitHub download
["active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSActiveConfig+Private.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSActiveConfig.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSActiveConfigConfigurationState+MSLazyLoadedState.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSActiveConfigConfigurationState+Private.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSActiveConfigConfigurationState.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSActiveConfigDownloader.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSActiveConfigListener.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSActiveConfigMutableConfigurationState.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSActiveConfigSection+Private.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSActiveConfigSection.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSActiveConfigStore.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSJSONURLRequestActiveConfigDownloader.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSUserDefaultsActiveConfigStore.h"]
With the fixed spec, i.e. by adding the MSActiveConfig prefix, the private headers are excluded as expected:
~/t/TestPrivateHeaders » ruby t.rb
> GitHub download
["active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSActiveConfig.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSActiveConfigConfigurationState+MSLazyLoadedState.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSActiveConfigConfigurationState.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSActiveConfigDownloader.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSActiveConfigListener.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSActiveConfigMutableConfigurationState.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSActiveConfigSection.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSActiveConfigStore.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSJSONURLRequestActiveConfigDownloader.h", "active/download/MSActiveConfig/1.0.1/MSActiveConfig/MSActiveConfig/Classes/MSUserDefaultsActiveConfigStore.h"]
👍 aceness
You get a free wine-glass from me at NSSpain.
Or maybe I'll ask Danger to bring something british over next week.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some small fixes: https://gist.github.com/alloy/5974763.