Forum: Ruby on Rails Running assets:precompile inside my rails app

3b8ad006781b1a3ab36dc76e2a05ce9c?d=identicon&s=25 Cris Shupp (cshupp)
on 2016-12-08 19:10
Hi Rubyists,

Application A, a rails app, is responsible for deploying application B,
also a rails app.  Application B's war file (JRuby) will be seeded with
a file called context.txt at the root of the war file.

context.txt might have a one liner like:

/app_b

I need, in application B's initializer, for it to run assets:precompile.
This cannot be done in advance as the user in application A will end up
choosing a context from a list of contexts preconfigured to work with
our apache mod_proxy server.

So if I have (in config/initializers/z_last.rb)

load 'Rakefile'
Rake::Task["assets:precompile"].invoke

It would be nice if all the assets are compiled (they aren't -- only
.sprockets-manifest)

production.rb would have:

 config.relative_url_root = $context #from file

Thanks,

Cris
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.