2016/09/14分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
Merge pull request #26466 from y-yagi/remove_duplicated_fixture_set_names
activerecord/lib/active_record/fixtures.rb
の修正です。
fixture fileのパスを取得した際に、重複したパスを削除するよう修正しています。
取得したパスを元にして、define_method
でfixture用のメソッドを定義しているのですが、重複したパスがそのままだと同じメソッド名のメソッドを複数定義してしまい、Rubyのwarning(warning: method redefined
)が出てしまうため、同じ名前のメソッドが定義されるのを避ける為にパスを取得した時点で重複した値を削除するようにしています。
Merge pull request #26314 from frodsan/puma-ar-disconnect
railties/lib/rails/generators/rails/app/templates/config/puma.rb
の修正です。
rails new
した際に生成されるpumaの設定ファイルの雛形に、before_fork
時にActiveRecord::Base.connection_pool.disconnect!
を呼ぶexampleコードを追加しています。
# before_fork do # ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord) # end
preloadingを使用している場合、forkする為にconnectionをcloseしないと、connectionのleakが発生してしまう可能性があるため、との事です。
参考:disconnect from connection pool before forking still relevant? · Issue #1001 · puma/puma
5-0-backport: activerecord/mysql2: Avoid setting @connection to nil, just close it (#26473)
activerecord/CHANGELOG.md
の修正です。
先日コミットされた、ActiveRecord::ConnectionAdapters::Mysql2Adapter#disconnect!
でconnectionのclose処理後、@connection
にnilを設定していたのを、設定しないよう修正した対応についてCHANGELOGにentryを追加しています。
Address warning: ambiguous first argument; put parentheses or a space even after
/' operator`
activerecord/test/cases/adapters/mysql2/connection_test.rb
の修正です。
テスト内でRubyのwarning(warning: ambiguous first argument; put parentheses or a space even after
/' operator)が出ていたので、
assert_matchの引数を指定する際に
()`を指定するようにして対応しています。
Do not point to the 5-0-stable branch
railties/lib/rails/generators/app_base.rb
の修正です。
rails new
にedge
オプションを指定した場合に、gemの指定にbranch: 5-0-stable
が指定されてしまっていたのを、ブランチ名は指定しないよう修正しています。
edge
オプションを指定した場合は、master
ブランチが参照されるのが正しいため。
railties/test/generators/app_generator_test.rb
、
railties/test/generators/plugin_generator_test.rb
の修正です。
先のrails new
にedge
オプションを指定した場合にmaster
ブランチを参照するよう修正した対応の影響でコケてしまったテストがあったのを修正しています。
Move comment about disconnecting pool close to comment about preload
railties/lib/rails/generators/rails/app/templates/config/puma.rb
の修正です。
先に追加されたbefore_fork
時にActiveRecord::Base.connection_pool.disconnect!
を呼ぶexampleを、on_worker_boot
のcallbackのexampleの前に移動しています。before_fork
の方が先に実行されるブロックのため。
Fix broken comments indentation caused by rubocop auto-correct [ci skip]
rubocopの対応(normalizes indentation and whitespace across the project · rails/rails@80e66cc)でコメントのインデントも調整されてしまっていたのを、Style/CommentIndentation
の設定を追加しコメントの位置はメソッドの位置と揃うよう調整しています。
Override the github git source instead of changing manually all entries
Gemfile
の修正です。
Use :git for specifying dependencies from github with https protocolでGemfile
でgem先の指定にgithub
ショートハンドを使用していたのを明示的にhttps
のURLを指定するよう修正したのですが、再度github
ショートハンドを使用するよう修正しています。
合わせて、warningが出ないようGemfileの中でgithub
ショートハンドを使用した場合https
プロトコルを使用するようオーバーライドするよう処理を追加しています。
処理内容は下記の通り。
# Gemfile git_source(:github) do |repo_name| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") "https://github.com/#{repo_name}.git" end
Fix test for the edge generator
railties/test/generators/app_generator_test.rb
の修正です。
先のrails new
にedge
オプションを指定した場合にmaster
ブランチを参照するよう修正した対応の影響でコケてしまったテストがあったのを修正しています。