なるようになるブログ

読書感想文かrailsについてかrubyについてか

rails commit log流し読み(2022/12/20)

2022/12/20分のコミットです。

CHANGELOGにのったコミットは以下の通りです。

railties/CHANGELOG.md


Add default Dockerfiles (#46762)

railtiesの修正です。

rails newで新規アプリケーション作成時にDocker関連のファイル(Dockerfile.dockerignorebin/docker-entrypoint)を生成するよう修正しています。なお、このDockerfileはproduction向けで、development向けの設定にはなっていません。


Add additional ignored files to the .dockerignore template (#46772)

railties/lib/rails/generators/rails/app/templates/dockerignore.ttの修正です。

デフォルトのignore対象に.envnode_modulesなどを追加しています。


Peek message before attempting to deserialize ActiveSupport::Message::Metadata using JSON

activesupport/lib/active_support/messages/metadata.rbの修正です。

ActiveSupport::Message::Metadata#extract_metadataでパース対象のデータがJSON形式でない場合、不要なJSONのdecode処理を行わないよう修正しています。


Fix a generators guide link to Thor actions

rails guideのCreating and Customizing Rails Generators & Templatesの修正です。

Thor gemのdocへのリンクが壊れていたのを修正しています。


Fix link to Thor docs [ci-skip]

rails guideのRails Application Templatesの修正です。

Thor gemのdocへのリンクが壊れていたのを修正しています。


Skip Docker-related files for plugin dummy apps

railties/lib/rails/generators/rails/app/app_generator.rbの修正です。

rais plugin用のdummy applicationでは、Docker関連のファイルを生成しないよう修正しています。


Merge pull request #46755 from jonathanhefner/messages-rotation_coordinator-transitional

activesupport/lib/active_support/messages/rotation_coordinator.rbの修正です。

MessageEncryptors#transitional及びMessageVerifiers#transitional accessorを追加しています。trueが設定された場合、message encryptor/verifier生成の際にrotation optionがswapして使われるようになります。


Support Message{Encryptors,Verifiers}#rotate block

activesupport/lib/active_support/messages/rotation_coordinator.rbの修正です。

MessageEncryptors#rotate及びMessageVerifiers#rotateにblockを指定出来るよう修正しています。blockにはsaltが渡されるようになっており、saltの値によって動的にrotateに指定するoptionsを変更出来るようになっています。

encryptors = ActiveSupport::MessageEncryptors.new { ... }

encryptors.rotate do |salt|
  case salt
  when :foo
    { serializer: JSON, url_safe: true }
  when :bar
    { serializer: Marshal, url_safe: true }
  end
end

Merge pull request #46769 from corneverbruggen/corneverbruggen-sti-guides-fix

rails guideのAutoloading and Reloading Constantsの修正です。

collapsed directoryをpreloadする場合のexampleで、eager loadがfalseの場合も、namespaceのcollapse処理が行われるよう修正しています。不要なnamespaceが定義されるのを避ける為。


Add CMD and refactor ENTRYPOINT in the Docker generator (#46778)

railties/lib/rails/generators/rails/app/templates/Dockerfile.ttrailties/lib/rails/generators/rails/app/templates/docker-entrypoint.ttの修正です。

デフォルトでrails serverが起動するようDockerfileCMDの指定を追加、及び、左記対応により不要になった引数未指定時の挙動をbin/docker-entrypointから削除しています。


Run under bash to avoid syntax error in conditional

railties/lib/rails/generators/rails/app/templates/docker-entrypoint.ttの修正です。

bashでコマンドが実行されるようshebangの指定を修正しています。syntax errorになるのを避ける為。


Consistent no-period comments

railties/lib/rails/generators/rails/app/templates/Dockerfile.ttのdocの修正です。

コメント行の末尾から不要なピリオドを削除しています。