title: How to precompile assets with Chef?
body: <p>OpsWorks isn't precompiling assets on deploy.  I found this recipe in <a href="https://forums.aws.amazon.com/message.jspa?messageID=436400">this thread</a> but I think it's not complete though, or missing something because I get an error about <code>release_path</code> not being found.    </p>
  
  <p><strong>precompile.rb:</strong></p>
  
  <pre><code>Chef::Log.info("Running deploy/before_migrate.rb...")
  
  Chef::Log.info("Symlinking #{release_path}/public/assets to #{new_resource.deploy_to}/shared/assets")
  
  link "#{release_path}/public/assets" do
    to "#{new_resource.deploy_to}/shared/assets"
  end
  
  rails_env = new_resource.environment["RAILS_ENV"]
  Chef::Log.info("Precompiling assets for RAILS_ENV=#{rails_env}...")
  
  execute "rake assets:precompile" do
    cwd release_path
    command "bundle exec rake assets:precompile"
    environment "RAILS_ENV" =&gt; rails_env
  end
  </code></pre>
  
  <p><strong>logs</strong>:</p>
  
  <pre><code>undefined local variable or method `release_path' for ....
  </code></pre>
  
  <p>Any ideas?  I do not know Chef at all and am trying to figure this out on the fly.</p>