This article is published as a reply to the last few articles on the thoughtbot blog.
Some time or another during the project development you may wonder: «What files does my project include?» or «Why am I a Star Wars fan anyway?». This article will focus on the first question, leaving the second to your own reflection.
Any shell you might be using comes with a lot of useful tools. The one of interest today is ls
Here's the most simple example of its usage in a Rails project
sample_project $ ls
README app db lib public test vendor
Rakefile config doc log script tmp
As a little more complex example, you might want to get the list of your model files:
sample_project $ ls app/models/
comment.rb post.rb
Or, it even can do crazy stuff, like list all your model files AND controller files AND helper files! Now thats some useful magic, isn't it?
sample_project $ ls app/*
app/controllers:
application_controller.rb comments_controller.rb posts_controller.rb
app/helpers:
application_helper.rb comments_helper.rb posts_helper.rb
app/models:
comment.rb post.rb
app/views:
comments layouts posts
ls can do much. much more. Go check out the manual page here, you'll be amazed.
Note to Windows users: you also have a similar command, named dir.