Skip to content

Commit 54aa1f6

Browse files
Only use Spring if already loaded
This makes it possible for the user to selectively use Spring on a command to command basis Fixes #510
1 parent b86d9e4 commit 54aa1f6

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/dotenv/rails.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@
1010
Dotenv.instrumenter = ActiveSupport::Notifications
1111

1212
# Watch all loaded env files with Spring
13-
begin
14-
require "spring/commands"
13+
if defined?(Spring)
1514
ActiveSupport::Notifications.subscribe("load.dotenv") do |*args|
1615
event = ActiveSupport::Notifications::Event.new(*args)
1716
Spring.watch event.payload[:env].filename if Rails.application
1817
end
19-
rescue LoadError, ArgumentError
20-
# Spring is not available
2118
end
2219

2320
module Dotenv

0 commit comments

Comments
 (0)