Changeset 82

Show
Ignore:
Timestamp:
02/11/08 18:22:38 (9 months ago)
Author:
jweiss
Message:

offer all tasks on deployment, filter shell and invoke tasks

Location:
trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/controllers/stages_controller.rb

    r79 r82  
    77  def show 
    88    @stage = current_project.stages.find(params[:id]) 
     9    @task_list = [['All tasks: ', '']] + @stage.list_tasks.collect{|x| [x.first, x.first]}.sort 
    910 
    1011    respond_to do |format| 
  • trunk/app/models/stage.rb

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

    r73 r82  
    33 
    44<div class="special_box deployments_box"> 
    5    <p><%= link_to 'Deploy', new_project_stage_deployment_path(current_project, @stage) + '?task=deploy', :class => 'arrow_link_big' %></p> 
     5   <p><%= link_to 'Deploy', new_project_stage_deployment_path(current_project, @stage) + '?task=deploy', :class => 'arrow_link' %></p> 
    66   <p><%= link_to 'Deploy and migrate', new_project_stage_deployment_path(current_project, @stage) + '?task=deploy:migrations', :class => 'arrow_link' %></p> 
    77   <p><%= link_to 'Restart App Servers', new_project_stage_deployment_path(current_project, @stage) + '?task=deploy:restart', :class => 'arrow_link' %></p> 
    8    <p><%= link_to 'Rollback to previous', new_project_stage_deployment_path(current_project, @stage) + '?task=deploy:rollback', :class => 'arrow_link' %></p> 
    98   <p><%= link_to 'Setup', new_project_stage_deployment_path(current_project, @stage) + '?task=deploy:setup', :class => 'arrow_link' %></p> 
    10    <p><%= link_to 'List all available tasks', tasks_project_stage_path(current_project, @stage), :class => 'arrow_link' %></p> 
     9   <p> 
     10     <%= select_tag('task', options_for_select(@task_list)) %> 
     11   </p> 
     12   <p> 
     13     <%= link_to 'Execute', new_project_stage_deployment_path(current_project, @stage), :class => 'arrow_link',  
     14         :onclick => "location.href='#{new_project_stage_deployment_path(current_project, @stage)}?task=' + $F('task'); return false" %> | 
     15     <%= link_to 'Info', tasks_project_stage_path(current_project, @stage), :class => 'arrow_link', 
     16         :onclick => "location.href='#{tasks_project_stage_path(current_project, @stage)}#' + $F('task'); return false" %> 
     17   </p> 
    1118</div> 
    1219 
  • trunk/app/views/stages/tasks.html.erb

    r73 r82  
    66    <% @tasks.sort.each do |key, value| %> 
    77        <tr> 
    8         <td valign="top"><%= link_to key, new_project_stage_deployment_path(current_project, @stage) + "?task=#{key}"%></td> 
    9         <td valign="top"><%= simple_format value %></td> 
     8        <td valign="top"><%= link_to key, new_project_stage_deployment_path(current_project, @stage) + "?task=#{key}", :class => 'arrow_link', :name => h(key)%></td> 
     9        <td>&nbsp;&nbsp;</td> 
     10          <td valign="top"><%= simple_format value %></td> 
    1011        </tr> 
    1112    <% end %> 
     
    1314 
    1415</fieldset> 
     16 
     17<br /> 
     18<%= link_to 'Back', project_stage_path(@project, @stage), :class => 'arrow_link'  %> 
  • trunk/test/unit/webistrano_deployer_test.rb

    r34 r82  
    681681    assert_not_nil deployer.list_tasks 
    682682    assert_equal 23, deployer.list_tasks.size 
    683     assert_equal 23, @stage.list_tasks.size 
     683    assert_equal 21, @stage.list_tasks.size # filter shell and invoke 
    684684    deployer.list_tasks.each{|t| assert t.is_a?(Capistrano::TaskDefinition) } 
    685685     
     
    696696         
    697697    assert_equal 24, deployer.list_tasks.size 
    698     assert_equal 24, @stage.list_tasks.size 
     698    assert_equal 22, @stage.list_tasks.size # filter shell and invoke 
    699699    assert_equal 1, deployer.list_tasks.delete_if{|t| t.fully_qualified_name != 'foo:bar'}.size 
    700700    assert_equal 1, @stage.list_tasks.delete_if{|t| t[0] != 'foo:bar'}.size