Browse Source

no production ready yet

main
pvincent 1 year ago
parent
commit
49352e2d92
  1. 4
      .vscode/extensions.json
  2. 3
      README.md
  3. 1
      app/controllers/application_controller.rb
  4. 11
      app/controllers/main_controller.rb
  5. 2
      app/views/layouts/application.html.erb
  6. 16
      app/views/main/home.html.erb

4
.vscode/extensions.json

@ -3,6 +3,8 @@
"rebornix.ruby", "rebornix.ruby",
"bung87.rails", "bung87.rails",
"aliariff.vscode-erb-beautify", "aliariff.vscode-erb-beautify",
"yzhang.markdown-all-in-one"
"yzhang.markdown-all-in-one",
"arturock.gitstash",
"bradlc.vscode-tailwindcss"
] ]
} }

3
README.md

@ -8,13 +8,14 @@
* [x] Semantic Logging (efficient for dark theme) * [x] Semantic Logging (efficient for dark theme)
* [x] Max duration to complete in order to prevent long action * [x] Max duration to complete in order to prevent long action
* [x] tailwindcss-rails * [x] tailwindcss-rails
* [ ] PRODUCTION ready, not yet!!!
## Interesting Gems to try out ## Interesting Gems to try out
* [ ] ViewComponent ??
* [ ] Devise Vs Authentication-Zero * [ ] Devise Vs Authentication-Zero
* [ ] Devise * [ ] Devise
* [ ] **Noticed** * [ ] **Noticed**
* [ ] CANCANCAN * [ ] CANCANCAN
* [ ] ViewComponent ??
* [ ] AASM - State machines * [ ] AASM - State machines
* [ ] SimpleForm * [ ] SimpleForm

1
app/controllers/application_controller.rb

@ -6,7 +6,6 @@ class ApplicationController < ActionController::Base
begin begin
action.call action.call
ensure ensure
ActionView::Base.logger.level = :info
duration = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start duration = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
if duration > MAX_DURATION_TO_COMPLETE_IN_SECONDS if duration > MAX_DURATION_TO_COMPLETE_IN_SECONDS
logger.warn("processing took too long to complete, please review your code as asynchronous job!", duration: duration * 1_000) logger.warn("processing took too long to complete, please review your code as asynchronous job!", duration: duration * 1_000)

11
app/controllers/main_controller.rb

@ -5,11 +5,14 @@ class MainController < ApplicationController
def about def about
logger.debug "some debugging info" logger.debug "some debugging info"
logger.info "line1\nline2\nline3"
logger.info "relevant information"
logger.info "multiline\nline2\nline3"
logger.warn "a warning" logger.warn "a warning"
logger.error "an error"
# logger.error "an error"
raise "this is an error"
sleep 3
# raise "this is an error"
# sleep 3
end end
end end

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

@ -10,7 +10,7 @@
<%= javascript_importmap_tags %> <%= javascript_importmap_tags %>
</head> </head>
<body> <body>
<nav>
<nav >
<%= link_to 'home', :root %> <%= link_to 'home', :root %>
<%= link_to 'about', main_about_path %> <%= link_to 'about', main_about_path %>
</nav> </nav>

16
app/views/main/home.html.erb

@ -1,5 +1,11 @@
<h1>Main#home</h1>
<p>Find me in app/views/main/home.html.erb</p>
<h1 class="text-3xl font-bold underline text-red-400">
Hello world!
</h1>
<div class="p-5">
<h1>Main#home</h1>
<p>Find me in app/views/main/home.html.erb</p>
<h1 class="text-5xl font-bold underline text-yellow-400">
Hello world!
</h1>
<div class="bg-orange-300">
coucou
<%= @value %>
</div>
</div>
Loading…
Cancel
Save