New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rake task exclusive gems #294

Closed
hiroshi opened this Issue Apr 20, 2010 · 2 comments

Comments

Projects
None yet
2 participants
@hiroshi

hiroshi commented Apr 20, 2010

I'd like to have lines in a Gemfile like:

group :tasks do
  gem 'ar_fixtures'
end

and/or

gem 'ar_fixtures', :tasks => true

then

$ rake -T
...
db:fixtures:dump   # Dump data to the test/fixtures/ directory.
...
@indirect

This comment has been minimized.

Show comment
Hide comment
@indirect

indirect Apr 20, 2010

Member

You can. Just do the first thing you suggested, with group :tasks, and then put this at the top of your Rakefile:

require 'bundler'
Bundler.require(:tasks)
Member

indirect commented Apr 20, 2010

You can. Just do the first thing you suggested, with group :tasks, and then put this at the top of your Rakefile:

require 'bundler'
Bundler.require(:tasks)
@hiroshi

This comment has been minimized.

Show comment
Hide comment
@hiroshi

hiroshi Apr 20, 2010

Thanks for your reply. I can exclusively require those gem only with rake command.

After Bundler.require(:tasks), we can load .rake file like that:

Bundler.require(:tasks)
def load_task(task_file)
  load Dir[Bundler.bundle_path + "gems/*/{tasks,rails/tasks,lib/tasks}/#{task_file}.rake"].first
end
load_task "ar_fixtures"

hiroshi commented Apr 20, 2010

Thanks for your reply. I can exclusively require those gem only with rake command.

After Bundler.require(:tasks), we can load .rake file like that:

Bundler.require(:tasks)
def load_task(task_file)
  load Dir[Bundler.bundle_path + "gems/*/{tasks,rails/tasks,lib/tasks}/#{task_file}.rake"].first
end
load_task "ar_fixtures"

This issue was closed.

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