RAKE won'tt create xml file
- by user296507
hi,
i'm a bit lost here as to why my RAKE task will not create the desired XML file, however it works fine when i have the method 'build_xml' in the .RB file.
require 'rubygems'
require 'nokogiri'
require 'open-uri'
namespace :xml do
desc "xml build test"
task :xml_build => :environment do
build_xml
end
end
def build_xml
#build xml docoument
builder = Nokogiri::XML::Builder.new do |xml|
xml.root {
xml.location {
xml.value "test"
}
}
end
File.open("test.xml", 'w') {|f| f.write(builder.to_xml) }
end