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 ...@@ -144,7 +144,7 @@ namespace :examples do
command = "xcodebuild -workspace '#{example.basename}.xcworkspace' -scheme '#{example.basename}'" command = "xcodebuild -workspace '#{example.basename}.xcworkspace' -scheme '#{example.basename}'"
if (example + 'Podfile').read.include?('platform :ios') if (example + 'Podfile').read.include?('platform :ios')
# Specifically build against the simulator SDK so we don't have to deal with code signing. # 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 end
sh command sh command
end end
......
...@@ -10,62 +10,97 @@ module Pod ...@@ -10,62 +10,97 @@ module Pod
@options = pod.specification.documentation || {} @options = pod.specification.documentation || {}
end end
def appledoc (options) def name
bin = `which appledoc`.strip @specification.to_s
if bin.empty? end
return
end def company
arguments = [] if @specification.authors
arguments += options @specification.authors.keys.join(', ')
arguments << '--print-settings' if Config.instance.verbose? else
arguments += self.files 'no-company'
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
end end
end end
def generate_appledoc_options def copyright
project_company = @specification.authors ? @specification.authors.keys.join(', ') : 'no-company' company
options = ['--project-name', @specification.to_s, end
'--project-company', project_company,
'--docset-copyright', project_company, def description
'--company-id', 'org.cocoapods', @specification.description || "Generated by CocoaPods."
'--ignore', '.m'] end
options += ['--docset-desc', @specification.description] if @specification.description
['README.md', 'README.mdown', 'README.markdown','README'].each do |f| 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) if File.file?(@pod.root + f)
options += ['--index-desc', f] return f
break
end end
end end
options += @options[:appledoc] if @options[:appledoc] nil
options end
def spec_appledoc_options
@options[:appledoc] || []
end end
def files def generate_appledoc_options
@pod.absolute_source_files 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 end
def generate(install = false) def generate(install = false)
options = generate_appledoc_options options = generate_appledoc_options
options += ['--output', @target_path] options += ['--output', @target_path]
options << '--keep-intermediate-files' options += ['--keep-intermediate-files']
options << '--no-create-docset' unless install options += ['--no-create-docset'] unless install
@target_path.mkpath @target_path.mkpath
@pod.chdir do @pod.chdir do
appledoc(options) appledoc(options)
end end
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
end end
...@@ -139,11 +139,11 @@ else ...@@ -139,11 +139,11 @@ else
installer = SpecHelper::Installer.new(podfile) installer = SpecHelper::Installer.new(podfile)
installer.install! installer.install!
doc = (config.project_pods_root + 'Documentation/JSONKit/html/index.html').read File.directory?(config.project_pods_root + 'Documentation/JSONKit/html/')
doc.should.include?('JSONKit (1.4)')
doc = (config.project_pods_root + 'Documentation/SSToolkit/html/index.html').read doc = (config.project_pods_root + 'Documentation/SSToolkit/html/index.html').read
doc.should.include?('SSToolkit') doc.should.include?('SSToolkit')
end end
end end
......
...@@ -30,15 +30,17 @@ describe Pod::DocsGenerator do ...@@ -30,15 +30,17 @@ describe Pod::DocsGenerator do
it 'returns the Pod documentation options' do it 'returns the Pod documentation options' do
@doc_installer.generate_appledoc_options.should == [ @doc_installer.generate_appledoc_options.should == [
"--project-name", "BananaLib (1.0)", '--project-name', 'BananaLib (1.0)',
"--project-company", "Monkey Boy, Banana Corp", '--docset-desc', 'Full of chunky bananas.',
"--docset-copyright", "Monkey Boy, Banana Corp", '--project-company', 'Monkey Boy, Banana Corp',
"--company-id", "org.cocoapods", '--docset-copyright', 'Monkey Boy, Banana Corp',
"--ignore", ".m", '--company-id', 'org.cocoapods',
"--docset-desc", "Full of chunky bananas.", '--ignore', '.m',
"--index-desc", "README", '--keep-undocumented-objects',
"--project-company", "Banana Corp", '--keep-undocumented-members',
"--company-id", "com.banana" '--index-desc', 'README',
'--project-company', 'Banana Corp',
'--company-id', 'com.banana'
] ]
end end
...@@ -48,6 +50,10 @@ describe Pod::DocsGenerator do ...@@ -48,6 +50,10 @@ describe Pod::DocsGenerator do
it 'it creates the html' do it 'it creates the html' do
File.directory?(@sandbox.root + "Documentation/BananaLib/html").should.be.true 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
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