Sha256: f44f33e81519d9a7f2c32922d86129a346d2e6b701f3c6bb3aa702d979603966

Contents?: true

Size: 1.38 KB

Versions: 20

Compression:

Stored size: 1.38 KB

Contents

module Distil

  JSDOC_COMMAND= "#{VENDOR_DIR}/jsdoc-toolkit/jsrun.sh"
  
  class JavascriptDocProduct < Product

    option :jsdoc_conf, "#{LIB_DIR}/jsdoc.conf"
    option :jsdoc_template, "#{VENDOR_DIR}/jsdoc-extras/templates/coherent"
    option :jsdoc_plugins, "#{VENDOR_DIR}/jsdoc-extras/plugins"
    option :doc_folder, Interpolated, "$(path)/doc"

    extension "js"
    
    def filename
      File.join(doc_folder, 'index.html')
    end
    
    def write_output
      return if up_to_date
      @up_to_date= true
      
      return if (!File.exists?(JSDOC_COMMAND))

      tmp= Tempfile.new("jsdoc.conf")
    
      template= File.read(jsdoc_conf)
      doc_files= []
      
      files.each { |f|
        next if !handles_file?(f)
        p= f.file_path || f.to_s
        doc_files << "\"#{p}\""
      }

      conf= replace_tokens(template, {
                      "DOC_FILES"=>doc_files.join(",\n"),
                      "DOC_OUTPUT_DIR"=>doc_folder,
                      "DOC_TEMPLATE_DIR"=>jsdoc_template,
                      "DOC_PLUGINS_DIR"=>jsdoc_plugins
                  })

      tmp << conf
      tmp.close()
    
      command= "#{JSDOC_COMMAND} -c=#{tmp.path}"
    
      stdin, stdout, stderr= Open3.popen3(command)
      stdin.close
      output= stdout.read
      errors= stderr.read

      tmp.delete
    
      puts errors
      puts output
      
    end
    
  end
  
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
distil-0.13.6 lib/distil/product/javascript-doc-product.rb
distil-0.13.5 lib/distil/product/javascript-doc-product.rb
distil-0.13.4 lib/distil/product/javascript-doc-product.rb
distil-0.13.3 lib/distil/product/javascript-doc-product.rb
distil-0.13.2 lib/distil/product/javascript-doc-product.rb
distil-0.13.1 lib/distil/product/javascript-doc-product.rb
distil-0.13.0 lib/distil/product/javascript-doc-product.rb
distil-0.12.6 lib/distil/product/javascript-doc-product.rb
distil-0.12.4 lib/distil/product/javascript-doc-product.rb
distil-0.12.3 lib/distil/product/javascript-doc-product.rb
distil-0.12.2 lib/distil/product/javascript-doc-product.rb
distil-0.12.1 lib/distil/product/javascript-doc-product.rb
distil-0.12.0 lib/distil/product/javascript-doc-product.rb
distil-0.11.8 lib/distil/product/javascript-doc-product.rb
distil-0.11.6 lib/distil/product/javascript-doc-product.rb
distil-0.11.5 lib/distil/product/javascript-doc-product.rb
distil-0.11.4 lib/distil/product/javascript-doc-product.rb
distil-0.11.3 lib/distil/product/javascript-doc-product.rb
distil-0.11.1 lib/distil/product/javascript-doc-product.rb
distil-0.11.0 lib/distil/product/javascript-doc-product.rb