hotwired / hotwire-rails

Use Hotwire in your Ruby on Rails app
https://hotwired.dev
MIT License
971 stars 27 forks source link

Installing inside a new rails engine fails #22

Closed fuentesjr closed 2 years ago

fuentesjr commented 3 years ago

I don't know if this is a missing feature, a bug, or I'm doing something completely wrong.

Steps to reproduce:

  1. rails plugin new blog --mountable
  2. cd blog and Edit blog.gemspec and add hotwire-rails dependency:
    
    require_relative "lib/blog/version"

Gem::Specification.new do |spec| spec.name = "blog" spec.version = Blog::VERSION spec.authors = ["John"] spec.email = ["John@blog.com"] spec.homepage = "http://blog.com" spec.summary = "Summary of Blog." spec.description = "Description of Blog." spec.license = "MIT"

Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'

to allow pushing to a single host or delete this section to allow pushing to any host.

spec.metadata["allowed_push_host"] = "'http://mygemserver.com'"

spec.metadata["homepage_uri"] = spec.homepage spec.metadata["source_code_uri"] = spec.homepage spec.metadata["changelog_uri"] = spec.homepage

spec.files = Dir["{app,config,db,lib}/*/", "MIT-LICENSE", "Rakefile", "README.md"]

spec.add_dependency "rails", "~> 6.1.1" spec.add_dependency "hotwire-rails", "~> 0.1.3"

3. `bin/ bundle install`
```sh                                                                                                                                                                                                                                                                                     
Fetching gem metadata from https://rubygems.org/.............                                                                                                                                                                                                                                                                            
Fetching gem metadata from https://rubygems.org/.                                                                                                                                                                                                                                                                                        
Resolving dependencies...                                                                                                                                                                                                                                                                                                                
Using rake 13.0.3                                                                                                                                                                                                                                                                                                                        
Using concurrent-ruby 1.1.8                                                                                                                                                                                                                                                                                                              
Using i18n 1.8.7                                                                                                                                                                                                                                                                                                                         
Using minitest 5.14.3                                                                                                                                                                                                                                                                                                                    
Using tzinfo 2.0.4                                                                                                                                                                                                                                                                                                                       
Using zeitwerk 2.4.2                                                                                                                                                                                                                                                                                                                     
Using activesupport 6.1.1                                                                                                                                                                                                                                                                                                                
Using builder 3.2.4                                                                                                                                                                                                                                                                                                                      
Using erubi 1.10.0                                                                                                                                                                                                                                                                                                                       
Using mini_portile2 2.5.0                                                                                                                                                                                                                                                                                                                
Using racc 1.5.2                                                                                                                                                                                                                                                                                                                         
Using nokogiri 1.11.1 (x86_64-darwin)                                                                                                                                                                                                                                                                                                    
Using rails-dom-testing 2.0.3                                                                                                                                                                                                                                                                                                            
Using crass 1.0.6                                                                                                                                                                                                                                                                                                                        
Using loofah 2.9.0                                                                                                                                                                                                                                                                                                                       
Using rails-html-sanitizer 1.3.0                                                                                                                                                                                                                                                                                                         
Using actionview 6.1.1                                                                                                                                                                                                                                                                                                                   
Using rack 2.2.3                                                                                                                                                                                                                                                                                                                         
Using rack-test 1.1.0                                                                                                                                                                                                                                                                                                                    
Using actionpack 6.1.1                                                                                                                                                                                                                                                                                                                   
Using nio4r 2.5.4                                                                                                                                                                                                                                                                                                                        
Using websocket-extensions 0.1.5                                                                                                                                                                                                                                                                                                         
Using websocket-driver 0.7.3                                                                                                                                                                                                                                                                                                             
Using actioncable 6.1.1                                                                                                                                                                                                                                                                                                                  
Using globalid 0.4.2                                                                                                                                                                                                                                                                                                                     
Using activejob 6.1.1
Using activemodel 6.1.1
Using activerecord 6.1.1
Using mimemagic 0.3.5
Using marcel 0.3.3
Using activestorage 6.1.1
Using mini_mime 1.0.2
Using mail 2.7.1
Using actionmailbox 6.1.1
Using actionmailer 6.1.1
Using actiontext 6.1.1
Using bundler 1.17.2
Using method_source 1.0.0
Using thor 1.1.0
Using railties 6.1.1
Using sprockets 4.0.2
Using sprockets-rails 3.2.2
Using rails 6.1.1
Fetching stimulus-rails 0.2.2
Installing stimulus-rails 0.2.2
Fetching turbo-rails 0.5.8
Installing turbo-rails 0.5.8
Fetching hotwire-rails 0.1.3
Installing hotwire-rails 0.1.3
Using blog 0.1.0 from source at `.`
Using sqlite3 1.4.2
Bundle complete! 2 Gemfile dependencies, 48 gems now installed.
Use bundle info [gemname] to see where a bundled gem is installed.

4.

bin/rails hotwire:install
rails aborted!
Don't know how to build task 'hotwire:install' (See the list of available tasks with `rails --tasks`)

(See full trace by running task with --trace)
  1. Adding require to lib/blog/engine.rb

    module Blog
    class Engine < ::Rails::Engine
    require 'hotwire-rails'
    
    isolate_namespace Blog
    end
    end

and executing bin/rails -T | grep "hotwire\|turbo\|stimulus" yields:

rails app:hotwire:install                    # Install Hotwire into the app
rails app:stimulus:install                   # Install Stimulus into the app
rails app:stimulus:install:asset_pipeline    # Install Stimulus on the app with the asset pipeline
rails app:stimulus:install:webpacker         # Install Stimulus on the app with webpacker
rails app:turbo:install                      # Install Turbo into the app
rails app:turbo:install:asset_pipeline       # Install Turbo into the app with asset pipeline
rails app:turbo:install:webpacker
  1. Executing bin/rails app:hotwire:install yields:
    
    rails aborted!
    Don't know how to build task 'stimulus:install:asset_pipeline' (See the list of available tasks with `rails --tasks`)

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



Versions:
➜  blog git:(master) ✗ ruby --version
ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-darwin18]
➜  blog git:(master) ✗ rails --version
Rails 6.1.1
dhh commented 3 years ago

Missing feature. Feel free to rectify this with a PR.