Skip to content

Instantly share code, notes, and snippets.

@alloy
Forked from orta/cocoapods_public_headers.rb
Last active December 19, 2015 15:09
Show Gist options
  • Save alloy/5974763 to your computer and use it in GitHub Desktop.
Save alloy/5974763 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'cocoapods-downloader'
require 'cocoapods-core'
require 'cocoapods'
@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" => "ios@javisoto.es" }
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
$active_folder = "active"
@download_location = $active_folder + "/download/#{@spec.name}/#{@spec.version}/#{@spec.name}"
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment