hotwired / turbo-rails

Use Turbo in your Ruby on Rails app
https://turbo.hotwired.dev
MIT License
2.13k stars 329 forks source link

Installation fails in Rails Engine #111

Open vangberg opened 3 years ago

vangberg commented 3 years ago

Hi!

I am trying to install turbo-rails in a Rails Engine.

Steps to reproduce:

  1. Create engine: rails plugin new rails-turbo-engine --mountable
  2. Add turbo-rails to Gemfile (or gemspec, same issue)
  3. Run bin/rails turbo:install

This fails with:

rails aborted!
Don't know how to build task 'turbo:install' (See the list of available tasks with `rails --tasks`)
Did you mean?  app:turbo:install

It seems like all tasks (including those provided by gems) are namespaced under app: in engines. So when I try app:turbo:install I get:

rails aborted!
Don't know how to build task 'turbo:install:asset_pipeline' (See the list of available tasks with `rails --tasks`)
Did you mean?  app:turbo:install:asset_pipeline

Tasks: TOP => app:turbo:install
(See full trace by running task with --trace)

Etc.

Repository for reproduction: https://github.com/vangberg/repro-rails-turbo-engine

FWIW, the same issue is present with tailwindcss-rails.

fuentesjr commented 3 years ago

Same with hotwire-rails: https://github.com/hotwired/hotwire-rails/issues/22

dhh commented 3 years ago

I didn't consider installing in an engine, so feel free to create a PR that rectifies that.

fuentesjr commented 3 years ago

@dhh Ok I'll start with a PR for this, and if the approach looks good, I can do something similar for https://github.com/hotwired/hotwire-rails/issues/22

alec-c4 commented 1 year ago

hey, any news with this issue?