Browse Source

easygoing

pagy
pvincent 10 months ago
parent
commit
b23604b74a
  1. 32
      README.md
  2. 2
      app/views/layouts/application.html.erb
  3. 2
      app/views/scores/index.html.erb
  4. 6
      config/application.rb
  5. 6
      config/boot.rb
  6. 2
      config/environment.rb
  7. 10
      config/importmap.rb
  8. 18
      config/puma.rb

32
README.md

@ -1,4 +1,4 @@
# README
# Easy Going Rails
## Install from scratch Debian 12 (bookworm) ## Install from scratch Debian 12 (bookworm)
@ -26,29 +26,27 @@ development:
rails generate scaffold score name:string grade:integer rails generate scaffold score name:string grade:integer
rails db:migrate rails db:migrate
## Gemfile
```yaml
group :development do
[...]
gem 'rubocop', require: false
end
```
## Debugger via ruby-lsp
* run OK, but without Procfile (no more tailwincss/watch)
* attach disfunctions (attach PORT but no interaction/stop/run)
## Extensions
## Featuring
* [x] VsCodium development improvement
* [x] Ruby-lsp * [x] Ruby-lsp
* [x] Ruby-lsp-rails * [x] Ruby-lsp-rails
* [x] Ruby Db Schema * [x] Ruby Db Schema
* [x] Markdown All in One * [x] Markdown All in One
* [x] TODO Highliter * [x] TODO Highliter
* [x] run ` rails notes` to show up any TODO or FIXME * [x] run ` rails notes` to show up any TODO or FIXME
* [x] Debugger friendly
* [x] ask before killing ./bin/dev
* [x] Tailwind CSS * [x] Tailwind CSS
* [x] plugin for completion
* [x] Rails Live Reload * [x] Rails Live Reload
* [x] compliance with Tailwind
* [x] Custom Progress Bar
* [x] compliant with Tailwind build
## TODO
* [x] Customized Turbo
* [x] Progress Bar
* [ ] Confirm Method using HTML modal
* [ ] Production Ready
* [ ] ./bin/prod
* [ ] Log

2
app/views/layouts/application.html.erb

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title><%=Rails.application.class.module_parent%></title>
<title><%=Rails.configuration.application_title%></title>
<meta name="viewport" content="width=device-width,initial-scale=1"> <meta name="viewport" content="width=device-width,initial-scale=1">
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
<%= csp_meta_tag %> <%= csp_meta_tag %>

2
app/views/scores/index.html.erb

@ -1,4 +1,4 @@
<div class="w-full bg-yellow-300">
<div class="w-full bg-yellow-300 p-4">
<% if notice.present? %> <% if notice.present? %>
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p> <p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
<% end %> <% end %>

6
config/application.rb

@ -5,7 +5,8 @@ require 'rails/all'
# you've limited to :test, :development, or :production. # you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups) Bundler.require(*Rails.groups)
module EasyRails
# Module name provides the main application title, ie: config.application_title defined below
module EasyGoingRails
# Main Application # Main Application
class Application < Rails::Application class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version. # Initialize configuration defaults for originally generated Rails version.
@ -16,6 +17,9 @@ module EasyRails
# Common ones are `templates`, `generators`, or `middleware`, for example. # Common ones are `templates`, `generators`, or `middleware`, for example.
config.autoload_lib(ignore: %w[assets tasks]) config.autoload_lib(ignore: %w[assets tasks])
# main application title defined from current module name, see module above
config.application_title = module_parent.to_s.titleize
# Configuration for the application, engines, and railties goes here. # Configuration for the application, engines, and railties goes here.
# #
# These settings can be overridden in specific environments using the files # These settings can be overridden in specific environments using the files

6
config/boot.rb

@ -1,4 +1,4 @@
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require "bundler/setup" # Set up gems listed in the Gemfile.
require "bootsnap/setup" # Speed up boot time by caching expensive operations.
require 'bundler/setup' # Set up gems listed in the Gemfile.
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.

2
config/environment.rb

@ -1,5 +1,5 @@
# Load the Rails application. # Load the Rails application.
require_relative "application"
require_relative 'application'
# Initialize the Rails application. # Initialize the Rails application.
Rails.application.initialize! Rails.application.initialize!

10
config/importmap.rb

@ -1,7 +1,7 @@
# Pin npm packages by running ./bin/importmap # Pin npm packages by running ./bin/importmap
pin "application"
pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
pin "@hotwired/stimulus", to: "stimulus.min.js"
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js"
pin_all_from "app/javascript/controllers", under: "controllers"
pin 'application'
pin '@hotwired/turbo-rails', to: 'turbo.min.js', preload: true
pin '@hotwired/stimulus', to: 'stimulus.min.js'
pin '@hotwired/stimulus-loading', to: 'stimulus-loading.js'
pin_all_from 'app/javascript/controllers', under: 'controllers'

18
config/puma.rb

@ -7,29 +7,29 @@
# Any libraries that use thread pools should be configured to match # Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum # the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record. # and maximum; this matches the default thread size of Active Record.
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
max_threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }
min_threads_count = ENV.fetch('RAILS_MIN_THREADS') { max_threads_count }
threads min_threads_count, max_threads_count threads min_threads_count, max_threads_count
# Specifies that the worker count should equal the number of processors in production. # Specifies that the worker count should equal the number of processors in production.
if ENV["RAILS_ENV"] == "production"
require "concurrent-ruby"
worker_count = Integer(ENV.fetch("WEB_CONCURRENCY") { Concurrent.physical_processor_count })
if ENV['RAILS_ENV'] == 'production'
require 'concurrent-ruby'
worker_count = Integer(ENV.fetch('WEB_CONCURRENCY') { Concurrent.physical_processor_count })
workers worker_count if worker_count > 1 workers worker_count if worker_count > 1
end end
# Specifies the `worker_timeout` threshold that Puma will use to wait before # Specifies the `worker_timeout` threshold that Puma will use to wait before
# terminating a worker in development environments. # terminating a worker in development environments.
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
worker_timeout 3600 if ENV.fetch('RAILS_ENV', 'development') == 'development'
# Specifies the `port` that Puma will listen on to receive requests; default is 3000. # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
port ENV.fetch("PORT") { 3000 }
port ENV.fetch('PORT') { 3000 }
# Specifies the `environment` that Puma will run in. # Specifies the `environment` that Puma will run in.
environment ENV.fetch("RAILS_ENV") { "development" }
environment ENV.fetch('RAILS_ENV') { 'development' }
# Specifies the `pidfile` that Puma will use. # Specifies the `pidfile` that Puma will use.
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
pidfile ENV.fetch('PIDFILE') { 'tmp/pids/server.pid' }
# Allow puma to be restarted by `bin/rails restart` command. # Allow puma to be restarted by `bin/rails restart` command.
plugin :tmp_restart plugin :tmp_restart
Loading…
Cancel
Save