Class: OutsideLinksAction

Inherits:
BuildAction show all
Defined in:
lib/kwala/actions/outside_links.rb

Overview

Copyright © 2006, Ubiquitous Business Technology (ubit.com) All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
  copyright notice, this list of conditions and the following
  disclaimer in the documentation and/or other materials provided
  with the distribution.

* Neither the name of Ubit nor the names of its
  contributors may be used to endorse or promote products derived
  from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Author

Zev Blut ([email protected])

Constant Summary collapse

BASE_URL =
""

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BuildAction

command_line_action_name, command_line_action_names, create_action_from_command_line_name, #detailed_display, #score, summary_template_file

Methods included from InheritanceTracker

#get_implementors

Constructor Details

#initializeOutsideLinksAction

Returns a new instance of OutsideLinksAction.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/kwala/actions/outside_links.rb', line 45

def initialize
  no_http = Proc.new do |link, project_name|
    "#{BASE_URL}/#{link}/#{project_name}/"
  end
  http = Proc.new do |link, project_name|
    "#{link}/#{project_name}/"
  end

  @links = [
    ["rdocs", "Documentation", no_http],
    ["statcvs_output", "StatCVS", no_http],
    ["http://localhost/viewvc", "ViewVC", http],
    ["http://localhost/pragprog/data/rss", "CVS Commit RSS",
      Proc.new { |link, project_name|  "#{link}/#{project_name}.rss" }
    ]
  ]
end

Class Method Details

.detailed_template_fileObject



81
82
83
# File 'lib/kwala/actions/outside_links.rb', line 81

def self.detailed_template_file
  nil
end

Instance Method Details

#build_action(context) ⇒ Object



63
64
65
# File 'lib/kwala/actions/outside_links.rb', line 63

def build_action(context)
  #Do nothing
end

#summary_display(context) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/kwala/actions/outside_links.rb', line 67

def summary_display(context)
  template = TemplateFile.new(self.class.summary_template_file)
  context.amrita_data[:outside_links] = @links.map do |link, lname, action|
    {
      :item => Amrita::e(:h3) do
        url = action.call(link, context.project_name)
        Amrita::e(:a, :href => url) { lname }
      end
    }
  end

  summary_expand(template, context)
end