Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
Remove Spring support
Browse files Browse the repository at this point in the history
We aren't using the spring gem for quite some time and its very unlikely now that it will be resurrected.
  • Loading branch information
javierjulio committed Apr 16, 2024
1 parent ed6d1d6 commit b9c0ca3
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions lib/envied.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ def self.require(*args, **options)
env!(requested_groups, **options)
error_on_missing_variables!(**options)
error_on_uncoercible_variables!(**options)

ensure_spring_after_fork_require(args, options)
end

def self.env!(requested_groups, **options)
Expand All @@ -28,9 +26,7 @@ def self.env!(requested_groups, **options)
def self.error_on_missing_variables!(**options)
names = env.missing_variables.map(&:name)
if names.any?
msg = "The following environment variables should be set: #{names.join(', ')}."
msg << "\nPlease make sure to stop Spring before retrying." if spring_enabled? && !options[:via_spring]
raise msg
raise "The following environment variables should be set: #{names.join(', ')}."
end
end

Expand All @@ -39,9 +35,7 @@ def self.error_on_uncoercible_variables!(**options)
format("%{name} with %{value} (%{type})", name: v.name, value: env.value_to_coerce(v).inspect, type: v.type)
end
if errors.any?
msg = "The following environment variables are not coercible: #{errors.join(", ")}."
msg << "\nPlease make sure to stop Spring before retrying." if spring_enabled? && !options[:via_spring]
raise msg
raise "The following environment variables are not coercible: #{errors.join(", ")}."
end
end

Expand All @@ -51,16 +45,6 @@ def self.required_groups(*groups)
result.any? ? result.map(&:to_sym) : [:default]
end

def self.ensure_spring_after_fork_require(args, options)
if spring_enabled? && !options[:via_spring]
Spring.after_fork { ENVied.require(*args, **options.merge(via_spring: true)) }
end
end

def self.spring_enabled?
defined?(Spring) && Spring.respond_to?(:watcher)
end

def self.method_missing(method, *args, &block)
respond_to_missing?(method) ? (env && env[method.to_s]) : super
end
Expand Down

0 comments on commit b9c0ca3

Please sign in to comment.