Running assets:precompile inside my rails app


#1

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