Browse files

Merge branch 'master' into hidden-setup

* master:
  [#184] fix for documentation options
  [#180] check appledoc exit status
  • Loading branch information...
2 parents 71dda87 + 18bc2ab commit 4ea808d5af4c39ce1a4b606ea4028a787268edd4 @fabiopelosin fabiopelosin committed Mar 23, 2012
Showing with 17 additions and 17 deletions.
  1. +1 −0 cocoapods.gemspec
  2. +16 −17 lib/cocoapods/generator/documentation.rb
View
1 cocoapods.gemspec
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
"you are upgrading, first run: $ pod setup"
s.add_runtime_dependency 'xcodeproj', '~> 0.1.0'
+ s.add_runtime_dependency 'popen4', '~> 0.1.2'
s.add_development_dependency 'bacon', '~> 1.1'
## Make sure you can build the gem on older versions of RubyGems too:
View
33 lib/cocoapods/generator/documentation.rb
@@ -1,4 +1,4 @@
-require 'open3'
+require 'open4'
module Pod
module Generator
@@ -15,7 +15,7 @@ def self.appledoc_installed?
def initialize(pod)
@pod = pod
@specification = pod.specification
- @target_path = pod.sandbox.root + "Documentation" + pod.name
+ @target_path = pod.sandbox.root + 'Documentation' + pod.name
@options = pod.specification.documentation || {}
end
@@ -36,7 +36,7 @@ def copyright
end
def description
- @specification.description || "Generated by CocoaPods."
+ @specification.description || 'Generated by CocoaPods.'
end
def docs_id
@@ -49,7 +49,7 @@ def files
def index_file
@pod.chdir do
- Dir.glob("README*", File::FNM_CASEFOLD).first
+ Dir.glob('README*', File::FNM_CASEFOLD).first
end
end
@@ -76,10 +76,12 @@ def generate(install = false)
puts "[!] Skipping documentation generation because appledoc can't be found." if config.verbose?
return
end
+
options = generate_appledoc_options
options += ['--output', @target_path.to_s]
options += ['--keep-intermediate-files']
- options += install ? ['-create-docset'] : ['--no-create-docset']
+ options += install ? ['--create-docset'] : ['--no-create-docset']
+
@target_path.mkpath
@pod.chdir do
appledoc(options)
@@ -91,22 +93,19 @@ def appledoc(options)
arguments += options
arguments += ['--print-settings'] if config.verbose?
arguments += files.map(&:to_s)
- Open3.popen3('appledoc', *arguments) do |i, o, e|
+
+ process = Open4.popen4('appledoc', *arguments) do |_, _, output, error|
if config.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.
- #
- # I think we can use the non-block version here, which should read
- # everything till the end and then return.
- o.read
- e.read
+ puts output.read.chomp
+ puts error.read.chomp
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

0 comments on commit 4ea808d

Please sign in to comment.