Skip to content

Commit 7d375c6

Browse files
jasonkarnsbyroot
authored andcommitted
Rake entrypoint registers Bootsnap's cache_dir for cleaning
The rake entrypoint also allows future rake tasks to be exposed, should that be necessary. Expected use is via: `require "bootsnap/rake"` from users' Rakefile. Additionally, should future rake tasks be provided by bootsnap, the expectation is that they would live under `lib/bootsnap/tasks/*.rake` such that user's can add Bootsnap's tasks via: `Rake.add_tasklib`. The expectation is that rake.rb would contain the task _classes_, and any tasks/*.rake would define them as tasks. Then users could require bootsnap/rake to construct their own tasks using the classes, or add_tasklib to use the provided tasks.
1 parent d091162 commit 7d375c6

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

lib/bootsnap/rake.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# frozen_string_literal: true
2+
3+
require "bootsnap"
4+
require "rake/clean"
5+
6+
# Typically, should have been set up prior to requiring rake integration.
7+
# But allow for a streamlined ::default_setup
8+
require "bootsnap/setup" if Bootsnap.cache_dir.nil?
9+
10+
if Bootsnap.cache_dir
11+
CLEAN.include Bootsnap.cache_dir
12+
else
13+
abort "Bootsnap must be set-up prior to rake integration"
14+
end

0 commit comments

Comments
 (0)