Browse files

Better check for Rails directory structure.

  • Loading branch information...
1 parent 84ed2ab commit 0d10c29f26a56ecdb108ffba7d9fa13d36f5f06d @pwnall committed Feb 3, 2012
Showing with 9 additions and 3 deletions.
  1. +2 −0 CHANGELOG
  2. +7 −3 lib/rails_pwnerer/base/rails.rb
View
2 CHANGELOG
@@ -1,3 +1,5 @@
+v0.6.105. Better check for Rails directory structure.
+
v0.6.104. Fixed previously introduced bug.
v0.6.103. Better git checkout command sequence.
View
10 lib/rails_pwnerer/base/rails.rb
@@ -2,8 +2,12 @@
module RailsPwnerer::Base
# check if the given path is the root of a Rails application
- def check_rails_root(path = '.')
- ['app', 'config', 'db', 'public', 'script', 'vendor',
- 'Rakefile'].all? { |dir| File.exists? File.join(path, dir) }
+ def check_rails_root(app_path = '.')
+ ['app', 'config', 'public', 'Rakefile'].all? do |path|
+ File.exists? File.join(app_path, path)
+ end
+ ['script/rails', 'config/database.yml'].any? do |path|
+ File.exists? File.join(app_path, path)
+ end
end
end

0 comments on commit 0d10c29

Please sign in to comment.