Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions dashboard/bin/spring
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
#!/usr/bin/env ruby

# This file loads spring without using Bundler, in order to be fast.
# 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'
require 'bundler'

if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m))
Gem.paths = {'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(Gem.path_separator)}
gem 'spring', match[1]
require 'spring/binstub'
# Spring breaks when Bundler is running in deployment mode (ie, on the
# managed test server), but fortunately it also doesn't offer any benefits to
# us on our deployed servers so we can safely skip it in that situation.
unless Bundler.settings[:deployment]
lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
spring = lockfile.specs.detect {|spec| spec.name == 'spring'}
if spring
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
gem 'spring', spring.version
require 'spring/binstub'
end
end
end