はじめに
Rails 6 に追加された新機能を試す第123段。 今回は、Gemfile
編です。
Rails 6 では、 rails new
するときに --skip-test
などのオプションつきで、実行したときに、空行が2行にならないように修正されています。
Ruby 2.6.5, Rails 6.0.2.1, Rails 5.2.4.1 で確認しました。 (Rails 6.0.0 でこの修正が入っています。)
$ rails --version
Rails 6.0.2.1
今回は、 rails new --skip-test
でGemfileを作成して中身を確認します。
Rails プロジェクトを作る
Rails プロジェクトを新たに作成します。
$ rails new --skip-test rails_sandbox
$ cd rails_sandbox
Gemfile を確認する
Gemfile を確認すると、 :development
group の次の1行だけが空行になっています。
Gemfile
group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https:
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Rails 5では、
Rails 5.2.4.1 では、以下のように2行空いてます。
Gemfile
group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
本当に「ちょい足し」の中の「ちょい足し」ですが、こういった些細なところも放置しないで、修正されていくことが、Rails のコードの品質を良くし、Railsが「生き続ける」ための重要な要素だと思いました。