Sha256: 8beb3de0905fa1a6905e44df995cf84e5a7f08b89cb1e13495b4453069cc5ec6

Contents?: true

Size: 1.05 KB

Versions: 14

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module Dry
  module System
    module Plugins
      module Bootsnap
        DEFAULT_OPTIONS = {
          load_path_cache: true,
          disable_trace: true,
          compile_cache_iseq: true,
          compile_cache_yaml: true,
          autoload_paths_cache: false
        }.freeze

        # @api private
        def self.extended(system)
          super

          system.use(:env)
          system.setting :bootsnap, default: DEFAULT_OPTIONS
          system.after(:configure, &:setup_bootsnap)
        end

        # @api private
        def self.dependencies
          {bootsnap: "bootsnap"}
        end

        # Set up bootsnap for faster booting
        #
        # @api public
        def setup_bootsnap
          return unless bootsnap_available?

          ::Bootsnap.setup(config.bootsnap.merge(cache_dir: root.join("tmp/cache").to_s))
        end

        # @api private
        def bootsnap_available?
          RUBY_ENGINE == "ruby" && RUBY_VERSION >= "2.3.0" && RUBY_VERSION < "3.1.0"
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
dry-system-1.1.1 lib/dry/system/plugins/bootsnap.rb
dry-system-1.1.0 lib/dry/system/plugins/bootsnap.rb
dry-system-1.1.0.beta2 lib/dry/system/plugins/bootsnap.rb
dry-system-1.1.0.beta1 lib/dry/system/plugins/bootsnap.rb
dry-system-1.0.1 lib/dry/system/plugins/bootsnap.rb
dry-system-1.0.0 lib/dry/system/plugins/bootsnap.rb
dry-system-1.0.0.rc1 lib/dry/system/plugins/bootsnap.rb
dry-system-0.27.2 lib/dry/system/plugins/bootsnap.rb
dry-system-0.27.1 lib/dry/system/plugins/bootsnap.rb
dry-system-0.27.0 lib/dry/system/plugins/bootsnap.rb
dry-system-0.26.0 lib/dry/system/plugins/bootsnap.rb
dry-system-0.25.0 lib/dry/system/plugins/bootsnap.rb
dry-system-0.24.0 lib/dry/system/plugins/bootsnap.rb
dry-system-0.23.0 lib/dry/system/plugins/bootsnap.rb