Skip to content

Commit

Permalink
Don't load spring/command until it is used, closes rails#457
Browse files Browse the repository at this point in the history
  • Loading branch information
sonalkr132 committed Dec 19, 2015
1 parent bc8bb51 commit 6fc09c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/spring/client/run.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require "spring/commands"
require "rbconfig"
require "socket"
require "bundler"
Expand Down Expand Up @@ -139,6 +138,7 @@ def run_command(client, application)
if pid && !pid.empty?
log "got pid: #{pid}"

require "spring/commands"
puts "Running via Spring preloader in process #{pid}" unless Spring.quiet

forward_signals(pid.to_i)
Expand Down
7 changes: 7 additions & 0 deletions lib/spring/test/acceptance_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,13 @@ def exec_name
end
end

test "spring commands when spring gem is missing" do
File.write(app.gemfile, app.gemfile.read.gsub(/gem 'spring.*/, ""))
app.run "bundle install"
assert_success "spring -v", stdout: "Spring version"
assert_success "spring help", stdout: "Usage: spring COMMAND [ARGS]"
end

test "binstub when spring binary is missing" do
begin
File.rename(app.path("bin/spring"), app.path("bin/spring.bak"))
Expand Down

0 comments on commit 6fc09c0

Please sign in to comment.