Browse Source

default_url_options

main
pvincent 6 months ago
parent
commit
c66eb4e6d8
  1. 2
      Procfile.dev
  2. 8
      TODO.md
  3. 4
      app/controllers/scores_controller.rb
  4. 4
      config/environments/development.rb
  5. 4
      lib/formatters/ansi_formatter.rb

2
Procfile.dev

@ -1,3 +1,3 @@
web: TERMINAL_PREFIX=15 RUBY_DEBUG_OPEN=true bundle exec -- rails server --port "${RAILS_PORT:-7500}"
web: RUBY_DEBUG_OPEN=true bundle exec -- rails server --port "${RAILS_PORT:-7500}"
css: BROWSERSLIST_IGNORE_OLD_DATA=true bundle exec -- rails tailwindcss:watch css: BROWSERSLIST_IGNORE_OLD_DATA=true bundle exec -- rails tailwindcss:watch

8
TODO.md

@ -2,9 +2,6 @@ TODO
==== ====
* [ ] Minitest * [ ] Minitest
* [ ] Formatter
* [x] wrap warning containing \n
* [ ] "\e[0;35mhello".length => 12 instead of 5!
* [ ] Tailwind * [ ] Tailwind
* [ ] copy TailAdmin (or WindMill) layout * [ ] copy TailAdmin (or WindMill) layout
* [ ] https://demo.tailadmin.com/crm * [ ] https://demo.tailadmin.com/crm
@ -16,6 +13,7 @@ TODO
* [ ] smart filter search bar * [ ] smart filter search bar
* [ ] build auto-release notes based from TODO and New Notes * [ ] build auto-release notes based from TODO and New Notes
* [ ] semver_git_tag compatible * [ ] semver_git_tag compatible
* [ ] Use hotwire_livereload instead of rails_live_reload
* [ ] Ansi Formatter * [ ] Ansi Formatter
* [ ] fix: * [ ] fix:
``` ```
@ -26,3 +24,7 @@ TODO
New Notes New Notes
--------- ---------
* [x] Formatter
* [x] wrap warning containing \n
* [x] "\e[0;35mhello".length => 12 instead of 5!

4
app/controllers/scores_controller.rb

@ -46,7 +46,9 @@ class ScoresController < ApplicationController
end end
# GET /scores/1 # GET /scores/1
def show; end
def show
logger.info(Rails.application.routes.url_helpers.root_url)
end
# GET /scores/new # GET /scores/new
def new def new

4
config/environments/development.rb

@ -91,4 +91,8 @@ Rails.application.configure do # rubocop:disable Metrics/BlockLength
# config.semantic_logger.add_appender(io: $stdout, # config.semantic_logger.add_appender(io: $stdout,
# formatter: BasicFormatter.new, # formatter: BasicFormatter.new,
# filter: BasicFormatter::EXCLUDE_LAMBDA) # filter: BasicFormatter::EXCLUDE_LAMBDA)
#
routes.default_url_options[:host] = '127.0.0.1'
routes.default_url_options[:port] = ARGV[0] == '--port' ? ARGV[1] : 3000 # ie: Procfile.dev first two arguments
end end

4
lib/formatters/ansi_formatter.rb

@ -85,7 +85,9 @@ class AnsiFormatter < SemanticLogger::Formatters::Color
log.message = two_captures_last_as_bold(log.message, /(^Processing by \w*#\w* as )(.*)/) log.message = two_captures_last_as_bold(log.message, /(^Processing by \w*#\w* as )(.*)/)
end end
elsif log.message =~ /Redirected/ elsif log.message =~ /Redirected/
log.message = two_captures_last_as_bold(log.message, /^(Redirected to )http:.*:\d+(.*)/)
log.level = :debug
log.message = two_captures_last_as_bold(log.message,
/^(Redirected to )#{Rails.application.routes.url_helpers.root_url.chop}(.*)/)
end end
elsif log.exception elsif log.exception
log.dimensions = AnsiDimensions.new( log.dimensions = AnsiDimensions.new(

Loading…
Cancel
Save