I've been thinking, since assets compillation suppose to be performed during production deployment, it is irrelevant to make Bundler to require
therubyracer and may be some other gems while running Rails on production environment. They will be never used anyway, because
config.assets.compile is explicitly set to
What could be a good approach to tell Bundler not to require them? At the moment I'm thinking to use environment variable. Something like this:
gem 'uglifier', require: (ENV['RAILS_ENV'].to_s.downcase != 'production')
May be there could be better options?
Cool! I think I'll use this approach in my Ansible playbook for provisioning app server instances. And the "long path" with ruby-build/ruby-install will be there as a fallback option, in case pre-built archive is not available for some reason.
I'm using rbenv with ruby-build plugin as a default way to install ruby for development and production environments. Is there a way to make installation process faster, but keep it stable?
For example, there is ruby-ng repository that could be used to install Ruby as binary package, saving a lot of time on source building: https://www.brightbox.com/docs/ruby/ubuntu/ Anyone tried it? Are there other options?
I'm using Ubuntu Server on Vagrant (for development) and EC2 instances (for production), and Ansible to automate provisioning.