Sha256: 4f1718a4efce026664248c56c0b789169ed9f6a52a0757a156ee1750af6a78d9

Contents?: true

Size: 1 KB

Versions: 6

Compression:

Stored size: 1 KB

Contents

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_OPTIONS
          system.after(:configure, &:setup_bootsnap)
        end

        # @api private
        def self.dependencies
          '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 < "2.5.0"
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dry-system-0.12.0 lib/dry/system/plugins/bootsnap.rb
dry-system-0.11.0 lib/dry/system/plugins/bootsnap.rb
dry-system-0.10.1 lib/dry/system/plugins/bootsnap.rb
dry-system-0.10.0 lib/dry/system/plugins/bootsnap.rb
dry-system-0.9.2 lib/dry/system/plugins/bootsnap.rb
dry-system-0.9.1 lib/dry/system/plugins/bootsnap.rb