module Thor::Actions
def prepend_file(path, *args, &block)
end
'config.gem "rspec"'
prepend_file 'config/environments/test.rb' do
prepend_file 'config/environments/test.rb', 'config.gem "rspec"'
==== Example
config
data
path
==== Parameters
Prepend text to a file. Since it depends on inject_into_file, it's reversible.
def prepend_file(path, *args, &block) config = args.last.is_a?(Hash) ? args.pop : {} config.merge!(:after => /\A/) inject_into_file(path, *(args << config), &block) end