从命令行直接运行spring
(不带)时,什么也没有发生!bundle exec
只有在运行时bundle exec spring
,它才有效:
$ spring status
$ bundle exec spring status
Spring is running:
21990 spring server | synaesthesia | started 1 min ago
22046 spring app | synaesthesia | started 43 secs ago | test mode
我的bin/spring
binstub 看起来像这样:
#!/usr/bin/env ruby
# 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)
ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
ENV["GEM_HOME"] = ""
Gem.paths = ENV
gem "spring", match[1]
require "spring/binstub"
end
end
它已经被 spring 修补了bundle exec spring binstub --all
。所以我猜一切都配置正确?那么为什么我总是需要一个bundle exec
?
我正在使用 Rails 4.0.4。