Changeset 106

Show
Ignore:
Timestamp:
05/15/08 21:52:26 (6 months ago)
Author:
jweiss
Message:

fix #81 - Fix XML output of stage tasks

Location:
trunk
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/CHANGELOG.txt

    r105 r106  
    11 
    22SVN 
     3 
     4* Fix XML output of stage tasks. Provided by Mathias Meyer 
    35 
    46* Add version info XML action. Provided by Mathias Meyer 
  • trunk/app/controllers/stages_controller.rb

    r96 r106  
    1111  end 
    1212 
     13  def index 
     14    @stages = current_project.stages.find(:all) 
     15    respond_to do |format| 
     16      format.xml { render :xml => @stages.to_xml} 
     17    end 
     18  end 
    1319  # GET /projects/1/stages/1 
    1420  # GET /projects/1/stages/1.xml 
    1521  def show 
    1622    @stage = current_project.stages.find(params[:id]) 
    17     @task_list = [['All tasks: ', '']] + @stage.list_tasks.collect{|x| [x.first, x.first]}.sort 
     23    @task_list = [['All tasks: ', '']] + @stage.list_tasks.collect{|task| [task[:name], task[:name]]}.sort() 
    1824 
    1925    respond_to do |format| 
  • trunk/app/models/stage.rb

    r82 r106  
    124124    d.stage = self 
    125125    deployer = Webistrano::Deployer.new(d) 
    126     deployer.list_tasks.collect { |t| [t.fully_qualified_name, t.description] }.delete_if{|x| x.first == 'shell' || x.first == 'invoke'} 
     126    deployer.list_tasks.collect { |t| {:name => t.fully_qualified_name, :description => t.description} }.delete_if{|t| t[:name] == 'shell' || t[:name] == 'invoke'} 
    127127  end 
    128128   
  • trunk/app/views/stages/tasks.html.erb

    r82 r106  
    44  <legend>All Tasks</legend> 
    55    <table> 
    6     <% @tasks.sort.each do |key, value| %> 
     6    <% @tasks.sort{|a, b| a[:name] <=> b[:name]}.each do |task| %> 
    77        <tr> 
    8         <td valign="top"><%= link_to key, new_project_stage_deployment_path(current_project, @stage) + "?task=#{key}", :class => 'arrow_link', :name => h(key)%></td> 
     8        <td valign="top"><%= link_to task[:name], new_project_stage_deployment_path(current_project, @stage) + "?task=#{task[:name]}", :class => 'arrow_link', :name => h(task[:name])%></td> 
    99        <td>&nbsp;&nbsp;</td> 
    10           <td valign="top"><%= simple_format value %></td> 
     10          <td valign="top"><%= simple_format task[:description] %></td> 
    1111        </tr> 
    1212    <% end %> 
  • trunk/test/functional/stages_controller_test.rb

    r96 r106  
    107107  end 
    108108   
     109  def test_should_render_xml_for_stage_tasks 
     110    get :tasks, :id => @stage.id, :project_id => @project.id, :format => "xml" 
     111    assert_response :success 
     112    assert_match /webistrano:mongrel:start/, @response.body 
     113  end 
     114   
    109115  def test_index 
    110116    get :index, :project_id => @project.id, :format => 'xml' 
  • trunk/test/unit/webistrano_deployer_test.rb

    r89 r106  
    753753    assert_equal 22, @stage.list_tasks.size # filter shell and invoke 
    754754    assert_equal 1, deployer.list_tasks.delete_if{|t| t.fully_qualified_name != 'foo:bar'}.size 
    755     assert_equal 1, @stage.list_tasks.delete_if{|t| t[0] != 'foo:bar'}.size 
     755    assert_equal 1, @stage.list_tasks.delete_if{|t| t[:name] != 'foo:bar'}.size 
    756756  end 
    757757