Detect rails 4 manifest file #74

Merged
merged 2 commits into from Apr 22, 2013

10 participants

@catsby

This patch implements #72 and checks for the manifest file generated by Rails 4 to detected if assets are already compile.

@schneems

👍 @hone WDYT?

@orbanbotond

+1 I experienced this too

@dougc84

+1

@fluxsaas

+1

@schneems

Yo @ctshryock, we added tests 😄 any chance you could make a rails 4 repo, add it to http://github.com/georgewashington and add a test for this?

@catsby

Yesssss I'll start on that

@pat
pat commented Apr 7, 2013

Just because I'm curious (and thinking of doing something similar for Flying Sphinx): why georgewashington?

@catsby

@schneems updated with passing spec, thanks for fixing that Hachet issue

@barttenbrinke

When will this be released?

@audionerd

+1

I found this issue via: http://stackoverflow.com/questions/15354539/heroku-does-not-compile-files-under-assets-piplines-in-rails-4

Heroku was compiling the assets to /tmp but not serving them. As a workaround, setting config.serve_static_assets = true in production.rb worked for us.

@schneems

Merging, tests pass for me after @dpiddy last PR. Won't be live till @hone deploys

@schneems schneems merged commit 5abb81d into heroku:master Apr 22, 2013
@catsby

| (• ◡•)|/ \(❍ᴥ❍ʋ)

@robotmay

Is this now live? I can't push my Rails 4 app up due to constant errors precompiling the assets, and it doesn't detect the already precompiled ones at the moment.

@schneems
@robotmay

Thanks; just checking I hadn't broken anything else :)

@catsby

@robotmay I believe you can manually specify this git repo as your buildpack and use it directly, that will get you this patch. User beware as it's not officially released yet etc etc

$ heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-ruby.git

I wouldn't recommend this long term though, but should get you past your current hangups.

@robotmay

@ctshryock Ooh, thanks for the tip. I actually managed to get it deployed by enabling a labs feature to inject the production environment when precompiling or somesuch, which got me far enough for now :D

@Sjors

I ran the "heroku config:set" command and redeployed the app, but my assets are still not showing up.

-----> Fetching custom git buildpack... done

----> Preparing app for Rails asset pipeline
   Running: rake assets:precompile
   I, [2013-05-09T12:23:53.985438 #1005]  INFO -- : Writing /tmp/build_3jxo5dbpowgh3/public/assets/application-75a7854682675193d462515d38e028bc.js
   I, [2013-05-09T12:23:59.206363 #1005]  INFO -- : Writing /tmp/build_3jxo5dbpowgh3/public/assets/application-6cb6545be1800ce4cbc7e163539ba4c4.css
   Asset precompilation completed (12.88s)

The static assets workaround did work for me, although it shows the same output during assets compilation.

Using Rails 4.0.0rc1 and ruby 2.0.0. (both local and on Heroku).

@catsby

Strange, Worked For Me™:

fury git:master ❯ b rake assets:precompile                                                                                                            ✖ ✹ ✭
[...]

fury git:master ❯ git ci -a                                                                                                                           ⏎ ✖ ✚
[master dddfb9e] Change background color, precompile assets
 5 files changed, 21 insertions(+), 1 deletion(-)
 [...]
 create mode 100644 public/assets/manifest-3ed17881c51fa54c3ce51c6d17e42e00.json

fury git:master ❯ heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-ruby.git
Setting config vars and restarting cts-fury... done, v3
BUILDPACK_URL: https://github.com/heroku/heroku-buildpack-ruby.git

fury git:master ❯ git push heroku master
[Counting objects: 95, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (87/87), done.
Writing objects: 100% (95/95), 189.57 KiB, done.
Total 95 (delta 15), reused 0 (delta 0)
[...]
remote:
remote: -----> Fetching custom git buildpack... done
[...]
remote: -----> Preparing app for Rails asset pipeline
remote:        Detected manifest file, assuming assets were compiled locally
[...]
remote: -----> Launching... done, v7
remote:        http://cts-fury.herokuapp.com deployed to Heroku

To git@heroku.com:cts-fury.git
 * [new branch]      master -> master
@Sjors
@catsby

That's what this pull request is about, detecting if the manifest files exists (meaning assets are already precompiled) and skipping that step on Heroku.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment