I'd build this as a rake task (then it all runs on the server, or your workstation, and you can test it, etc) and then simply call it from Capistrano.
You're missing something fundamental in that anything outside of `run` happens on *your machine*, and anything in `run/capture()` runs on the server you are connected to. So, in your example, you're collecting a list of files which don't exist on your machine, and then running a task (with an empty list) on your server. You'd be better served adding a Raketask to your application (rails uses `rake db:seed`, for loading runtime fixtures, for example) and then simply calling that when you do the deployment. On Friday, February 24, 2012 at 3:06 PM, romain Simiand wrote: > Hi there, > > thanks for the info. > So if I get you well, all I need to do is make > > File.join("#{fixtures_directory}", "*.json" > > run on #{current_release} server. > > Could I do that by simply applying the task to the web server, using : > > task :dbcleanup do, :roles => :app > > like in the example below ? > Or am I missing something crucial here ? > > Also, here's an example of what I'm trying to do precisely > > namespace :database do > desc "Load 'em fixtures" > task :dbcleanup, :roles => :web do > set :database_name, "dbname" > set :fixtures_directory, "#{current_release}/fixtures/#{stage}" > set :mongo_import, "mongoimport -d #{database_name} -c #{file}" > > jsonfiles = File.join("#{fixtures_directory}", "*.json") > puts("#{jsonfiles}") > > files = File.join("#{fixtures_directory}","**","*.json") > Dir.glob(files).each do |file| > run "#{mongo_import}" > end > > logger.debug "Ended" > end > end > > Am I clearer ? > -- > * You received this message because you are subscribed to the Google Groups > "Capistrano" group. > * To post to this group, send email to capistrano@googlegroups.com > (mailto:capistrano@googlegroups.com) > * To unsubscribe from this group, send email to > capistrano+unsubscr...@googlegroups.com > (mailto:capistrano+unsubscr...@googlegroups.com) For more options, visit this > group at http://groups.google.com/group/capistrano?hl=en -- * You received this message because you are subscribed to the Google Groups "Capistrano" group. * To post to this group, send email to capistrano@googlegroups.com * To unsubscribe from this group, send email to capistrano+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en