That's pretty much what I just said. :) The current behavior is what you wrote in your first example, and which I suggested could be made to work as people would expect. However, it might, indeed, be naive of you to assume that no one depends on that behavior, which is why I suggested the second option (a "load_into_namespace" method).

Note, though, that this "fix" might be a lot less trivial than it sounds, because variables in Capistrano are _not_ namespaced, and changing that assumption will have significant repercussions.

This is a real edge-case, though--I've never heard of anyone needing this behavior until Adam requested it. (Not to trivialize Adam's needs, just saying that it's not a common requirement.) Therefore, it might actually be easiest (I use that term extremely loosely) for Adam to write a custom set of deployment tasks. Custom deployment tasks are entirely valid, and are not as hard to write as you might think (especially if you're writing them specifically for your own situation).

- Jamis

On Apr 10, 2008, at 11:14 AM, David Masover wrote:
Could also simply load it into the :some_app namespace -- that is, make it 'some_app:deploy'. Is it naive of me to assume no one would depend on something like:

namespace :my_app do
  load 'deploy'
end

task :not_in_my_app do
  deploy.symlink
end

after :not_in_my_app, 'deploy:web:enable'


I would expect the more common case, which should still work, is something like:

namespace :my_app do
  load 'deploy'

  task :in_my_app do
    deploy.symlink
  end
  after :in_my_app, 'deploy:web:enable'
end


(These are contrived examples, by the way.)

On Thu, Apr 10, 2008 at 11:30 AM, Jamis Buck <[EMAIL PROTECTED]> wrote: I wonder if it wouldn't be better to make something like the following work as you would expect:

 namespace :some_app do
   load 'deploy'
 end

I suppose there is a risk of that breaking existing scripts that depend on the current behavior, though. Could possibly introduce another keyword:

 namespace :some_app do
   load_into_namespace 'deploy'
 end

I don't like 'load_into_namespace', but that's just a matter of finding a better name. If someone were to whip up a patch, I'd consider it.

- Jamis


On Apr 10, 2008, at 10:14 AM, Adam Keys wrote:

On Apr 8, 2008, at 11:24 AM, Erik Hollensbe wrote:


Why not require them in the main capfile? (Use Dir[] to iterate over
them if you have to), they could inject their namespaces themselves.

should create a global cap -T listing as well.


Yeah, that's the first thing I tried. However, the standard Capistrano
recipe for Rails defines everything in the deploy namespace. I could
fork the deploy recipe from Capistrano, but that makes me sad.

Jamis, would you accept a patch that optionally defines the standard
deploy recipes in a namespace? For instance:

set :deploy_namespace, 'some_app'

load 'deploy'

$ cap some_app:update some_app:deploy:restart

--
~akk
http://therealadam.com






--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---


Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to