lib/pdd.rb in pdd-0.5 vs lib/pdd.rb in pdd-0.5.1
- old
+ new
@@ -94,22 +94,22 @@
private
def attrs
{
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
- 'xsi:noNamespaceSchemaLocation' => "#{host}/xsd/#{PDD::VERSION}.xsd",
+ 'xsi:noNamespaceSchemaLocation' => "#{host('xsd')}/#{PDD::VERSION}.xsd",
'version' => PDD::VERSION,
'date' => Time.now.utc.iso8601
}
end
- def host
- 'http://pdd.teamed.io'
+ def host(suffix)
+ "http://pdd-#{suffix}.teamed.io"
end
def xsl
- "#{host}/xsl/#{PDD::VERSION}.xsl"
+ "#{host('xsl')}/#{PDD::VERSION}.xsl"
end
def render(puzzle, xml)
props = puzzle.props
xml.puzzle do
@@ -119,10 +119,10 @@
end
end
def sanitize(xml)
xsd = Nokogiri::XML::Schema(
- File.read(File.join(File.dirname(__FILE__), '../asserts/puzzles.xsd'))
+ File.read(File.join(File.dirname(__FILE__), '../assets/puzzles.xsd'))
)
errors = xsd.validate(Nokogiri::XML(xml)).map { |error| error.message }
errors.each { |e| PDD.log.error e }
PDD.log.error(xml) unless errors.empty?
fail SchemaError, errors.join('; ') unless errors.empty?