guard-jasmine rake task and env specific gems

68 views
Skip to first unread message

Huy Nguyen

unread,
Sep 12, 2012, 3:35:58 PM9/12/12
to guar...@googlegroups.com
I was trying to put in a rake task to run guard-jasmine for ci instead of shelling out. The problem is that rake tasks are all loaded and parsed for any rake task. My guard-jasmine gem is only in the development and test groups, but when I try something like rake db:migrate for the staging environment it blows up on the require 'guard/jasmine/tasks' line. I've resorted back to shelling out but was wondering if I was missing something obvious?


Michael Kessler

unread,
Sep 13, 2012, 5:02:30 AM9/13/12
to guar...@googlegroups.com
If the gem is not available in the current environment, then the Rake task cannot be loaded. You can simply check the environment like this:

if RAILS_ENV == 'test'
require 'guard/jasmine/task'
Guard::JasmineTask.new
end

I for myself prefer the thor based command line utility `guard-jasmine` over the Rake task for the CI.

Huy Nguyen

unread,
Sep 13, 2012, 2:29:31 PM9/13/12
to guar...@googlegroups.com
My original task was shelling out to guard-jasmine binary as well, but just wanted to double check if there wasn't some rails standard practice I was missing. Thanks for your help!
Reply all
Reply to author
Forward
0 new messages