FEATURE: add support for bootsnap in dev

To use bootsnap which speeds up rails boot add

BOOTSNAP=1 to your env
This commit is contained in:
Sam Saffron 2017-04-25 10:15:12 -07:00
parent 9051ca7959
commit 1ae67a21f5
3 changed files with 20 additions and 1 deletions

View File

@ -1,6 +1,7 @@
source 'https://rubygems.org'
# if there is a super emergency and rubygems is playing up, try
#source 'http://production.cf.rubygems.org'
gem 'bootsnap', require: false
def rails_master?
ENV["RAILS_MASTER"] == '1'

View File

@ -62,6 +62,9 @@ GEM
rack (>= 0.9.0)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bootsnap (0.2.10)
msgpack (~> 1.0)
snappy (~> 0.0.15)
builder (3.2.3)
bullet (5.4.2)
activesupport (>= 3.0.0)
@ -166,7 +169,7 @@ GEM
metaclass (~> 0.0.1)
mock_redis (0.15.4)
moneta (1.0.0)
msgpack (1.0.2)
msgpack (1.1.0)
multi_json (1.12.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
@ -354,6 +357,7 @@ GEM
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
slop (3.6.0)
snappy (0.0.15)
spork (1.0.0rc4)
spork-rails (4.0.0)
rails (>= 3.0.0, < 5)
@ -400,6 +404,7 @@ DEPENDENCIES
barber
better_errors
binding_of_caller
bootsnap
bullet
byebug
certified

View File

@ -9,3 +9,16 @@ require 'rubygems'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
if ENV['BOOTSNAP'] #&& ENV['RAILS_ENV'] != 'production'
require 'bootsnap'
Bootsnap.setup(
cache_dir: 'tmp/cache', # Path to your cache
development_mode: ENV['BOOTSNAP_DEV'] == 'development',
load_path_cache: true, # Should we optimize the LOAD_PATH with a cache?
autoload_paths_cache: true, # Should we optimize ActiveSupport autoloads with cache?
disable_trace: false, # Sets `RubyVM::InstructionSequence.compile_option = { trace_instruction: false }`
compile_cache_iseq: true, # Should compile Ruby code into ISeq cache?
compile_cache_yaml: true # Should compile YAML into a cache?
)
end