module Thor::Actions

def append_file(path, data=nil, config={}, &block)


append_file 'config/environments/test.rb', 'config.gem "rspec"'

==== Example

config:: give :verbose => false to not log the status.
data:: the data to append to the file, can be also given as a block.
path:: path of the file to be changed
==== Parameters

Append text to a file.
def append_file(path, data=nil, config={}, &block)
  return unless behavior == :invoke
  path = File.expand_path(path, destination_root)
  say_status :append, relative_to_original_destination_root(path), config.fetch(:verbose, true)
  File.open(path, 'ab') { |file| file.write(data || block.call) } unless options[:pretend]
end