From e0ae93658ec67c09102502049b7a5ba5b59110b0 Mon Sep 17 00:00:00 2001 From: pvincent Date: Thu, 25 Jul 2024 22:28:14 +0400 Subject: [PATCH] old_definitions in progress --- .env.sample | 4 ++-- README.md | 28 +++++++++++----------------- lib/hot_constants/hot_constants.rb | 6 ++++-- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/.env.sample b/.env.sample index c02fd80..a89e7d0 100644 --- a/.env.sample +++ b/.env.sample @@ -13,9 +13,9 @@ LOG_ACTIVE_RECORD=false LOG_ACTION_VIEW=false # with default value, type gets inferred from -INTEGER=1 +INTEGER=a STRING=456 -BOOLEAN=true +BOOLEAN=false # with no default value (evaluated to nil), type must be defined expressively otherwise it reverts to a string type # INTEGER=:integer diff --git a/README.md b/README.md index a63e9f6..4bbb976 100644 --- a/README.md +++ b/README.md @@ -10,20 +10,17 @@ gem install bundler bundle install ``` -### database.yml - -```yaml -[...] -development: - <<: *default - database: ruby-debug - user: ruby-debug - password: ruby-debug - host: ct1.lxd -[...] -``` -rails generate scaffold score name:string grade:integer -rails db:migrate +## DATABASE + +* # miaou, reuse dbs.lxd (or ct1.lxd) +* echo "DATABASE_HOST=ct1.lxd" >> .env +* # connect to miaou host +* db-psql create easy-going-rails + +## RUN + +* rails db:migrate +* ./bin/dev ## TODO @@ -69,9 +66,6 @@ rails db:migrate * [ ] remove /bin/setup * [ ] ask for main configuration (application_title, alpineJs) -* [ ] ViewComponent - * [ ] https://viewcomponent.org/ - * [ ] Postgresql text search * [ ] Fuzzy search with trigrams diff --git a/lib/hot_constants/hot_constants.rb b/lib/hot_constants/hot_constants.rb index 8a8a460..a72e753 100644 --- a/lib/hot_constants/hot_constants.rb +++ b/lib/hot_constants/hot_constants.rb @@ -44,8 +44,10 @@ module HotConstants new_env = Dotenv.parse constants_to_delete = HOTENV.except(*new_env.keys) - constants_to_delete.each do |constant| - LOGGER.info("constant <#{constant}> reverts to default value <#{}>") + constants_to_delete.each do |name, _| + # FIXME: default should read default and type from @old_definitions + type, default = @old_definitions[name] + LOGGER.info("constant <#{name}> reverts to default value <#{default}> of type <#{type}>") end constants_to_add = new_env.except(*HOTENV.keys)