lib/pgsync/init.rb in pgsync-0.6.1 vs lib/pgsync/init.rb in pgsync-0.6.2

- old
+ new

@@ -60,21 +60,31 @@ log "#{file} created. Add your database credentials." end end def django? - (File.read("manage.py") =~ /django/i) rescue false + file_exists?("manage.py", /django/i) end def heroku? `git remote -v 2>&1`.include?("git.heroku.com") rescue false end def laravel? - File.exist?("artisan") + file_exists?("artisan") end def rails? - File.exist?("bin/rails") + file_exists?("bin/rails") + end + + def file_exists?(path, contents = nil) + if contents + File.read(path).match(contents) + else + File.exist?(path) + end + rescue + false end end end