File.open, write and save?

If you just need to perform a simple script like creating a file, you can simply use a Ruby script without creating a rake task. # file origin.rb target = “target.rb” content = <<-RUBY puts “I’m the target!” RUBY File.open(target, “w+”) do |f| f.write(content) end And you can execute the file with $ ruby origin.rb