Betterment / demo_mode

A configurable demo mode for your Rails app. Specify your desired "personas" and Demo Mode will handle the rest.
MIT License
25 stars 8 forks source link

Propshaft #26

Open reesericci opened 3 months ago

reesericci commented 3 months ago

When running the installer, I ran into issues where the installer expected Sprockets:

/var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/sprockets-rails-3.5.1/lib/sprockets/railtie.rb:106:in `block in <class:Railtie>': Expected to find a manifest file in `app/assets/config/manifest.js` (Sprockets::Railtie::ManifestNeededError)
But did not, please create this file and use it to link any assets that need
to be rendered by your app:

Example:
  //= link_tree ../images
  //= link_directory ../javascripts .js
  //= link_directory ../stylesheets .css
and restart your server

For more information see: https://github.com/rails/sprockets/blob/070fc01947c111d35bb4c836e9bb71962a8e0595/UPGRADING.md#manifestjs
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/bundler/gems/rails-82054e8eb76a/railties/lib/rails/initializable.rb:32:in `instance_exec'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/bundler/gems/rails-82054e8eb76a/railties/lib/rails/initializable.rb:32:in `run'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/bundler/gems/rails-82054e8eb76a/railties/lib/rails/initializable.rb:61:in `block in run_initializers'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/3.3.0/tsort.rb:231:in `block in tsort_each'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/3.3.0/tsort.rb:353:in `block (2 levels) in each_strongly_connected_component'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/3.3.0/tsort.rb:434:in `each_strongly_connected_component_from'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/3.3.0/tsort.rb:352:in `block in each_strongly_connected_component'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/3.3.0/tsort.rb:350:in `each'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/3.3.0/tsort.rb:350:in `call'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/3.3.0/tsort.rb:350:in `each_strongly_connected_component'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/3.3.0/tsort.rb:229:in `tsort_each'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/3.3.0/tsort.rb:208:in `tsort_each'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/bundler/gems/rails-82054e8eb76a/railties/lib/rails/initializable.rb:60:in `run_initializers'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/bundler/gems/rails-82054e8eb76a/railties/lib/rails/application.rb:426:in `initialize!'
        from /var/home/reesericci/Code/united/config/environment.rb:5:in `<main>'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/kernel.rb:34:in `require'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/bundler/gems/rails-82054e8eb76a/railties/lib/rails/application.rb:402:in `require_environment!'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/bundler/gems/rails-82054e8eb76a/railties/lib/rails/command/actions.rb:20:in `boot_application!'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/bundler/gems/rails-82054e8eb76a/railties/lib/rails/commands/generate/generate_command.rb:21:in `perform'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/bundler/gems/rails-82054e8eb76a/railties/lib/rails/command/base.rb:178:in `invoke_command'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/bundler/gems/rails-82054e8eb76a/railties/lib/rails/command/base.rb:73:in `perform'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/bundler/gems/rails-82054e8eb76a/railties/lib/rails/command.rb:71:in `block in invoke'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/bundler/gems/rails-82054e8eb76a/railties/lib/rails/command.rb:149:in `with_argv'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/bundler/gems/rails-82054e8eb76a/railties/lib/rails/command.rb:69:in `invoke'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/bundler/gems/rails-82054e8eb76a/railties/lib/rails/commands.rb:18:in `<main>'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
        from /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        from bin/rails:4:in `<main>'
/var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30: warning: /var/home/reesericci/.rbenv/versions/3.3.2/lib/ruby/3.3.0/csv.rb was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add csv to your Gemfile or gemspec. Also contact author of spreadsheet_architect-5.0.0 to add csv into its gemspec.
bin/rails aborted!
Sprockets::Railtie::ManifestNeededError: Expected to find a manifest file in `app/assets/config/manifest.js` (Sprockets::Railtie::ManifestNeededError)
But did not, please create this file and use it to link any assets that need
to be rendered by your app:

Example:
  //= link_tree ../images
  //= link_directory ../javascripts .js
  //= link_directory ../stylesheets .css
and restart your server

For more information see: https://github.com/rails/sprockets/blob/070fc01947c111d35bb4c836e9bb71962a8e0595/UPGRADING.md#manifestjs
/var/home/reesericci/Code/united/config/environment.rb:5:in `<main>'
Tasks: TOP => db:migrate => db:load_config => environment
(See full trace by running task with --trace)
 ✘ reesericci@toolbox  ~/Code/united   main ● 
reesericci commented 3 months ago

I was looking at what Administrate (thoughtbot/administrate#2397) did, and they linked this blog post which might be useful: https://avohq.io/blog/how-to-bundle-assets-in-a-rails-engine

reesericci commented 3 months ago

Alright, I made a fork with the sprockets stuff removed but I don't think it retains backwards compatibility

smudge commented 2 months ago

Thanks @reesericci! Yeah, as it stands this gem still depends on Sprockets, but I really like the newer strategy of compiling at publish time. Not sure if I'll have a chance to implement it, but I'm open to reviewing PRs that swap the gem onto that strategy.

Or if there's a way to make it work as-is with Propshaft, I could see making both Sprockets and Propshaft optional dependencies, and then changing the engine boilerplate depending on which is available at runtime. (Not sure how possible that is, because I haven't had a chance to try it myself.)

reesericci commented 2 months ago

I can try to figure it out sometime soon, but it looked pretty complicated to my new-ish eyes, so I ended up going with the easier strategy of stripping out all the sprockets stuff. Happy to take another look at it when I'm free in a bit though.

smudge commented 2 months ago

Feel free to open more GH issues if you encounter anything or have feature ideas while using the gem! We're always interested in feedback. 😀