なるようになるブログ

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

rails commit log流し読み(2015/11/05)

2015/11/05分のコミットです。

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

railties/CHANGELOG.md


Remove incorrect comments

activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rbのdocの修正です。

docに、既に存在しないcolumns attributesについて説明している箇所があったので、削除しています。


Update docs/comments to use setup/teardown blocks vs. methods.

activesupport/lib/active_support/log_subscriber/test_helper.rbのdocの修正です。

ActiveSupport::LogSubscriber::TestHelper moduleを使用したexampleのsetup処理から、不要なsuperメソッドの呼び出しを削除しています。


formatting pass over Active Record changelog. [ci skip]

activerecord/CHANGELOG.mdの修正です。

CHANGELOG全体のフォーマット、グラマーの修正を行っています。


document try! in ActiveSupport core ext guide

rails guideのActive Support Core Extensionsの修正です。

try!メソッドについての説明を追加しています。


Move static_cache_contorl deprecation changelog entry to Railties.

actionpack/CHANGELOG.mdrailties/CHANGELOG.mdの修正です。

config.static_cache_controlをdeprecateにした対応(https://github.com/rails/rails/commit/9d05430c956c4ae1d0aefda02def5052ea818433)についてのエントリーを、Action PackのCHANGELOGからrailtiesCHANGELOGに移動しています。

environment filesの修正が必要な対応であり、environment filesはrailtiesの範疇の為との事です。


Merge pull request #22173 from kaspth/enable-public-file-server

railtiesの修正です。

config.serve_static_filesがdeprecateになりました。今後はconfig.public_file_server.enabledを使用する必要があります(設定する値は変わらずtrue/false)。

config.static_cache_controlconfig.public_file_server.headersに変更になったのに合わせて、static filesの使用設定についてもconfig.public_file_server配下の値を使用するようにしたとの事です。


tests, define Rails.root before loading Action Mailer. https://github.com/rails/rails/commit/a80fb6f9b3b553b59a486d7aa4673cc47397fab5

actionmailer/test/abstract_unit.rbactionmailer/test/delivery_methods_test.rbの修正です。

テスト実行前にRails.rootが必ずAction Mailerのロード前に定義されるよう、メソッドの定義箇所を修正しています。

元々は、rakeでテストを実行した場合はAcction Mailerのロード後に定義されて、bin/testでテストを実行した場合はAction Mailerのロード後に定義される、という状態になってしまっており、その影響でテストがコケてしまっていたので、ロード前に必ず定義するように、テストが通るよう対応しています。


Replace serve_static_files in tests with public_file_server.enabled.

railtiesのテストの修正です。

config.serve_static_filesを使用していたのを、public_file_server.enabledを使用するよう修正しています。


Replace serve_static_files mentions in docs.

各guideの修正です。

config.serve_static_filesを使用していたのを、public_file_server.enabledを使用するよう修正しています。


tests, test should not care wether 9ms or 11ms have passed.

actionpack/test/controller/log_subscriber_test.rbの修正です。

test_process_action_with_view_runtimeで、処理時間のマッチに、+を使用するよう修正しています。

-    assert_match(/Completed 200 OK in [\d]ms/, logs[1])
+    assert_match(/Completed 200 OK in \d+ms/, logs[1])

処理時間が二桁以上になった場合の事を考慮して修正しています。


Require only necessary concurrent-ruby classes.

concurrent-rubyを使用する際、必要なファイルのみrequireするよう修正しています。

例。

# activejob/lib/active_job/async_job.rb

-require 'concurrent'
+require 'concurrent/map'
+require 'concurrent/scheduled_task'
+require 'concurrent/executor/thread_pool_executor'
+require 'concurrent/utility/processor_counter'

concurrent自体をrequireすると、不要なファイルが大量にrequireされてしまい、起動時間が遅くなってしまう為、必要なファイルのみrequireするようにしたとの事です。詳細は Do we embrace Kernel#autoload ? · Issue #395 · ruby-concurrency/concurrent-ruby参照。


Add bundle check to release task

tasks/release.rbの修正です。

rails release用のtaskにbundle checkを追加しています。


Remove links to docrails

rails guideのContributing to Ruby on Railsの修正です。

docrails(http://github.com/rails/docrails)へのリンクを削除しています。

docrailsは、docrails自体にPRが投げられるのをを避ける為に、privateリポジトリに変更になった為、リンクを削除したとの事です。


Require the count_down_latch

activerecord/test/cases/migration_test.rbの修正です。

concurrent/atomic/count_down_latchのrequireを追加しています。


test_binary_data_is_not_logged is for prepared statements logging

activerecord/test/cases/log_subscriber_test.rbの修正です。

test_binary_data_is_not_loggedを実行するかどうかのチェックに、adapterがMysql2Adapterじゃないかどうかを使用していたのを、ActiveRecord::Base.connection.prepared_statementsを使用するよう修正しています。


No need MysqlDouble and MysqlDouble.reset_column_information

activerecord/test/cases/adapters/mysql/schema_test.rbactiverecord/test/cases/adapters/mysql2/schema_test.rbの修正です。

不要なMysqlDoubleクラス、及びMysqlDouble.reset_column_informationメソッドの呼び出しを削除しています。


Fix static_cache_control deprecation warning

railties/lib/rails/application/configuration.rbの修正です。

static_cache_controlを使用した場合に出力するdeprecateメッセージを修正しています。

# before
static_cache_control is deprecated and will be removed in Rails 5.1. Please use `config.public_file_server.headers = {'Cache-Control' => #{value}} instead

# after
`static_cache_control` is deprecated and will be removed in Rails 5.1. Please use `config.public_file_server.headers = { 'Cache-Control' => '#{value}' }` instead.

バッククォートが足りなかったのを修正、static_cache_controlをバッククォートで囲むよう修正、等表記の修正を行っています。