Barista is bundled with rake task called barista:brew. It's located inside barista/tasks folder as a default location for Rails 3 to pick up tasks. But other frameworks like rails 2.3 and sinatra don't load tasks by default from gems. So unfortunate owners of such projects need to manually load appropriate file like:
But default convention for rails 2.3 gems is to provide a helper file to include such tasks like require 'gem_name/tasks' so I've added such file.
But turns out there is another problem, barista is required in rake_task.rb immediately, therefore we get rake aborted! uninitialized constant Barista::Integration::Rails2::ActionController since environment for rails project isn't loaded yet. To fix this I've postponed requirement of barista in rake_task.rb until barista task is called so environment will be already setup.
rake aborted! uninitialized constant Barista::Integration::Rails2::ActionController
After applying this pull-request, any rails 2.x project owner can use barista tasks without a sweat.
require won't load the same file twice
Load barista for rake only when some barista task is called
Provide shortcut to add rake tasks for all who uses something else th…
…an rails 3
Update readme to reference using rake tasks with rails 2
This pull request is awesome!