Skip to content
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

Task definition can't be in lib/tasks/ #12

Open
rylnd opened this issue May 13, 2015 · 2 comments
Open

Task definition can't be in lib/tasks/ #12

rylnd opened this issue May 13, 2015 · 2 comments

Comments

@rylnd
Copy link
Contributor

rylnd commented May 13, 2015

# lib/tasks/dredd_rack.rake
require 'dredd/rack'

Dredd::Rack::RakeTask.new

causes the same symptoms as described in #8.

The reason is that the hook that loads all these tasks, Rails.application.load_tasks, seems to load local tasks before the environment task, such that this condition is never met.

I wish I had the time and/or knowledge to figure out how to make this work. For now, placing the task definition after the load_tasks hook in the Rakefile is a reasonable workaround.

@gonzalo-bulnes
Copy link
Owner

Hi @rylnd!

Thanks for investigating this! There must be an explanation in the Rails initialisation process, I'll take a look at it.

@gonzalo-bulnes
Copy link
Owner

Would something like this help? (Seen in the grape-apiary docs)

spec = Gem::Specification.find_by_name 'grape-apiary'
load "#{spec.gem_dir}/lib/grape-apiary/tasks/grape-apiary.rake"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants