Welcome Guest | Login

Removing a folder from subversion

I have a folder in my application where photos are saved (/public/photos). I tried deleting it from my repository but my local version overwrites the version on the server each time I deploy.

I tried setting ignore as well but I must not be doing it right. I need the photos folder to stay the same every time I deploy my application.

What is the best way to implement this?

2008-06-29 05:53 PM

did you "svn delete public/photos" from the latest version and commit that change back in to the repository?  That along with the ignore should hook you up.  Another option is to modify your Capfile to move your photos to your apps/appname/shared folder similar to how the mongrel_cluster.yml is moved (see the cap tutorial for details).  This is what is typically done for files that are not stored in your repos that need to stay persistent across multiple deploys.  

2008-06-30 12:39 AM

I did use "svn delete public/photos" and committed it.

How do I verify that I have the ignore set properly?

If I wanted to automate the moving of photos to the new release would putting this in the Capfile work?

run "mkdir -p #{deploy_to}/public/photos"
run "mv #{current_path}/public/photos/* #{deploy_to}/public/photos/"

Would this operation take very long, assuming I have around 20MB worth of photos?

2008-07-01 01:36 PM

Hi Fountain,

The photo directory can be reflected in all the future Capistrano releases by placing the photo folder in the ~/apps/<application>/shared directory. You can create a sym link from the ~/apps/<application>/shared/photo to ~/apps/<application>/current/public/photo. The following  updated Capfile will help you to create the sym link from the shared folder.

====
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
load 'config/deploy'

namespace :deploy do

 task :start, :roles => :app do
   run "rm -rf /home/#{user}/public_html;ln -s #{current_path}/public /home/#{user}/public_html"
  run "cd #{current_path} && mongrel_rails start -e production -p #{mongrel_port} -d"
ln -s #{deploy_to}/shared/photos #{current_path}/public/photos
end

task :restart, :roles => :app do
ln -s #{deploy_to}/shared/photos #{current_path}/public/photos
  run "cd #{current_path} && mongrel_rails restart"
  run "cd #{current_path} && chmod 755 #{chmod755}"
end

end
====

Note:- The above Capfile will only work if the photos folder is present inside the /home/user/apps/<application>/shared/ folder.

2008-07-01 03:04 PM

I got the following error on deployment:

* executing `deploy:restart'
c:/ruby/lib/ruby/gems/1.8/gems/capistrano-2.3.0/lib/capistrano/configuration/nam
espaces.rb:188:in `method_missing': undefined local variable or method `s' for #
<Capistrano::Configuration::Namespaces::Namespace:0x33ccf28> (NameError)
       from ./Capfile:12:in `load'
       from c:/ruby/lib/ruby/gems/1.8/gems/capistrano-2.3.0/lib/capistrano/conf
iguration/execution.rb:80:in `instance_eval'
       from c:/ruby/lib/ruby/gems/1.8/gems/capistrano-2.3.0/lib/capistrano/conf
iguration/execution.rb:80:in `execute_task_without_callbacks'
       from c:/ruby/lib/ruby/gems/1.8/gems/capistrano-2.3.0/lib/capistrano/conf
iguration/callbacks.rb:27:in `execute_task'
       from c:/ruby/lib/ruby/gems/1.8/gems/capistrano-2.3.0/lib/capistrano/conf
iguration/namespaces.rb:186:in `send'
       from c:/ruby/lib/ruby/gems/1.8/gems/capistrano-2.3.0/lib/capistrano/conf
iguration/namespaces.rb:186:in `method_missing'
       from c:/ruby/lib/ruby/gems/1.8/gems/capistrano-2.3.0/lib/capistrano/conf
iguration/namespaces.rb:104:in `restart'
       from c:/ruby/lib/ruby/gems/1.8/gems/capistrano-2.3.0/lib/capistrano/reci
pes/deploy.rb:116:in `load'
        ... 9 levels...
       from c:/ruby/lib/ruby/gems/1.8/gems/capistrano-2.3.0/lib/capistrano/cli/
execute.rb:14:in `execute'
       from c:/ruby/lib/ruby/gems/1.8/gems/capistrano-2.3.0/bin/cap:4
       from c:/ruby/bin/cap:19:in `load'
       from c:/ruby/bin/cap:19

This is in my capfile:

load 'deploy' if respond_to?(:namespace) # cap2 differentiator
load 'config/deploy'
namespace :deploy do

task :start, :roles => :app do
  run "rm -rf /home/#{user}/public_html;ln -s #{current_path}/public /home/#{user}/public_html"
  run "cd #{current_path} && mongrel_rails start -e production -p #{mongrel_port} -d"
  ln -s #{deploy_to}/shared/photos #{current_path}/public/photos
 end

  task :restart, :roles => :app do
  ln -s #{deploy_to}/shared/photos #{current_path}/public/photos
  run "cd #{current_path} && mongrel_rails stop"
  run "cd #{current_path} && mongrel_rails start -e production -p #{mongrel_port} -d"
  run "cd #{current_path} && chmod 755 #{chmod755}"
end

end

2008-07-02 03:32 AM

Vinayan had a typo in two lines in his Capfile (the "ln -s" lines), you need to make sure all the commands are within a

run "something"

From the trace you can see the problem is "from ./Capfile:12" and that line is

 ln -s #{deploy_to}/shared/photos #{current_path}/public/photos

which needs to be

 run "ln -s #{deploy_to}/shared/photos #{current_path}/public/photos"

you need to fix the one in the start task as well.

2008-07-02 10:09 AM

Thank you. I think that did it.

So much to learn...

2008-07-02 11:29 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up today!