Skip to content

Commit

Permalink
Update bin/spring with new Rails 6.1 syntax (#7288)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericboehs authored Jun 23, 2021
1 parent 8fd4f6b commit ea2ce3a
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions bin/spring
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# This file loads Spring without using Bundler, in order to be fast.
# It gets overwritten when you run the `spring binstub` command.

unless defined?(Spring)
require 'rubygems'
if !defined?(Spring) && [nil, 'development', 'test'].include?(ENV['RAILS_ENV'])
gem 'bundler'
require 'bundler'

lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
spring = lockfile.specs.detect { |spec| spec.name == 'spring' }
if spring
# Load Spring without loading other gems in the Gemfile, for speed.
Bundler.locked_gems&.specs&.find { |spec| spec.name == 'spring' }&.tap do |spring|
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
gem 'spring', spring.version
require 'spring/binstub'
rescue Gem::LoadError
# Ignore when Spring is not installed.
end
end

0 comments on commit ea2ce3a

Please sign in to comment.