file_exist? for capistrano

I just spend half an our figuring out how to check if a file exists on the remote machine,
File.exist? wont do the trick…

def file_exist?(path)
  run "ls #{path}"
  true
rescue Exception => e
  false
end
Advertisements

3 thoughts on “file_exist? for capistrano

    • Ok, found it, so for other newbies: add the method in lib/capistrano/filecheck.rb and in Capfile: Dir.glob(‘lib/capistrano/*.rb’).each { |r| import r }, and if it’s Cap v3 change run to execute. Cheers!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s