Commit ce731f92 authored by Fabio Pelosin's avatar Fabio Pelosin

force appledoc to show undocumented classes and other updates

parent d2f5a70c
......@@ -144,7 +144,7 @@ namespace :examples do
command = "xcodebuild -workspace '#{example.basename}.xcworkspace' -scheme '#{example.basename}'"
if (example + 'Podfile').read.include?('platform :ios')
# Specifically build against the simulator SDK so we don't have to deal with code signing.
command << " -sdk /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk"
command << " -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk"
end
sh command
end
......
......@@ -10,62 +10,97 @@ module Pod
@options = pod.specification.documentation || {}
end
def appledoc (options)
bin = `which appledoc`.strip
if bin.empty?
return
end
arguments = []
arguments += options
arguments << '--print-settings' if Config.instance.verbose?
arguments += self.files
Open3.popen3('appledoc', *arguments) do |i, o, e|
if Config.instance.verbose?
puts o.read.chomp
puts e.read.chomp
else
# TODO: This is needed otherwise appledoc will not install the doc set
# This is a work around related to poor understanding of the IO class.
o.read
e.read
end
def name
@specification.to_s
end
def company
if @specification.authors
@specification.authors.keys.join(', ')
else
'no-company'
end
end
def generate_appledoc_options
project_company = @specification.authors ? @specification.authors.keys.join(', ') : 'no-company'
options = ['--project-name', @specification.to_s,
'--project-company', project_company,
'--docset-copyright', project_company,
'--company-id', 'org.cocoapods',
'--ignore', '.m']
options += ['--docset-desc', @specification.description] if @specification.description
['README.md', 'README.mdown', 'README.markdown','README'].each do |f|
def copyright
company
end
def description
@specification.description || "Generated by CocoaPods."
end
def docs_id
'org.cocoapods'
end
def files
@pod.absolute_source_files
end
def index_file
candidates = ['README.md', 'README.mdown', 'README.markdown','README']
candidates.each do |f|
if File.file?(@pod.root + f)
options += ['--index-desc', f]
break
return f
end
end
options += @options[:appledoc] if @options[:appledoc]
options
nil
end
def spec_appledoc_options
@options[:appledoc] || []
end
def files
@pod.absolute_source_files
def generate_appledoc_options
options = ['--project-name', name,
'--docset-desc', description,
'--project-company', company,
'--docset-copyright', copyright,
'--company-id', docs_id,
'--ignore', '.m',
'--keep-undocumented-objects',
'--keep-undocumented-members']
index = index_file
options += ['--index-desc', index] if index
options += spec_appledoc_options
end
def generate(install = false)
options = generate_appledoc_options
options += ['--output', @target_path]
options << '--keep-intermediate-files'
options << '--no-create-docset' unless install
options += ['--keep-intermediate-files']
options += ['--no-create-docset'] unless install
@target_path.mkpath
@pod.chdir do
appledoc(options)
end
end
def appledoc (options)
bin = `which appledoc`.strip
if bin.empty?
puts "\n[!] Skipping documenation generation because appledoc can't be found." if Config.instance.verbose?
return
end
arguments = []
arguments += options
arguments += ['--print-settings'] if Config.instance.verbose?
arguments += files
Open3.popen3('appledoc', *arguments) do |i, o, e|
if Config.instance.verbose?
puts o.read.chomp
puts e.read.chomp
else
# TODO: This is needed otherwise appledoc may not install the doc set
# This is a work around related to poor understanding of the IO class.
o.read
e.read
end
end
end
end
end
......@@ -139,11 +139,11 @@ else
installer = SpecHelper::Installer.new(podfile)
installer.install!
doc = (config.project_pods_root + 'Documentation/JSONKit/html/index.html').read
doc.should.include?('JSONKit (1.4)')
File.directory?(config.project_pods_root + 'Documentation/JSONKit/html/')
doc = (config.project_pods_root + 'Documentation/SSToolkit/html/index.html').read
doc.should.include?('SSToolkit')
end
end
......
......@@ -30,15 +30,17 @@ describe Pod::DocsGenerator do
it 'returns the Pod documentation options' do
@doc_installer.generate_appledoc_options.should == [
"--project-name", "BananaLib (1.0)",
"--project-company", "Monkey Boy, Banana Corp",
"--docset-copyright", "Monkey Boy, Banana Corp",
"--company-id", "org.cocoapods",
"--ignore", ".m",
"--docset-desc", "Full of chunky bananas.",
"--index-desc", "README",
"--project-company", "Banana Corp",
"--company-id", "com.banana"
'--project-name', 'BananaLib (1.0)',
'--docset-desc', 'Full of chunky bananas.',
'--project-company', 'Monkey Boy, Banana Corp',
'--docset-copyright', 'Monkey Boy, Banana Corp',
'--company-id', 'org.cocoapods',
'--ignore', '.m',
'--keep-undocumented-objects',
'--keep-undocumented-members',
'--index-desc', 'README',
'--project-company', 'Banana Corp',
'--company-id', 'com.banana'
]
end
......@@ -48,6 +50,10 @@ describe Pod::DocsGenerator do
it 'it creates the html' do
File.directory?(@sandbox.root + "Documentation/BananaLib/html").should.be.true
index = (@sandbox.root + 'Documentation/BananaLib/html/index.html').read
index.should.include?('BananaObj')
index = (@sandbox.root + 'Documentation/BananaLib/html/Classes/BananaObj.html').read
index.should.include?('Bananas are cool')
end
end
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