Sha256: afa09da82154bbb291dbeb0e242554cd81079cb55006e7196d99bfffe74f723e

Contents?: true

Size: 1.33 KB

Versions: 21

Compression:

Stored size: 1.33 KB

Contents

require_relative '../bootsnap'

env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || ENV['ENV']
development_mode = ['', nil, 'development'].include?(env)

# only enable on 'ruby' (MRI), POSIX (darin, linux, *bsd), and >= 2.3.0
enable_cc =
  RUBY_ENGINE == 'ruby' &&
  RUBY_PLATFORM =~ /darwin|linux|bsd/ &&
  Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.3.0")

cache_dir = ENV['BOOTSNAP_CACHE_DIR']
unless cache_dir
  config_dir_frame = caller.detect do |line|
    line.include?('/config/')
  end

  unless config_dir_frame
    $stderr.puts "[bootsnap/setup] couldn't infer cache directory! Either:"
    $stderr.puts "[bootsnap/setup]   1. require bootsnap/setup from your application's config directory; or"
    $stderr.puts "[bootsnap/setup]   2. Define the environment variable BOOTSNAP_CACHE_DIR"

    raise "couldn't infer bootsnap cache directory"
  end

  path = config_dir_frame.split(/:\d+:/).first
  path = File.dirname(path) until File.basename(path) == 'config'
  app_root = File.dirname(path)

  cache_dir = File.join(app_root, 'tmp', 'cache')
end

Bootsnap.setup(
  cache_dir:            cache_dir,
  development_mode:     development_mode,
  load_path_cache:      true,
  autoload_paths_cache: true, # assume rails. open to PRs to impl. detection
  disable_trace:        false,
  compile_cache_iseq:   enable_cc,
  compile_cache_yaml:   enable_cc
)

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
bootsnap-1.3.0-java lib/bootsnap/setup.rb
bootsnap-1.3.0 lib/bootsnap/setup.rb
bootsnap-1.3.0.beta2-java lib/bootsnap/setup.rb
bootsnap-1.3.0.beta2 lib/bootsnap/setup.rb
bootsnap-1.3.0.beta-java lib/bootsnap/setup.rb
bootsnap-1.3.0.beta lib/bootsnap/setup.rb
bootsnap-1.2.1-java lib/bootsnap/setup.rb
bootsnap-1.2.1 lib/bootsnap/setup.rb
bootsnap-1.2.0-java lib/bootsnap/setup.rb
bootsnap-1.2.0 lib/bootsnap/setup.rb
bootsnap-1.2.0.pre-java lib/bootsnap/setup.rb
bootsnap-1.2.0.pre lib/bootsnap/setup.rb
bootsnap-1.1.8 lib/bootsnap/setup.rb
bootsnap-1.1.8-java lib/bootsnap/setup.rb
bootsnap-1.1.7-java lib/bootsnap/setup.rb
bootsnap-1.1.7 lib/bootsnap/setup.rb
bootsnap-1.1.6-java lib/bootsnap/setup.rb
bootsnap-1.1.6 lib/bootsnap/setup.rb
bootsnap-1.1.6.beta3 lib/bootsnap/setup.rb
bootsnap-1.1.6.beta2 lib/bootsnap/setup.rb