Revert "Speed up boot time with bootsnap"
This reverts commit 83e040ceb1
.
Change-Id: I11ef20656b7860ffd67463270c817871c4f8d09f
Reviewed-on: https://gerrit.instructure.com/112726
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
Product-Review: Neil Gupta <ngupta@instructure.com>
QA-Review: Neil Gupta <ngupta@instructure.com>
This commit is contained in:
parent
cb41cc561f
commit
717b24d8fe
|
@ -53,7 +53,6 @@ gem 'barby', '0.6.5', require: false
|
|||
gem 'rqrcode', '0.10.1', require: false
|
||||
gem 'chunky_png', '1.3.8', require: false
|
||||
gem 'bcrypt', '3.1.11'
|
||||
gem 'bootsnap', '0.2.14', require: false
|
||||
gem 'canvas_connect', '0.3.10'
|
||||
gem 'adobe_connect', '1.0.5', require: false
|
||||
gem 'canvas_webex', '0.17'
|
||||
|
|
|
@ -19,57 +19,3 @@
|
|||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||
|
||||
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
||||
|
||||
if ENV['RAILS_ENV'] != 'production'
|
||||
module BootLib
|
||||
module Require
|
||||
ARCHDIR = RbConfig::CONFIG['archdir']
|
||||
RUBYLIBDIR = RbConfig::CONFIG['rubylibdir']
|
||||
DLEXT = RbConfig::CONFIG['DLEXT']
|
||||
|
||||
def self.from_archdir(feature)
|
||||
require(File.join(ARCHDIR, "#{feature}.#{DLEXT}"))
|
||||
end
|
||||
|
||||
def self.from_rubylibdir(feature)
|
||||
require(File.join(RUBYLIBDIR, "#{feature}.rb"))
|
||||
end
|
||||
|
||||
def self.from_gem(gem, feature)
|
||||
match = $LOAD_PATH
|
||||
.select { |e| e.match(gem_pattern(gem)) }
|
||||
.map { |e| File.join(e, feature) }
|
||||
.detect { |e| File.exist?(e) }
|
||||
if match
|
||||
require(match)
|
||||
else
|
||||
puts "[BootLib::Require warning] couldn't locate #{feature}"
|
||||
require(feature)
|
||||
end
|
||||
end
|
||||
|
||||
def self.gem_pattern(gem)
|
||||
%r{
|
||||
/
|
||||
(gems|extensions/[^/]+/[^/]+) # "gems" or "extensions/x64_64-darwin16/2.3.0"
|
||||
/
|
||||
#{Regexp.escape(gem)}-(\h{12}|(\d+\.)) # msgpack-1.2.3 or msgpack-1234567890ab
|
||||
}x
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# compilation cache only works on macOS right now
|
||||
on_mac = (/darwin/ =~ RUBY_PLATFORM) != nil
|
||||
|
||||
BootLib::Require.from_gem('bootsnap', 'bootsnap')
|
||||
Bootsnap.setup(
|
||||
cache_dir: 'tmp/cache',
|
||||
development_mode: true,
|
||||
load_path_cache: true,
|
||||
autoload_paths_cache: true,
|
||||
disable_trace: false,
|
||||
compile_cache_iseq: on_mac,
|
||||
compile_cache_yaml: on_mac
|
||||
)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue