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

Troubles to load rake task from gem #1077

Closed
morissetcl opened this issue Sep 29, 2020 · 2 comments
Closed

Troubles to load rake task from gem #1077

morissetcl opened this issue Sep 29, 2020 · 2 comments
Labels

Comments

@morissetcl
Copy link

Hi there,

First of all thx for the amazing work !

I'm trying to create a traceroute gem like for Hanami.
I am facing an issue. It sounds that currently it's not possible to load rake task in a Hanami app from a gem. When I run rake -T I have just default tasks and also custom ones added in rakelib..but impossible to load task from gem.

I tried many things to fix it, like:

# hanami/lib/hanami/rake_helper.rb
def self.install_tasks
  require 'hanami/environment'
  Hanami::Environment.new.require_project_environment
  new.install
end
# hanami/lib/hanami/rake_helper.rb
require "hanami"
...

def self.install_tasks
  Hanami.root.join("config", "environment.rb")
  new.install
end

It does the job and I'm able to load my task but test fails....anyway.
What could be the good way to fix that ? Any advice or idea ?

If you want to reproduce the issue you can fork hanami-traceroute, add it to your gemfile locally and run rake -T. The expected behaviour will be to have the following tasks printed:

rake environment                                   # Load the full project
rake hanami_traceroute                             # Prints out unused routes and unreachable action methods
rake hanami_traceroute:unreachable_action_methods  # Prints out unreachable action methods
rake hanami_traceroute:unused_routes               # Prints out unused routes
rake spec                                          # Run RSpec code examples

Let me know if I am not clear.

Thanks a lot.

@adam12
Copy link
Member

adam12 commented Feb 16, 2021

Hi @morissetcl

Are you still having issues with this? Have you given any thought to making a plugin instead?

@adam12
Copy link
Member

adam12 commented Mar 7, 2021

Closing for now. I think this would make for an interesting plugin if you wish to continue.

@adam12 adam12 closed this as completed Mar 7, 2021
@adam12 adam12 removed the waiting label Mar 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants