From 717b24d8feb6391f979ddf94933c12b6dcfa0490 Mon Sep 17 00:00:00 2001 From: Neil Gupta Date: Mon, 22 May 2017 23:09:34 +0000 Subject: [PATCH] Revert "Speed up boot time with bootsnap" This reverts commit 83e040ceb175aac7ca7826d1ed59ed70a3e941c1. Change-Id: I11ef20656b7860ffd67463270c817871c4f8d09f Reviewed-on: https://gerrit.instructure.com/112726 Reviewed-by: Simon Williams Tested-by: Jenkins Product-Review: Neil Gupta QA-Review: Neil Gupta --- Gemfile.d/app.rb | 1 - config/boot.rb | 54 ------------------------------------------------ 2 files changed, 55 deletions(-) diff --git a/Gemfile.d/app.rb b/Gemfile.d/app.rb index ebe82102788..1166b61cfa0 100644 --- a/Gemfile.d/app.rb +++ b/Gemfile.d/app.rb @@ -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' diff --git a/config/boot.rb b/config/boot.rb index d9e5b170cd8..424c50b35fd 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -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