title: Can mixins be used to reduce redundancy in Rake files?
body: <p>I have a Rakefile with 5 different namespaces, each with the same 6 method signatures. The bodies of each signature are exactly the same. They differ only in the values of the instance variables that the methods use.</p>
  
  <p>A concrete example:</p>
  
  <pre><code>namespace :db do
    namespace :foo do
      @user = "foo"
      task :create do
        function_call_to_do_stuff @user
      end
    end
  
    namespace :bar do
      @user = "bar"
      task :create do
        function_call_to_do_stuff @user
      end
    end
  end
  </code></pre>
  
  <p>Ideally, I'd like to be able to do something like this:</p>
  
  <pre><code>module Migratable
    task :create do
      function_call_to_do_stuff @user
    end
  end
  
  namespace :db do
    namespace :foo do
      include Migratable
      @user = "foo"
    end
  
    namespace :bar do
      include Migratable
      @user = "bar"
    end
  end
  </code></pre>
  
  <p>When I do what is shown above, the tasks in the mixin don't register as tasks for the appropriate namespaces - or as tasks at all for that matter. Is there a way to accomplish this?</p>