Sha256: fb23da78eccd037937a6780980c303a05469549809d63d72e746f7aacb8d205b

Contents?: true

Size: 1.89 KB

Versions: 2

Compression:

Stored size: 1.89 KB

Contents

module Reap

  # = Doap task
  # 
  # This task  simply generates an XML DOAP project file.
  # This file can be useful for RSS and Atom feeds to 
  # project tracking sites. The task utilizes as much
  # information as it can from the ProjectInfo file.
  #

  class Doap < Task

    task_desc %{Generate DOAP project file.}

    task_help %{

      reap doap

      DOAP is an XML/RTF format for describing a project. It contains
      much of the same information as Reap's ProjectInfo file, but is
      more suitable to RESTful interapplication communications, like 
      RSS/Atom feeds.

    }

    alias_method :prj, :task

    def run

      puts "Generating doap.xml file..."

      x = ''
      x << %{
            |<Project xmlns="http://usefulinc.com/ns/doap#"\n
            |         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n
            |         xmlns:foaf="http://xmlns.com/foaf/0.1/">
            |   <name>#{prj.title}</name>
            |   <shortname>#{prj.name}</shortname>
            |   <homepage rdf:resource="#{prj.homepage}" />
            |   <wiki rdf:resource="#{prj.wiki}" />
            |   <created>#{prj.created}</created>
            |   <shortdesc xml:lang="en">
            }.margin
      x << "\n" << prj.summary.word_wrap(50).indent(6)
      x << %{
            |   </shortdesc>
            |   <description xml:lang="en">
            }.margin
      x << "\n" << prj.description.word_wrap(50).indent(6)
      x << %{
            |   </description>
            |   <maintainer>
            |     <foaf:Person>
            |       <foaf:name>#{prj.maintainer}</foaf:name>
            |       <foaf:email>#{prj.email}</foaf:name>
            |       <foaf:homepage rdf:resource="#{prj.homepage}" />
            |     </foaf:Person>
            |   </maintainer>
            | </Project>
            }.margin

      File.open( "doap.xml", 'w' ) { |f| f << x }

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reap-4.4.0 lib/reap/task/doap.rb
reap-4.4.1 lib/reap/task/doap.rb