From 386c116fb4932e7a105034ceb8435f65249a3ab7 Mon Sep 17 00:00:00 2001 From: masakazutakewaka Date: Sun, 21 Jul 2019 21:04:01 -0700 Subject: create a newline between blocks when gem_group, github and add_source was called. --- railties/lib/rails/generators/actions.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'railties/lib/rails/generators') diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb index c3a43d5398..b6225cd8c0 100644 --- a/railties/lib/rails/generators/actions.rb +++ b/railties/lib/rails/generators/actions.rb @@ -57,7 +57,7 @@ module Rails log :gemfile, "group #{str}" in_root do - append_file_with_newline "Gemfile", "group #{str} do", force: true + append_file_with_newline "Gemfile", "\ngroup #{str} do", force: true with_indentation(&block) append_file_with_newline "Gemfile", "end", force: true end @@ -70,7 +70,11 @@ module Rails log :github, "github #{str}" in_root do - append_file_with_newline "Gemfile", "#{indentation}github #{str} do", force: true + if @indentation.zero? + append_file_with_newline "Gemfile", "\ngithub #{str} do", force: true + else + append_file_with_newline "Gemfile", "#{indentation}github #{str} do", force: true + end with_indentation(&block) append_file_with_newline "Gemfile", "#{indentation}end", force: true end @@ -90,7 +94,7 @@ module Rails in_root do if block - append_file_with_newline "Gemfile", "source #{quote(source)} do", force: true + append_file_with_newline "Gemfile", "\nsource #{quote(source)} do", force: true with_indentation(&block) append_file_with_newline "Gemfile", "end", force: true else -- cgit v1.2.3