Class: Reap::Doap

Inherits:
Task
  • Object
show all
Defined in:
lib/reap/task/doap.rb

Overview

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.

Constant Summary

Constants inherited from Task

Task::RUBY

Instance Method Summary collapse

Methods inherited from Task

#ask, #execute, inherited, #initialize, #initiate, master, #master, #provide_setup_rb, #section, section_required, section_required?, #section_required?, #sh, #task, task_attr, #task_desc, task_desc, #task_help, task_help, task_list, #task_name, task_name, #tell, #use_subsection, verify?

Constructor Details

This class inherits a constructor from Reap::Task

Instance Method Details

#runObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/reap/task/doap.rb', line 29

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