Commit 46ea3110 authored by Fabio Pelosin's avatar Fabio Pelosin

[#149] removed atom support force appledoc

parent 75abdeda
...@@ -20,8 +20,8 @@ module Pod ...@@ -20,8 +20,8 @@ module Pod
def self.options def self.options
" --no-clean Leave SCM dirs like `.git' and `.svn' in tact after downloading\n" + " --no-clean Leave SCM dirs like `.git' and `.svn' in tact after downloading\n" +
" --no-update Skip running `pod repo update` before install\n" + " --no-update Skip running `pod repo update` before install\n" +
" --doc-force Generate documentation for all pods with appledoc\n" +
" --no-doc Skip documentation generation\n" + " --no-doc Skip documentation generation\n" +
" --no-doc-force Generate documentation only for the pods that support it\n" +
" --no-doc-install Skip documentation installation to Xcode\n" + " --no-doc-install Skip documentation installation to Xcode\n" +
super super
end end
...@@ -30,7 +30,7 @@ module Pod ...@@ -30,7 +30,7 @@ module Pod
config.clean = !argv.option('--no-clean') config.clean = !argv.option('--no-clean')
config.doc = !argv.option('--no-doc') config.doc = !argv.option('--no-doc')
config.doc_install = !argv.option('--no-doc-install') config.doc_install = !argv.option('--no-doc-install')
config.doc_force = argv.option('--doc-force') config.doc_force = !argv.option('--no-doc-force')
@update_repo = !argv.option('--no-update') @update_repo = !argv.option('--no-update')
@projpath = argv.shift_argument @projpath = argv.shift_argument
super unless argv.empty? super unless argv.empty?
......
...@@ -54,13 +54,11 @@ module Pod ...@@ -54,13 +54,11 @@ module Pod
# If available specify the documentation sources. # If available specify the documentation sources.
# :html The online link for the documentation. # :html The online link for the documentation.
# :atom The atom link of the Xcode 4 compatible documentation set.
# :appledoc If the pod uses appledoc specify the options. The command # :appledoc If the pod uses appledoc specify the options. The command
# will be run on the files specified in s.source_file. # will be run on the files specified in s.source_file.
# #
s.documentation = { s.documentation = {
# :html => 'http://EXAMPLE/#{@name}/documentation', # :html => 'http://EXAMPLE/#{@name}/documentation',
# :atom => 'http://EXAMPLE/#{@name}/com.company.#{@name}.atom',
# :appledoc => ['--project-name', '#{@name}', # :appledoc => ['--project-name', '#{@name}',
# '--project-company', 'Company Name', # '--project-company', 'Company Name',
# '--company-id', 'com.company', # '--company-id', 'com.company',
......
...@@ -25,7 +25,7 @@ module Pod ...@@ -25,7 +25,7 @@ module Pod
@silent = false @silent = false
@doc = true @doc = true
@doc_install = true @doc_install = true
@doc_force = false @doc_force = true
end end
def project_root def project_root
......
...@@ -53,10 +53,9 @@ module Pod ...@@ -53,10 +53,9 @@ module Pod
downloader.download downloader.download
if config.doc? if config.doc?
doc_source = pod.generate_documentation(config.doc_install?, config.doc_force? ,config.verbose?) if pod.generate_documentation(config.doc_install?, config.doc_force? ,config.verbose?)
if doc_source
action = config.doc_install ? 'installed' : 'generated' action = config.doc_install ? 'installed' : 'generated'
puts " #{action} #{doc_source} documentation" unless config.silent? puts " #{action} documentation" unless config.silent?
end end
end end
......
...@@ -83,56 +83,43 @@ module Pod ...@@ -83,56 +83,43 @@ module Pod
# #
def generate_documentation(install, force = true, verbose = false) def generate_documentation(install, force = true, verbose = false)
documentation = specification.documentation ? specification.documentation : {} documentation = specification.documentation ? specification.documentation : {}
success = false
if force || documentation.has_key?(:appledoc) if force || documentation.has_key?(:appledoc)
`which appledoc` `which appledoc`
return nil unless $?.success? return nil unless $?.success?
dir = "#{@sandbox.root}/Documentation/#{name}/" dir = "#{@sandbox.root}/Documentation/#{name}/"
FileUtils.mkdir_p(dir) FileUtils.mkdir_p(dir)
# default options # default options
options = ['--project-name', specification.to_s, #inline spec may not have some fields like authors
'--project-company', specification.authors.keys.to_s, project_company = specification.authors ? specification.authors.keys.to_s : 'no-company-specified'
'--docset-copyright', "Generated by cocoapods (see #{specification.homepage} for copyright information).", options = ['--project-name', specification.to_s,
'--docset-desc', specification.description, '--project-company', project_company,
'--company-id', 'org.cocoapods', '--company-id', 'org.cocoapods',
'--ignore', '.m'] '--ignore', '.m']
# spec options options += ['--docset-copyright', "Generated by cocoapods (see #{specification.homepage} for copyright information)."] if specification.homepage
options += documentation[:appledoc] if documentation[:appledoc] options += ['--docset-desc', specification.description] if specification.description
# options that can't be overridden # spec options
options << '--no-create-docset' unless install options += documentation[:appledoc] if documentation[:appledoc]
options << '--keep-intermediate-files' # options that can't be overridden
options += ['--print-settings'] if verbose options << '--no-create-docset' unless install
options += ['--output', dir] options << '--keep-intermediate-files'
options += expanded_paths(specification.source_files, :glob => '*.{h,m,mm,c,cpp}', :relative_to_sandbox => false) options += ['--print-settings'] if verbose
success = false options += ['--output', dir]
Open3.popen3('appledoc', *options ) do |stdin, stdout, stderr| options += expanded_paths(specification.source_files, :glob => '*.{h,m,mm,c,cpp}', :relative_to_sandbox => false)
puts stdout.read.chomp if verbose Open3.popen3('appledoc', *options ) do |stdin, stdout, stderr|
puts stderr.read.chomp if verbose puts stdout.read.chomp if verbose
success = stderr.read.chomp == "" puts stderr.read.chomp if verbose
end # TODO: success test should be more robust
# TODO: should return nil if appledoc fails success = stderr.read.chomp == ""
return success ? 'appledoc' : nil
elsif documentation[:atom] && install
# TODO: donwload and uncompress the docset
# path =
#Open3.popen3('osascript') { |stdin, stdout, stderr|
#stdin.puts('tell application "Xcode"')
#stdin.puts("load documentation set with path \"#{path}\"")
#stdin.puts('end tell')
#stdin.close
#puts stdout.read.chomp if verbose
#puts stderr.read.chomp if verbose
#}
#return 'atom'
end end
return nil end
success
end end
def requires_arc? def requires_arc?
specification.requires_arc specification.requires_arc
end end
private private
def implementation_files def implementation_files
......
...@@ -283,22 +283,18 @@ describe "A Pod::Specification, in general," do ...@@ -283,22 +283,18 @@ describe "A Pod::Specification, in general," do
it "returns the documentation of the Pod" do it "returns the documentation of the Pod" do
@spec.documentation = { @spec.documentation = {
:html => 'http://EXAMPLE/#{@name}/documentation', :html => 'http://EXAMPLE/#{@name}/documentation',
:atom => 'http://EXAMPLE/#{@name}/com.company.#{@name}.atom',
:appledoc => ['--project-name', '#{@name}',
'--project-company', '"Company Name"',
'--company-id', 'com.company',
'--ignore', 'Common',
'--ignore', '.m']
}
@spec.documentation.should == {
:html => 'http://EXAMPLE/#{@name}/documentation',
:atom => 'http://EXAMPLE/#{@name}/com.company.#{@name}.atom',
:appledoc => ['--project-name', '#{@name}', :appledoc => ['--project-name', '#{@name}',
'--project-company', '"Company Name"', '--project-company', '"Company Name"',
'--company-id', 'com.company', '--company-id', 'com.company',
'--ignore', 'Common', '--ignore', 'Common',
'--ignore', '.m'] '--ignore', '.m']
} }
@spec.documentation[:html].should == 'http://EXAMPLE/#{@name}/documentation'
@spec.documentation[:appledoc].should == ['--project-name', '#{@name}',
'--project-company', '"Company Name"',
'--company-id', 'com.company',
'--ignore', 'Common',
'--ignore', '.m']
end end
it "takes a list of paths to clean" do it "takes a list of paths to clean" do
......
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