Skip to content

Commit

Permalink
Lazily load fileutils and tmpdir
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Feb 17, 2021
1 parent 24d9e93 commit daa5096
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/spring/env.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require "pathname"
require "fileutils"
require "digest/md5"
require "tmpdir"

require "spring/version"
require "spring/sid"
Expand Down Expand Up @@ -33,10 +31,12 @@ def version
end

def tmp_path
require "tmpdir"
path = Pathname.new(
ENV["SPRING_TMP_PATH"] ||
File.join(ENV['XDG_RUNTIME_DIR'] || Dir.tmpdir, "spring-#{Process.uid}")
)
require "fileutils"
FileUtils.mkdir_p(path) unless path.exist?
path
end
Expand Down

0 comments on commit daa5096

Please sign in to comment.