Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent generation extra empty lines in a plugin's Rakefile #30092

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ def test
template "test/test_helper.rb"
template "test/%namespaced_name%_test.rb"
append_file "Rakefile", <<-EOF
#{rakefile_test_tasks}

#{rakefile_test_tasks}
task default: :test
EOF
if engine?
Expand Down
11 changes: 5 additions & 6 deletions railties/lib/rails/generators/rails/plugin/templates/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,16 @@ RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_files.include('README.md')
rdoc.rdoc_files.include('lib/**/*.rb')
end

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to be explicit about the blank lines. Let's add the -%> in our ERB tags and keep the blank lines in the template.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

<% if engine? && !options[:skip_active_record] && with_dummy_app? -%>

APP_RAKEFILE = File.expand_path("<%= dummy_path -%>/Rakefile", __dir__)
load 'rails/tasks/engine.rake'
<% end %>

<% end -%>
<% if engine? -%>
load 'rails/tasks/statistics.rake'
<% end %>

load 'rails/tasks/statistics.rake'
<% end -%>
<% unless options[:skip_gemspec] -%>

require 'bundler/gem_tasks'
<% end %>
<% end -%>