RAKE won'tt create xml file
Posted
by user296507
on Stack Overflow
See other posts from Stack Overflow
or by user296507
Published on 2010-03-21T13:36:44Z
Indexed on
2010/03/21
13:41 UTC
Read the original article
Hit count: 217
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
© Stack Overflow or respective owner