Support for rake tasks in rails 2.x #50

Merged
merged 4 commits into from Sep 3, 2011

Projects

None yet

3 participants

Contributor

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:

load 'barista/tasks/barista.rake'

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.

After applying this pull-request, any rails 2.x project owner can use barista tasks without a sweat.

This pull request is awesome!

@Sutto Sutto merged commit b2dae9f into Sutto:master Sep 3, 2011
Owner
Sutto commented Sep 3, 2011

Cheers, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment