Sha256: 1a7f4b412eb3f72c5c94d312ee9a8c87e9ab69210f0060d46e0785307cb6e7a3

Contents?: true

Size: 1.71 KB

Versions: 1

Compression:

Stored size: 1.71 KB

Contents

module Reap

  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.

    }

    task_attr :prj

    # Setup doap data

    def init

    end

    # Generate doap file

    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

1 entries across 1 versions & 1 rubygems

Version Path
reap-4.3.4 lib/reap/task/doap.rb