I have a few projects with large directories (say, user-uploaded files) that make using Capistrano a bit awkward. However, I suspect that I may have reached the "write a custom task" level. (I suppose I''m just thinking out loud, here...) It seems as though I''d want this directories symlinked in /shared... Maybe there''s a way to extend the ''symlink'' task to do this... ? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060425/b36f0d80/attachment.html
This might help, I didn''t want to store a rails version in svn or to make my deployment dependent on the rails site being up. Therefore, I checked out rails 1.1.1, and created a directory called rel_1-1-1 under my home directory. Then I created this simple task below to create a symlink whenever it is deploying. I placed this code into the deploy.rb file. desc "Symlink Rails to version 1.1" task :add_symlink_to_rails, :roles => :web do run "ln -s ~/rails/rel_1-1-1/ #{release_path}/vendor/rails" end I also modified the long_deploy task to run this custom task right after the symlink task. desc "A task demonstrating the use of transactions." task :long_deploy do transaction do update_code disable_web symlink add_symlink_to_rails migrate end restart enable_web end Hope this helps! -----Original Message----- From: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org]On Behalf Of Josh on Rails Sent: Tuesday, April 25, 2006 7:27 AM To: rails@lists.rubyonrails.org Subject: [Rails] Symlinks in Capistrano? I have a few projects with large directories (say, user-uploaded files) that make using Capistrano a bit awkward. However, I suspect that I may have reached the "write a custom task" level. (I suppose I''m just thinking out loud, here...) It seems as though I''d want this directories symlinked in /shared... Maybe there''s a way to extend the ''symlink'' task to do this... ? Please see the following link for the BlueCross BlueShield of Tennessee E-mail disclaimer: http://www.bcbst.com/email_disclaimer.shtm -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060425/b7382bbb/attachment.html
you can also create an after_deploy task as part of your deploy.rb. it will run automatically at the end of the defauly deploy task. (and perhaps the others as well? not sure...) This would be similar to what''s shown above, but perhaps a little simpler if your needs aren''t as complex. I do this to seperate my static html into shared. task :after_deploy do run "ln -s #{shared_path}/pages #{releases_path}/public/pages" end either will work... My needs are simpler, and perhaps yours are as well ;) Matt On 4/25/06, Campano, David <David_Campano@bcbst.com> wrote:> > This might help, I didn''t want to store a rails version in svn or to make > my deployment dependent on the rails site being up. Therefore, I checked > out rails 1.1.1, and created a directory called rel_1-1-1 under my home > directory. Then I created this simple task below to create a symlink > whenever it is deploying. I placed this code into the deploy.rb file. > > desc "Symlink Rails to version 1.1" > task :add_symlink_to_rails, :roles => :web do > run "ln -s ~/rails/rel_1-1-1/ #{release_path}/vendor/rails" > end > > I also modified the long_deploy task to run this custom task right after > the symlink task. > > desc "A task demonstrating the use of transactions." > task :long_deploy do > transaction do > update_code > disable_web > symlink > add_symlink_to_rails > migrate > end > > restart > enable_web > end > > Hope this helps! > > -----Original Message----- > *From:* rails-bounces@lists.rubyonrails.org [mailto: > rails-bounces@lists.rubyonrails.org]*On Behalf Of *Josh on Rails > *Sent:* Tuesday, April 25, 2006 7:27 AM > *To:* rails@lists.rubyonrails.org > *Subject:* [Rails] Symlinks in Capistrano? > > I have a few projects with large directories (say, user-uploaded files) > that make using Capistrano a bit awkward. However, I suspect that I may have > reached the "write a custom task" level. > > (I suppose I''m just thinking out loud, here...) > > It seems as though I''d want this directories symlinked in /shared... Maybe > there''s a way to extend the ''symlink'' task to do this... ? > > Please see the following link for the BlueCross BlueShield of Tennessee E-mail > disclaimer: http://www.bcbst.com/email_disclaimer.shtm > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060425/a98fe69a/attachment-0001.html
whoops. noticed an error. should be: run "ln -s #{shared_path}/pages #{release_path}/public/pages" On 4/25/06, Matt White <stockliasteroid@gmail.com> wrote:> > you can also create an after_deploy task as part of your deploy.rb. it > will run automatically at the end of the defauly deploy task. (and perhaps > the others as well? not sure...) This would be similar to what''s shown > above, but perhaps a little simpler if your needs aren''t as complex. I do > this to seperate my static html into shared. > > task :after_deploy do > run "ln -s #{shared_path}/pages #{releases_path}/public/pages" > end > > either will work... My needs are simpler, and perhaps yours are as well ;) > > Matt > > On 4/25/06, Campano, David <David_Campano@bcbst.com> wrote: > > > This might help, I didn''t want to store a rails version in svn or to > make my deployment dependent on the rails site being up. Therefore, I > checked out rails 1.1.1, and created a directory called rel_1-1-1 under my > home directory. Then I created this simple task below to create a symlink > whenever it is deploying. I placed this code into the deploy.rb file. > > desc "Symlink Rails to version 1.1" > task :add_symlink_to_rails, :roles => :web do > run "ln -s ~/rails/rel_1-1-1/ #{release_path}/vendor/rails" > end > > I also modified the long_deploy task to run this custom task right after > the symlink task. > > desc "A task demonstrating the use of transactions." > task :long_deploy do > transaction do > update_code > disable_web > symlink > add_symlink_to_rails > migrate > end > > restart > enable_web > end > > Hope this helps! > > -----Original Message----- > *From:* rails-bounces@lists.rubyonrails.org [mailto: > rails-bounces@lists.rubyonrails.org]*On Behalf Of *Josh on Rails > *Sent:* Tuesday, April 25, 2006 7:27 AM > *To:* rails@lists.rubyonrails.org > *Subject:* [Rails] Symlinks in Capistrano? > > I have a few projects with large directories (say, user-uploaded files) > that make using Capistrano a bit awkward. However, I suspect that I may have > reached the "write a custom task" level. > > (I suppose I''m just thinking out loud, here...) > > It seems as though I''d want this directories symlinked in /shared... Maybe > there''s a way to extend the ''symlink'' task to do this... ? > > Please see the following link for the BlueCross BlueShield of Tennessee E-mail > disclaimer: > http://www.bcbst.com/email_disclaimer.shtm > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060425/40599dff/attachment-0001.html
Note that you can prepend "after_" or "before_" to any task name to extend the behavior of that task. Thus, if you want to do extra work at the symlink stage, just create a task called "after_symlink": task :after_symlink do ... end - Jamis On Apr 25, 2006, at 8:28 AM, Matt White wrote:> you can also create an after_deploy task as part of your deploy.rb. > it will run automatically at the end of the defauly deploy task. > (and perhaps the others as well? not sure...) This would be similar > to what''s shown above, but perhaps a little simpler if your needs > aren''t as complex. I do this to seperate my static html into shared. > > task :after_deploy do > run "ln -s #{shared_path}/pages #{releases_path}/public/pages" > end > > either will work... My needs are simpler, and perhaps yours are as > well ;) > > Matt > > On 4/25/06, Campano, David <David_Campano@bcbst.com> wrote: > This might help, I didn''t want to store a rails version in svn or > to make my deployment dependent on the rails site being up. > Therefore, I checked out rails 1.1.1, and created a directory > called rel_1-1-1 under my home directory. Then I created this > simple task below to create a symlink whenever it is deploying. I > placed this code into the deploy.rb file. > > desc "Symlink Rails to version 1.1" > task :add_symlink_to_rails, :roles => :web do > run "ln -s ~/rails/rel_1-1-1/ #{release_path}/vendor/rails" > end > > I also modified the long_deploy task to run this custom task right > after the symlink task. > > desc "A task demonstrating the use of transactions." > task :long_deploy do > transaction do > update_code > disable_web > symlink > add_symlink_to_rails > migrate > end > > restart > enable_web > end > > Hope this helps! > -----Original Message----- > From: rails-bounces@lists.rubyonrails.org [mailto:rails- > bounces@lists.rubyonrails.org]On Behalf Of Josh on Rails > Sent: Tuesday, April 25, 2006 7:27 AM > To: rails@lists.rubyonrails.org > Subject: [Rails] Symlinks in Capistrano? > > I have a few projects with large directories (say, user-uploaded > files) that make using Capistrano a bit awkward. However, I suspect > that I may have reached the "write a custom task" level. > > (I suppose I''m just thinking out loud, here...) > > It seems as though I''d want this directories symlinked in / > shared... Maybe there''s a way to extend the ''symlink'' task to do > this... ? > Please see the following link for the BlueCross BlueShield of > Tennessee E-mail > disclaimer: http://www.bcbst.com/email_disclaimer.shtm > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails