We are trying to move asset compilation step to deployment, after the
war
is exploded on deployment, but before the application starts. Our
project
is a Rails 3.2.10 app on JRuby 1.7.1, includes turbo-sprockets-rails3
gem,
packaged as war under Jetty.
I have a vendor bundle directory with all my gems in the war. I figured
I
could invoke the assets using java, passing the jruby-complete jar as an
argument. The process finds gem dependencies and rails will start, but
the
rake task fails because rake/file_utils.rb tries to invoke my args as a
shell argument. I think the issue is that it interpets the path to jruby
with the “file:/” prefix. And if one was to try to invoke a binary with
that prefix, it will simply fail.
Has anyone tried to compile assets while in a war structure using jruby
via
java?
Input:
#invoked from a bash script during the deploy process but before Jetty
starts up. #APP_ROOT_DIR is the root of the war file
export GEM_HOME=$APP_ROOT_DIR/WEB-INF/vendor/bundle/jruby/1.9
export BUNDLE_WITHOUT=“development:test”
export BUNDLE_GEMFILE=$APP_ROOT_DIR/WEB-INF/Gemfile
export RAILS_ENV=production
That doesn’t work very well if you don’t know which env the war is going
to be deployed to eg: stage or prod. The different envs will often have
a
different asset host.
The wabler-exec gem might be of help: warbler-exec | RubyGems.org | your community gem host, depending on where you want the
compiled assets to be deployed. You might have to hack it a little since
in the current state it just takes the war and unpacks it to a different
path, but in general, there’s no reason why it shouldn’t be possible to
feed it the path to an unpacked war as an option.
Regards
Felix
On Jan 25, 2013, at 5:57 PM, Patrick R. wrote:
out this pull request to warbler and see if it works for you:
You should make the asset host configurable using an environment
variable or a system property or use another mode of deployment that
doesn’t use wars.
Wars are not really meant to be changed or partially deployed.
That could work, but asset pre-compilation is expensive. Our build
servers
currently generate the war on every commit to master, compiling the
assets
twice (once for test and once for stage) would add significant time to
the
build process.
What we are trying to do is disconnect asset compilation from the war
and
move it elsewhere in our deploy process.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.