なるようになるブログ

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

rails commit log流し読み(2015/12/24)

2015/12/24分のコミットです。

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

actionview/CHANGELOG.md


release notes, Rails 5 won't support the protected_attribtues gem.

rails guideのRuby on Rails 5.0 Release Notesの修正です。

Active RecordRemovalsの項に、protected_attributes gemのサポートを削除したコミットを追加しています。


Require only the concurrent/map feature

actionview/lib/action_view/template/resolver.rbの修正です。

concurrent gemを使用するのに、concurrent自体をrequireするのでなく、必要な機能(concurrent/map)のみをrequireするよう修正しています。

-require "concurrent"
 +require "concurrent/map"

concurrent自体をrequireすると、不要なファイルが大量にrequireされてしまい、起動時間が遅くなってしまう為。


Plugin Usage and Installation instructions

railties/lib/rails/generators/rails/plugin/templates/README.mdの修正です。

rails plugin用のREADMEのテンプレートに、UsageInstallationContributingLicenseの項を追加しています。


Fixes LoggerSilence#silence threadsafety

activesupport/lib/active_support/logger.rbactivesupport/lib/active_support/logger_silence.rbの修正です。

LoggerSilence#silenceメソッドがthread unsafeだったのを、thread safeになるよう修正しています。

Concurrent::Mapを使用して、スレッド毎のlog levelを保持するように、対応を行っているようです。


Add caveat to number_to_currency docs [ci skip]

actionview/lib/action_view/helpers/number_helper.rbactionview/lib/action_view/helpers/number_helper.rbのdocの修正です。

number_to_currencyメソッドlocaleオプションを指定した場合、そのオプションにしたがって値を表示する(他の設定に依存しない)のですが、 localeを変更した場合に、表示自体は正しくても、金額の価値としては変わってしまう(10 US dollars10 Mexican Pesosに表示が変わった場合、実際の金額の価値は大分違う)ので、 ユーザが任意にlocaleを変更出来るようなアプリでは、注意が必要である旨説明を追加しています。


release notes, use past tense. [ci skip]

rails guideのRuby on Rails 5.0 Release Notesの修正です。

変更内容について説明をしている箇所で、動詞に過去形を使用する修正しています。


Improve readability of CacheHelper section

rails guideのAction View Overviewの酒精です。

cacheの項のグラマーの修正を行っています。


Merge pull request #22756 from lucasmazza/lm-test-reporter-colored-output

railties/lib/rails/test_unit/minitest_plugin.rbrailties/lib/rails/test_unit/reporter.rbの修正です。

Test Runnerで、テスト結果を色付き出力出来るよう対応しています。

PRより。

68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f732f307373346330703062376a6d756a762f323031352d31322d3232253230617425323031312e3036253230414d2e706e67 (953×412)

デフォルトは色付きで出力するようになっており、--no-colorオプションを指定すると、色無しになります。


[ci skip] Clarify why we're clearing reporters.

railties/lib/rails/test_unit/minitest_plugin.rbのdocの修正です。

Minitest.plugin_rails_initメソッド、minitestのreportersをclearしているのですが、それが何故必要かコメントを追加しています。

色付き出力ようにminitestのデフォルトのreporterを差し替える為に必要との事です。うーん。


Rewrite aggregated results suppression.

railties/lib/rails/test_unit/minitest_plugin.rbの修正です。

Test Runnerのreport処理用のmodule(Minitest::AggregatedResultSuppresion)を、MinitestのSummaryReporterクラスの子クラス(Minitest::AggregatedResultSuppresion)として書きなおしています。

何故当初SummaryReporterの子クラスとして実装しなかったのかわからないが、そちらの方が不要なメソッドを削除出来るし、不要なreporterを使用しないで良い、という理由で修正したとの事です。


Color failure line by result code.

railties/lib/rails/test_unit/reporter.rbの修正です。

テスト失敗時に使用する色を、:red固定にしていたのを、color変数を使用するよう修正しています。

:red固定だと、skipしたテストの場合も赤く表示されてしまう為、との事です。


Remove unused blue color.

railties/lib/rails/test_unit/reporter.rbの修正です。

COLOR_CODES定数から、使用していないblueを削除しています。


Rename color to color_output.

railties/lib/rails/test_unit/reporter.rbの修正です。

色付き出力用メソッドの名前を、#colorから#color_outputに変更しています。


Remove local variable color.

railties/lib/rails/test_unit/reporter.rbの修正です。

Rails::TestUnitReporter::color_outputメソッドの引数からcolorを指定する引数を削除し、代わりにテスト結果をまるまる渡せるよう修正しています。

出力する色の選定を#color_outputメソッドでする事により、呼び出し元からcolorの情報を保持する変数を削除出来るようにする為、との事です。


Move test coloring closer to where it's used.

railties/lib/rails/test_unit/reporter.rbの修正です。

各テスト結果毎に、何色を出力するかの情報を、クラスTOPで定義していたのを、実際必要な箇所(#color_outputメソッド)で値を定義するよう修正しています。


fix typo on comments

activesupport/lib/active_support/inflector/methods.rbのdocの修正です。

ActiveSupport::Inflector#classifyメソッドのdoc内にあるexampleの実行結果が、実際の結果と異なっていたのを修正しています。


Merge pull request #22778 from y-yagi/fix_submit_tag_with_symbol_value

actionview/lib/action_view/helpers/form_tag_helper.rbの修正です

submit_tagメソッドのラベル用引数に、symbolを渡した場合にTypeErrorが発生するリグレッションが発生していたのを修正しています。


:scissors: whitespace in generated config files [skip ci]

rails/railties/lib/rails/generators/rails/app/templates/config/initializers/active_record_belongs_to_required_by_default.rbrailties/lib/rails/generators/rails/app/templates/config/initializers/callback_terminator.rbのdocの修正です。

config.active_record.belongs_to_required_by_defaultについて説明しているdocの末尾に、不要なスペースがあったのを削除しています。