Permalink
Browse files

Adding a snippet that will traverse a rails app and find all the views.

  • Loading branch information...
1 parent 86d7335 commit b71e663cbf871389eee4a05f3230c48d715d568b @miketierney committed Oct 26, 2009
Showing with 13 additions and 0 deletions.
  1. +13 −0 view_finder.rb
View
@@ -0,0 +1,13 @@
+@root = "#{RAILS_ROOT}/app/views/"
+files = []
+
+Find.find @root do |path|
+ unless File.directory? path # don't want the directories in our array, since they're really not all that useful
+ unless File.dirname(path) == "#{@root}layouts" # We don't want any of the files in the layouts directory, since that's not what we're testing
+ path.gsub!(@root,"")
+ files << path unless File.basename(path) =~ /^[_]/ # anything start with an underscore is a partial, so we don't want them either.
+ end
+ end
+end
+
+files

0 comments on commit b71e663

Please sign in to comment.