lib/spring/commands.rb in spring-1.1.3 vs lib/spring/commands.rb in spring-1.2.0
- old
+ new
@@ -30,11 +30,20 @@
# If the config/spring.rb contains requires for commands from other gems,
# then we need to be under bundler.
require "bundler/setup"
- Gem::Specification.map(&:name).grep(/^spring-commands-/).each do |command|
- require command
+ # Auto-require any spring extensions which are in the Gemfile
+ Gem::Specification.map(&:name).grep(/^spring-/).each do |command|
+ begin
+ require command
+ rescue LoadError => error
+ if error.message.include?(command)
+ require command.gsub("-", "/")
+ else
+ raise
+ end
+ end
end
config = File.expand_path("./config/spring.rb")
require config if File.exist?(config)
end