<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -21,7 +21,7 @@ Capistrano::Configuration.instance(:must_exist).load do
       # Install 
       
       desc &quot;Install mongrel&quot;
-      task :install do
+      task :install, :roles =&gt; :app do
         gem2.install 'mongrel'
         gem2.install 'mongrel_cluster'
         gem2.install 'swiftiply'
@@ -32,11 +32,11 @@ Capistrano::Configuration.instance(:must_exist).load do
         activate_system
       end
       
-      task :symlink_mongrel_rails do
+      task :symlink_mongrel_rails, :roles =&gt; :app do
         sudo &quot;ln -sf /usr/local/bin/mongrel_rails /usr/bin/mongrel_rails&quot;
       end
       
-      task :symlink_logrotate_config do
+      task :symlink_logrotate_config, :roles =&gt; :app do
         sudo &quot;ln -sf #{deploy_to}/mongrel/logrotate.conf /etc/logrotate.d/mongrel-#{application}&quot;
       end
     </diff>
      <filename>lib/deprec/recipes/mongrel.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,13 +6,13 @@ Capistrano::Configuration.instance(:must_exist).load do
       # Installation
       
       desc &quot;Install mysql&quot;
-      task :install do
+      task :install, :roles =&gt; :db do
         install_deps
         # symlink_mysql_sockfile # XXX still needed?
       end
       
       # Install dependencies for Mysql
-      task :install_deps do
+      task :install_deps, :roles =&gt; :db do
         apt.install( {:base =&gt; %w(mysql-server mysql-client)}, :stable )
       end
       </diff>
      <filename>lib/deprec/recipes/mysql.rb</filename>
    </modified>
    <modified>
      <diff>@@ -17,7 +17,7 @@ Capistrano::Configuration.instance(:must_exist).load do
       }
 
       desc &quot;Install nginx&quot;
-      task :install do
+      task :install, :roles =&gt; :web do
         install_deps
         deprec2.download_src(SRC_PACKAGES[:nginx], src_dir)
         deprec2.install_from_src(SRC_PACKAGES[:nginx], src_dir)
@@ -30,12 +30,12 @@ Capistrano::Configuration.instance(:must_exist).load do
       end
 
       # install dependencies for nginx
-      task :install_deps do
+      task :install_deps, :roles =&gt; :web do
         apt.install( {:base =&gt; %w(libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev)}, :stable )
         # do we need libgcrypt11-dev?
       end
 
-      task :create_nginx_user do
+      task :create_nginx_user, :roles =&gt; :web do
         deprec2.groupadd(nginx_group)
         deprec2.useradd(nginx_user, :group =&gt; nginx_group, :homedir =&gt; false)
       end
@@ -84,11 +84,11 @@ Capistrano::Configuration.instance(:must_exist).load do
       Activate nginx start scripts on server.
       Setup server to start nginx on boot.
       DESC
-      task :activate do
+      task :activate, :roles =&gt; :web do
         activate_system
       end
 
-      task :activate_system do
+      task :activate_system, :roles =&gt; :web do
         send(run_method, &quot;update-rc.d nginx defaults&quot;)
       end
 
@@ -96,7 +96,7 @@ Capistrano::Configuration.instance(:must_exist).load do
       Dectivate nginx start scripts on server.
       Setup server to start nginx on boot.
       DESC
-      task :deactivate do
+      task :deactivate, :roles =&gt; :web do
         send(run_method, &quot;update-rc.d -f nginx remove&quot;)
       end
 </diff>
      <filename>lib/deprec/recipes/nginx.rb</filename>
    </modified>
    <modified>
      <diff>@@ -90,7 +90,7 @@ Capistrano::Configuration.instance(:must_exist).load do
         install_stack
       end
       
-      task :install_gems_for_project do
+      task :install_gems_for_project, :roles =&gt; :app do
           if gems_for_project
             gems_for_project.each { |gem| gem2.install(gem) }
           end
@@ -122,23 +122,23 @@ Capistrano::Configuration.instance(:must_exist).load do
         deprec2.push_configs(:nginx, PROJECT_CONFIG_FILES[:nginx])
         top.deprec.mongrel.config_project
         symlink_nginx_vhost
-        symlink_logrotate_config
+        symlink_nginx_logrotate_config
       end
 
       task :symlink_nginx_vhost, :roles =&gt; :web do
         sudo &quot;ln -sf #{deploy_to}/nginx/rails_nginx_vhost.conf #{nginx_vhost_dir}/#{application}.conf&quot;
       end
       
-      task :symlink_logrotate_config, :roles =&gt; :web do
+      task :symlink_nginx_logrotate_config, :roles =&gt; :web do
         sudo &quot;ln -sf #{deploy_to}/nginx/logrotate.conf /etc/logrotate.d/nginx-#{application}&quot;
       end
 
-      task :create_config_dir do
+      task :create_config_dir, :roles =&gt; :app do
         deprec2.mkdir(&quot;#{shared_path}/config&quot;, :group =&gt; group, :mode =&gt; 0775, :via =&gt; :sudo)
       end
       
       desc &quot;Create deployment group and add current user to it&quot;
-      task :setup_user_perms do
+      task :setup_user_perms, :roles =&gt; [:app, :web] do
         deprec2.groupadd(group)
         deprec2.add_user_to_group(user, group)
         deprec2.groupadd(mongrel_group)
@@ -160,7 +160,7 @@ Capistrano::Configuration.instance(:must_exist).load do
       end
 
       # setup extra paths required for deployment
-      task :setup_paths, :roles =&gt; :app do
+      task :setup_paths, :roles =&gt; [:app, :web] do
         deprec2.mkdir(deploy_to, :mode =&gt; 0775, :group =&gt; group, :via =&gt; :sudo)
         deprec2.mkdir(shared_path, :mode =&gt; 0775, :group =&gt; group, :via =&gt; :sudo)
       end
@@ -285,4 +285,4 @@ Capistrano::Configuration.instance(:must_exist).load do
 
   end
   
-end
\ No newline at end of file
+end</diff>
      <filename>lib/deprec/recipes/rails.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>4551d7db8b9fbc34f2fbf14e5fb7239adb69aefa</id>
    </parent>
  </parents>
  <author>
    <name>Mike Bailey</name>
    <email>mike@bailey.net.au</email>
  </author>
  <url>http://github.com/mbailey/deprec/commit/d103dda7ee3f7696007d230c76c7739dd57115ec</url>
  <id>d103dda7ee3f7696007d230c76c7739dd57115ec</id>
  <committed-date>2008-09-04T00:09:30-07:00</committed-date>
  <authored-date>2008-09-04T00:09:30-07:00</authored-date>
  <message>Restricted tasks to roles.

I like restricting tasks to roles, partly out of laziness. I don't need
to specify HOSTS or ROLES on the command line as long as I've defined
the relevant roles somewhere. It also provides a safety net. Without
specifying HOSTS or ROLES on the command line, a task will get run on
*all* defined hosts. This can be avoided by restricting the tasks
themselves in deprec.

A problem with restricting tasks to roles in deprec was that Capistrano
complained when I ran a task in an ad-hoc manner without any hosts being
defined for the roles it was restricted to.

Sometimes I want to run a task on hosts but don't want to add them to
a deploy.rb. Editing a file just to use a command line is extra work!

e.g. cap deprec:mysql:install HOSTS=foo,bar

This problem caused me to remove a lot of role restrictions from deprec
over the last year or so.

My Capistrano patch (included in capistrano-2.5.0) causes Capistrano
to not complain about an undefined role if HOSTS or ROLES are specified
on the command line.

http://github.com/jamis/capistrano/commit/8badb0c522b38fae9cbe973451472afbddef61cb

So, I'm putting the roles back in.

- Mike</message>
  <tree>a374e78d6debd6115c99d6f4f919363e4f170d8b</tree>
  <committer>
    <name>Mike Bailey</name>
    <email>mike@bailey.net.au</email>
  </committer>
</commit>
