title: Rails local asset:precompile - is there an automated way to check for changes?
body: <p>I ran into problems with asset pre-compilation during deploys, so I opted to go for local pre-compilation and check in the resulting files to my source tree.  I don't really have any problems with that approach, <strong>except</strong> that sometimes I forget to run the precompile task and release without precompiling assets! :(</p>
  
  <p>I'm wondering if anyone has come across some sort of way to check to see if any asset changes have occurred?  Ideally I'd like to run some sort of check on my CI server and fail the build if there's asset changes that haven't been committed.</p>
  
  <p>I had a couple of thoughts:</p>
  
  <ol>
  <li><p>Run <code>RAILS_ENV=production bundle exec rake assets:precompile</code> on the CI server and see if there's any output.  (The command appears to not output anything if assets are up-to-date.)  However, it seems as though the command's output is tied somehow to the environment it runs in, because after running the command locally, committing the results, and then running the command on the CI server, there is still output from the command!  I'd like to know why this is tied to the environment, but I can't even find the source for <code>rake assets:precompile</code> in the rails github repo.  Does anyone know where the source for that is?</p></li>
  <li><p>Somehow write a command that can look through the git history and determine if any assets have changed within my <code>assets/</code> folder since the last precompilation.  Not really sure how that would work...</p></li>
  </ol>
  
  <p>This has bit me more than a couple times, and sometimes I don't catch it when co-workers commit asset changes - plus it really seems like this is something a computer should be able to catch for a human.  I guess a somewhat reasonable third alternative would be to have the CI server simply run the command, and commit the generated files to the source tree automatically, but I don't like the idea of my CI server making commits.</p>
  
  <p>Any thoughts?  Thanks.</p>