rails/rails — pull request #7263 by acesuares (2012-08-04 16:59:59+00:00)
Title: added with_indent parameter to strip_heredoc

strip_heredoc strips all leading spaces/tabs from a heredoc.

But there are situations when you want to retain a certain indent, for instance, when inserting something in config/environments/production.rb

Example:
```ruby
module Module
class Creator < Thor
desc "dostuff NAME", "do stuff to NAME"
def dostuff(name)
insert_into_file "config/environments/production.rb", <<-HEREDOC.strip_heredoc(2), :before => "end\n"
# mailer settings
config.action_mailer.smtp_settings = {
:address => 'YOURMAILSERVER',
:enable_starttls_auto => true,
:password => 'YOURPASSWORD',
:user_name => 'YOURUSERNAME'
}

HEREDOC
end
end
end
```ruby

The result is that the inserted text is indented by 2 spaces, to align with the rest of production.rb.

Cheers
ace