Request: newline missing in emfile when using gem statement in Rails 3 templates

Found it in rails/railties/lib/rails/generators/actions.rb

  def gem(..)
    ...
    in_root do
      append_file "Gemfile", "gem #{parts.join(", ")}", :verbose =>
false
    end

Should add a newline!

append_file "Gemfile", "gem #{parts.join(", ")}\n", :verbose => false

Or perhaps extend with a new utility function:

def append_line_file(file, txt, *args)
  append_file file, "#{txt}\n", args
end

I propose the following fix:

module Thor
  class Actions
    def append_line_file(file, txt, *args)
      append_file file, "#{txt}\n", args
    end
  end
end

module Rails
  module Generators
    module Actions
      def gem(*args)
        options = args.extract_options!
        name, version = args

        # Deal with deprecated options
        { :env => :only, :lib => :require_as }.each do |old, new|
          next unless options[old]
          options[new] = options.delete(old)
          ActiveSupport::Deprecation.warn "#{old.inspect} option in
gem is deprecated, use #{new.inspect} instead"
        end

        # Deal with deprecated source
        if source = options.delete(:source)
          ActiveSupport::Deprecation.warn ":source option in gem is
deprecated, use add_source method instead"
          add_source(source)
        end

        # Set the message to be shown in logs. Uses the git repo if
one is given,
        # otherwise use name (version).
        parts, message = [ name.inspect ], name
        if version ||= options.delete(:version)
          parts << version
          message << " (#{version})"
        end
        message = options[:git] if options[:git]

        log :gemfile, message

        options.each do |option, value|
          parts << ":#{option} => #{value.inspect}"
        end

        in_root do
          append_line_file "Gemfile", "gem #{parts.join(",
")}", :verbose => false
        end
      end
    end
  end
end