if rails is loaded, but not well enough, load what we need for Jammit

This commit is contained in:
John Bintz 2011-06-16 10:27:16 -04:00
parent 3a11aea76f
commit eb2f282b46

View File

@ -1,6 +1,7 @@
require 'guard'
require 'guard/guard'
require 'jammit'
module Guard
class Jammit < Guard
@ -46,6 +47,7 @@ module Guard
end
def jammit
ensure_rails_env!
::Jammit.load_configuration ::Jammit::DEFAULT_CONFIG_PATH
puts "Jamming"
::Jammit.packager.force = true
@ -53,5 +55,11 @@ module Guard
true
end
private
def ensure_rails_env!
if !defined?(::Rails) || !::Rails.respond_to?(:env)
require 'rails'
end
end
end
end
end