module Thor::Actions
def insert_into_file(destination, *args, &block)
end
gems.split(" ").map{ |gem| " config.gem :#{gem}" }.join("\n")
gems = ask "Which gems would you like to add?"
insert_into_file "config/environment.rb", :after => "Rails::Initializer.run do |config|\n" do
insert_into_file "config/environment.rb", "config.gem :thor", :after => "Rails::Initializer.run do |config|\n"
==== Examples
insert two or more times the same content.
for injection (:after or :before) or :force => true for
config
data
destination
==== Parameters
method is reversible.
Injects the given content into a file. Different from gsub_file, this
def insert_into_file(destination, *args, &block) if block_given? data, config = block, args.shift else data, config = args.shift, args.shift end action InjectIntoFile.new(self, destination, data, config) end