method

prepend_to_file

ruby latest stable - Class: Bundler::Thor::Actions

Method not available on this version

This method is only available on newer versions. The first available version (v2_6_3) is shown here.

prepend_to_file(path, *args, &block)
public

Prepend text to a file. Since it depends on insert_into_file, it’s reversible.

Parameters

path

path of the file to be changed

data

the data to prepend to the file, can be also given as a block.

config

give :verbose => false to not log the status.

Example

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

prepend_to_file 'config/environments/test.rb' do
  'config.gem "rspec"'
end