yeah, the namespacing thing is what I'm trying to take advantage of. I also spent about 2 hours today going through the capistrano code trying to figure out if there was some way I could access the roles that are getting passed to the task so I could call something like:
ENV['HOSTS'] = this_tasks_roles What I'm going to have to do is have 2 tasks that are identical except for their names and roles. It's not gonna be very DRY and it's not gonna be very pretty, but it'll work and the interface will be prettier than passing HOSTS on the commandline. I just wish there was a way of calling a task from the context of another task so it uses the same roles as the calling task. Thanks. ...spike On Jun 19, 5:30 pm, Jamie Orchard-Hays <[EMAIL PROTECTED]> wrote: > I have an old cap 1.4.1 script that I used like this: > > if ENV['DEPLOY'] == 'production' > puts "*** Deploying to the PRODUCTION servers!" > set :application, "production-web" > set :rails_env, "production" > set :mongrel_port, "8000" > set :mongrel_environment, "production" > else > puts "*** Deploying to the STAGING server!" > set :application, "staging-web" > set :rails_env, "staging" > set :mongrel_port, "8010" > set :mongrel_environment, "staging" > end > > But with the namespacing in Cap 2, seems like you could just define > this stuff inside your namespace: > > namespace :deploy do > namespace :production do > # set your environment here > # reference original tasks here your tasks here > end > end > > I'm not sure it's worth the work. With the environment variable, you > just call that before you call your cap tasks on the command line. In > my original scheme, I have staging be default, then production doesn't > get deployed to accidentally. > > Jamie > On Jun 19, 2008, at 2:55 PM, spike grobstein wrote: > > > > > Hi, > > > I'm using capistrano to deploy [non-rails] applications to our server > > environment. Because our SVN server lives on the LAN, but the entire > > application environment lives on a separate private network accessible > > only through a gateway machine, capistrano is an ideal tool for > > pushing updates to the various applications. > > > I'm running into an issue where I have a task that I want to call but > > on different hosts (ie: deploying to our staging and production > > servers). Right now, I'm doing it like this: > > > cap deploy:my_app HOSTS="production1.server.com" > > > however, I'd much prefer to call it like this: > > > cap deploy:my_app:production > > or > > cap deploy:my_app:staging > > > I created 2 tasks, one for staging and one for production, each with > > their roles set appropriately, and each calling a "deploy_my_app" > > task, but it tries to deploy the app to all servers. > > > Is there a way to call deploy_my_app, but only have it execute on the > > servers with the roles defined in the calling task? I can't use > > "ENV['HOSTS'] = :production", since it requires that I supply it with > > a hostname/FQDN rather than a symbol referencing it. > > > any help? > > > tia. > > > ...spike --~--~---------~--~----~------------~-------~--~----~ To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/capistrano -~----------~----~----~----~------~----~------~--~---
