2

I am very new to ruby on rails. I've installed a complicated ruby on rails project via github clone and bundle install, and I was making minor changes to it until it reaches a point whereby it is not stable anymore, sass was throwing strange exceptions, so did other ruby gems. For a rails project, is there a way to clean up the project (aka, remove any "compiled or cached code") and just run again. My alternative now is to go thru github clone and bundle install again, but that means all of my modified changes have to be reapplied again. What is rails equivalent of "make clean" in Java? Is "rake clean" the answer? Do we need to run any bundle commands?

dickyj
  • 1,830
  • 1
  • 24
  • 41

1 Answers1

4

For directories managed by git, you can run:

git clean -ndx   # dry-run to make sure you don't lose anything important
git clean -dfx

This command cleans out your working tree. The specified command-line options include:

  • -n: Don’t actually remove anything, just show what would be done.
  • -d: Remove untracked directories in addition to untracked files.
  • -f: Force the clean
  • -x: Don't use the ignore rules. This allows removing all untracked files, including build products. This can be used (possibly in conjunction with git reset) to create a pristine working directory to test a clean build.

See the git clean man page for more info.

Tim Henigan
  • 60,452
  • 11
  • 85
  • 78
  • thanks for the answer. Does this clean all the cached files in rails? I know rails cache the plugins, etc. Also, I have no clue what bundle does in the background... – dickyj Apr 30 '10 at 01:54
  • @hip10: can you tell us which github project was cloned? It might help. – Tim Henigan Apr 30 '10 at 02:10
  • You might want to run **git clean -n** first. Otherwise you might end up deleting something you needed. (Not that I just did that and am frantically trying to undo it...) – Nathan Buggia Jun 25 '13 at 00:34