Commit 4ea808d5 authored by Fabio Pelosin's avatar Fabio Pelosin

Merge branch 'master' into hidden-setup

* master:
  [#184] fix for documentation options
  [#180] check appledoc exit status
parents 71dda87d 18bc2ab8
...@@ -29,6 +29,7 @@ Gem::Specification.new do |s| ...@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
"you are upgrading, first run: $ pod setup" "you are upgrading, first run: $ pod setup"
s.add_runtime_dependency 'xcodeproj', '~> 0.1.0' s.add_runtime_dependency 'xcodeproj', '~> 0.1.0'
s.add_runtime_dependency 'popen4', '~> 0.1.2'
s.add_development_dependency 'bacon', '~> 1.1' s.add_development_dependency 'bacon', '~> 1.1'
## Make sure you can build the gem on older versions of RubyGems too: ## Make sure you can build the gem on older versions of RubyGems too:
......
require 'open3' require 'open4'
module Pod module Pod
module Generator module Generator
...@@ -15,7 +15,7 @@ module Pod ...@@ -15,7 +15,7 @@ module Pod
def initialize(pod) def initialize(pod)
@pod = pod @pod = pod
@specification = pod.specification @specification = pod.specification
@target_path = pod.sandbox.root + "Documentation" + pod.name @target_path = pod.sandbox.root + 'Documentation' + pod.name
@options = pod.specification.documentation || {} @options = pod.specification.documentation || {}
end end
...@@ -36,7 +36,7 @@ module Pod ...@@ -36,7 +36,7 @@ module Pod
end end
def description def description
@specification.description || "Generated by CocoaPods." @specification.description || 'Generated by CocoaPods.'
end end
def docs_id def docs_id
...@@ -49,7 +49,7 @@ module Pod ...@@ -49,7 +49,7 @@ module Pod
def index_file def index_file
@pod.chdir do @pod.chdir do
Dir.glob("README*", File::FNM_CASEFOLD).first Dir.glob('README*', File::FNM_CASEFOLD).first
end end
end end
...@@ -76,10 +76,12 @@ module Pod ...@@ -76,10 +76,12 @@ module Pod
puts "[!] Skipping documentation generation because appledoc can't be found." if config.verbose? puts "[!] Skipping documentation generation because appledoc can't be found." if config.verbose?
return return
end end
options = generate_appledoc_options options = generate_appledoc_options
options += ['--output', @target_path.to_s] options += ['--output', @target_path.to_s]
options += ['--keep-intermediate-files'] options += ['--keep-intermediate-files']
options += install ? ['-create-docset'] : ['--no-create-docset'] options += install ? ['--create-docset'] : ['--no-create-docset']
@target_path.mkpath @target_path.mkpath
@pod.chdir do @pod.chdir do
appledoc(options) appledoc(options)
...@@ -91,22 +93,19 @@ module Pod ...@@ -91,22 +93,19 @@ module Pod
arguments += options arguments += options
arguments += ['--print-settings'] if config.verbose? arguments += ['--print-settings'] if config.verbose?
arguments += files.map(&:to_s) arguments += files.map(&:to_s)
Open3.popen3('appledoc', *arguments) do |i, o, e|
process = Open4.popen4('appledoc', *arguments) do |_, _, output, error|
if config.verbose? if config.verbose?
puts o.read.chomp puts output.read.chomp
puts e.read.chomp puts error.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.
#
# I think we can use the non-block version here, which should read
# everything till the end and then return.
o.read
e.read
end
end end
end end
# appledoc exits with 1 if a warning was logged
if (process.exitstatus >= 2) && !config.silent?
puts "[!] Appledoc encountered an error. Run 'pod install --verbose' for details."
end
end
end end
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