Skip to content

Commit

Permalink
Use better names for feature flag and config option
Browse files Browse the repository at this point in the history
  • Loading branch information
Paweł Świątkowski committed Oct 10, 2019
1 parent 5bcb8b4 commit 57006ef
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ rvm:
- ruby-2.5
- ruby-head
env:
- ENABLE_EXPERIMENTAL=1
- BOOTSNAP_EXPERIMENTAL=1
- ''

matrix:
Expand Down
5 changes: 3 additions & 2 deletions lib/bootsnap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ def self.setup(
disable_trace: false,
compile_cache_iseq: true,
compile_cache_yaml: true,
exclude_dirs: nil
exclude_paths: nil
)

if autoload_paths_cache && !load_path_cache
raise(InvalidConfiguration, "feature 'autoload_paths_cache' depends on feature 'load_path_cache'")
end
Expand All @@ -26,7 +27,7 @@ def self.setup(
cache_path: cache_dir + '/bootsnap-load-path-cache',
development_mode: development_mode,
active_support: autoload_paths_cache,
exclude_dirs: exclude_dirs
exclude_paths: exclude_paths
) if load_path_cache

Bootsnap::CompileCache.setup(
Expand Down
6 changes: 3 additions & 3 deletions lib/bootsnap/load_path_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ module LoadPathCache

class << self
attr_reader(:load_path_cache, :autoload_paths_cache,
:loaded_features_index, :realpath_cache, :exclude_dirs)
:loaded_features_index, :realpath_cache, :exclude_paths)

def setup(cache_path:, development_mode:, active_support: true, exclude_dirs: nil)
def setup(cache_path:, development_mode:, active_support: true, exclude_paths: nil)
unless supported?
warn("[bootsnap/setup] Load path caching is not supported on this implementation of Ruby") if $VERBOSE
return
end

@exclude_dirs = exclude_dirs
@exclude_paths = exclude_paths
store = Store.new(cache_path)

@loaded_features_index = LoadedFeaturesIndex.new
Expand Down
6 changes: 3 additions & 3 deletions lib/bootsnap/load_path_cache/path_scanner.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require_relative('../explicit_require')
require 'bootsnap/dirscanner'

module Bootsnap
module LoadPathCache
Expand All @@ -16,7 +17,7 @@ module PathScanner
''
end

def self.call(path, excluded_paths: Bootsnap::LoadPathCache.exclude_dirs)
def self.call(path, excluded_paths: Bootsnap::LoadPathCache.exclude_paths)
path = path.to_s

relative_slice = (path.size + 1)..-1
Expand Down Expand Up @@ -45,8 +46,7 @@ def self.call(path, excluded_paths: Bootsnap::LoadPathCache.exclude_dirs)

excluded = excluded_paths || []

if ENV['ENABLE_EXPERIMENTAL']
require 'bootsnap/dirscanner'
if ENV['BOOTSNAP_EXPERIMENTAL']
DirScanner.scan(path, excluded: excluded) do |path|
process_path.(path)
end
Expand Down

0 comments on commit 57006ef

Please sign in to comment.