diff --git a/Gemfile b/Gemfile index 9c637ff..e015e4b 100644 --- a/Gemfile +++ b/Gemfile @@ -6,28 +6,37 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '3.0.3' # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" -gem 'rails', '~> 7.0.0.alpha2' +gem 'rails', '~> 7.0.0.rc1' + +# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] +gem 'sprockets-rails', '>= 3.4.1' # Use postgresql as the database for Active Record gem 'pg', '~> 1.1' # Use the Puma web server [https://github.com/puma/puma] -gem 'puma', '~> 5.5' +gem 'puma', '~> 5.0' # Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails] -gem 'importmap-rails', '>= 0.3.4' +gem 'importmap-rails', '>= 0.9.2' # Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev] -gem 'turbo-rails', '>= 0.7.11' +gem 'turbo-rails', '>= 0.9.0' # Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev] -gem 'stimulus-rails', '>= 0.4.0' +gem 'stimulus-rails', '>= 0.7.3' # Build JSON APIs with ease [https://github.com/rails/jbuilder] gem 'jbuilder', '~> 2.11' # Use Redis adapter to run Action Cable in production -gem 'redis', '~> 4.5' +gem 'redis', '~> 4.0' + +# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis] +# gem "kredis" + +# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword] +# gem "bcrypt", "~> 3.1.7" # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] @@ -35,9 +44,6 @@ gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] # Reduces boot times through caching; required in config/boot.rb gem 'bootsnap', '>= 1.4.4', require: false -# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword] -# gem "bcrypt", "~> 3.1.7" - # Use Sass to process CSS # gem "sassc-rails", "~> 2.1" @@ -49,7 +55,7 @@ gem 'bundler-audit' gem 'rubocop-rails' group :development, :test do - # Start debugger with binding.b [https://github.com/ruby/debug] + # See https://edgeguides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem gem 'debug', '>= 1.0.0', platforms: %i[mri mingw x64_mingw] gem 'rspec-rails' gem 'rubocop-rspec' @@ -60,8 +66,8 @@ group :development do gem 'web-console', '>= 4.1.0' # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler] - # gem "rack-mini-profiler", ">= 2.3.3" + gem 'rack-mini-profiler', '>= 2.3.3' # Speed up commands on slow machines / big apps [https://github.com/rails/spring] - # gem "spring" + # gem 'spring' end diff --git a/Gemfile.lock b/Gemfile.lock index 612425c..3b28d77 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,60 +1,61 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.0.0.alpha2) - actionpack (= 7.0.0.alpha2) - activesupport (= 7.0.0.alpha2) + actioncable (7.0.0.rc1) + actionpack (= 7.0.0.rc1) + activesupport (= 7.0.0.rc1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.0.alpha2) - actionpack (= 7.0.0.alpha2) - activejob (= 7.0.0.alpha2) - activerecord (= 7.0.0.alpha2) - activestorage (= 7.0.0.alpha2) - activesupport (= 7.0.0.alpha2) + actionmailbox (7.0.0.rc1) + actionpack (= 7.0.0.rc1) + activejob (= 7.0.0.rc1) + activerecord (= 7.0.0.rc1) + activestorage (= 7.0.0.rc1) + activesupport (= 7.0.0.rc1) mail (>= 2.7.1) - actionmailer (7.0.0.alpha2) - actionpack (= 7.0.0.alpha2) - actionview (= 7.0.0.alpha2) - activejob (= 7.0.0.alpha2) - activesupport (= 7.0.0.alpha2) + actionmailer (7.0.0.rc1) + actionpack (= 7.0.0.rc1) + actionview (= 7.0.0.rc1) + activejob (= 7.0.0.rc1) + activesupport (= 7.0.0.rc1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (7.0.0.alpha2) - actionview (= 7.0.0.alpha2) - activesupport (= 7.0.0.alpha2) + actionpack (7.0.0.rc1) + actionview (= 7.0.0.rc1) + activesupport (= 7.0.0.rc1) rack (~> 2.0, >= 2.2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.0.alpha2) - actionpack (= 7.0.0.alpha2) - activerecord (= 7.0.0.alpha2) - activestorage (= 7.0.0.alpha2) - activesupport (= 7.0.0.alpha2) + actiontext (7.0.0.rc1) + actionpack (= 7.0.0.rc1) + activerecord (= 7.0.0.rc1) + activestorage (= 7.0.0.rc1) + activesupport (= 7.0.0.rc1) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.0.alpha2) - activesupport (= 7.0.0.alpha2) + actionview (7.0.0.rc1) + activesupport (= 7.0.0.rc1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.0.alpha2) - activesupport (= 7.0.0.alpha2) + activejob (7.0.0.rc1) + activesupport (= 7.0.0.rc1) globalid (>= 0.3.6) - activemodel (7.0.0.alpha2) - activesupport (= 7.0.0.alpha2) - activerecord (7.0.0.alpha2) - activemodel (= 7.0.0.alpha2) - activesupport (= 7.0.0.alpha2) - activestorage (7.0.0.alpha2) - actionpack (= 7.0.0.alpha2) - activejob (= 7.0.0.alpha2) - activerecord (= 7.0.0.alpha2) - activesupport (= 7.0.0.alpha2) - marcel (~> 1.0.0) + activemodel (7.0.0.rc1) + activesupport (= 7.0.0.rc1) + activerecord (7.0.0.rc1) + activemodel (= 7.0.0.rc1) + activesupport (= 7.0.0.rc1) + activestorage (7.0.0.rc1) + actionpack (= 7.0.0.rc1) + activejob (= 7.0.0.rc1) + activerecord (= 7.0.0.rc1) + activesupport (= 7.0.0.rc1) + marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.0.alpha2) + activesupport (7.0.0.rc1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -113,39 +114,40 @@ GEM nio4r (~> 2.0) racc (1.6.0) rack (2.2.3) + rack-mini-profiler (2.3.3) + rack (>= 1.2.0) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (7.0.0.alpha2) - actioncable (= 7.0.0.alpha2) - actionmailbox (= 7.0.0.alpha2) - actionmailer (= 7.0.0.alpha2) - actionpack (= 7.0.0.alpha2) - actiontext (= 7.0.0.alpha2) - actionview (= 7.0.0.alpha2) - activejob (= 7.0.0.alpha2) - activemodel (= 7.0.0.alpha2) - activerecord (= 7.0.0.alpha2) - activestorage (= 7.0.0.alpha2) - activesupport (= 7.0.0.alpha2) + rails (7.0.0.rc1) + actioncable (= 7.0.0.rc1) + actionmailbox (= 7.0.0.rc1) + actionmailer (= 7.0.0.rc1) + actionpack (= 7.0.0.rc1) + actiontext (= 7.0.0.rc1) + actionview (= 7.0.0.rc1) + activejob (= 7.0.0.rc1) + activemodel (= 7.0.0.rc1) + activerecord (= 7.0.0.rc1) + activestorage (= 7.0.0.rc1) + activesupport (= 7.0.0.rc1) bundler (>= 1.15.0) - railties (= 7.0.0.alpha2) - sprockets-rails (>= 2.0.0) + railties (= 7.0.0.rc1) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.4.2) loofah (~> 2.3) - railties (7.0.0.alpha2) - actionpack (= 7.0.0.alpha2) - activesupport (= 7.0.0.alpha2) + railties (7.0.0.rc1) + actionpack (= 7.0.0.rc1) + activesupport (= 7.0.0.rc1) method_source - rake (>= 0.13) + rake (>= 12.2) thor (~> 1.0) - zeitwerk (~> 2.5.0.beta3) + zeitwerk (~> 2.5) rainbow (3.0.0) rake (13.0.6) redis (4.5.1) - regexp_parser (2.1.1) + regexp_parser (2.2.0) reline (0.2.7) io-console (~> 0.5) rexml (3.2.5) @@ -220,17 +222,19 @@ DEPENDENCIES brakeman bundler-audit debug (>= 1.0.0) - importmap-rails (>= 0.3.4) + importmap-rails (>= 0.9.2) jbuilder (~> 2.11) pg (~> 1.1) - puma (~> 5.5) - rails (~> 7.0.0.alpha2) - redis (~> 4.5) + puma (~> 5.0) + rack-mini-profiler (>= 2.3.3) + rails (~> 7.0.0.rc1) + redis (~> 4.0) rspec-rails rubocop-rails rubocop-rspec - stimulus-rails (>= 0.4.0) - turbo-rails (>= 0.7.11) + sprockets-rails (>= 3.4.1) + stimulus-rails (>= 0.7.3) + turbo-rails (>= 0.9.0) tzinfo-data web-console (>= 4.1.0) diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 4c9ab80..ddd546a 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -1,3 +1,4 @@ //= link_tree ../images //= link_directory ../stylesheets .css //= link_tree ../../javascript .js +//= link_tree ../../../vendor/javascript .js diff --git a/app/javascript/application.js b/app/javascript/application.js index 2706658..1c06223 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -1,5 +1,5 @@ // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails -import "controllers" import "@hotwired/turbo-rails" +import "controllers" console.log('Hello World from application.js'); diff --git a/app/javascript/controllers/application.js b/app/javascript/controllers/application.js index 09bc93e..d865bdd 100644 --- a/app/javascript/controllers/application.js +++ b/app/javascript/controllers/application.js @@ -3,9 +3,8 @@ import { Application } from "@hotwired/stimulus" const application = Application.start() // Configure Stimulus development experience -application.warnings = true -application.debug = false -window.Stimulus = application +application.debug = false +window.Stimulus = application export { application } diff --git a/app/javascript/controllers/index.js b/app/javascript/controllers/index.js index 1d80a12..54ad4ca 100644 --- a/app/javascript/controllers/index.js +++ b/app/javascript/controllers/index.js @@ -1,5 +1,11 @@ // Import and register all your controllers from the importmap under controllers/* import { application } from "controllers/application" -import { registerControllersFrom } from "@hotwired/stimulus-importmap-autoloader" -registerControllersFrom("controllers", application) + +// Eager load all controllers defined in the import map under controllers/**/*_controller +import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading" +eagerLoadControllersFrom("controllers", application) + +// Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!) +// import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading" +// lazyLoadControllersFrom("controllers", application) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index c09f91f..1d2c1c7 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -2,6 +2,7 @@