The line:

     jsonfiles = File.join("#{fixtures_directory}", "*.json"

Runs on the machine from which you launch Capistrano, not on the server, so 
unless those files exist on your machine, that's not going to work for you. Use 
something like remote shell globbing. (I'd give an example, but you don't 
include an example of what you're trying to do here)

- Lee 


On Friday, February 24, 2012 at 12:35 PM, pixelboy wrote:

> Hi,
> 
> I must admit I'm not sure wether this issue I'm having is relative to 
> capistrano or moreover ruby (being a beginnner in both). But here's the deal.
> I'm currently working on a php application using mongodb driven data, and 
> capistrano to deploy on each and every env and server we have.
> 
> 
> My main problem is I just can't figure out how to have compliant deployments 
> when it comes to our database. I've figured out fixture files, using json, 
> would be cool enough, using the mongoimport command.
> 
> Heres the snippet I've come up with :
> 
> > namespace :database do
> >   desc "Load 'em fixtures"
> >   task :dbcleanup do
> >     set :database_name, "application"
> >     set :fixtures_directory, "#{current_release}/fixtures/#{stage}"
> >     set :mongo_import, "mongoimport -d #{database_name} -c foo"
> >     
> >     jsonfiles = File.join("#{fixtures_directory}", "*.json")
> >     puts("#{jsonfiles}")
> > 
> >     files = File.join("#{fixtures_directory}","**","*.json")
> >     Dir.glob(files).each do |file|
> >       puts("#{file}")
> >     end
> > 
> >     logger.debug "Ended"
> > 
> >   end
> > end
> 
> 
> Don 't bother telling me mongoimport won't work untill I've come up with a 
> way to get the collection name, I know that.
> We're not there yet ;)
> 
> Could someone tell me how come I get an output with the puts("#{jsonfiles}"), 
> and not with the puts("#{file}") ??
> 
> Heres the output of my console.
> 
> > [...]
> >  ** transaction: commit
> >   * executing `database:dbcleanup'
> > /home/server/www/application/staging/releases/20120224112251/fixtures/staging/*.json
> >   * Ended
> > [...]
> 
> Where am I wrong ?? Thanks a lot for the help, I'm pretty sure it's not much 
> really.
> 
> -- 
> * 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

Reply via email to