lib/sportdb/loader.rb in sportdb-0.9.0 vs lib/sportdb/loader.rb in sportdb-0.9.1

- old
+ new

@@ -37,25 +37,24 @@ def load_fixtures_with_include_path( name, include_path ) # load from file system path = "#{include_path}/#{name}.rb" puts "*** loading data '#{name}' (#{path})..." - code = File.read( path ) + ## nb: assume/enfore utf-8 encoding (with or without BOM - byte order mark) + ## - see sportdb/utils.rb + code = File.read_utf8( path ) load_fixtures_worker( code ) - ### fix: - ## for loaded from fs use filestat? for version - why? why not? - - Prop.create!( key: "db.#{fixture_name_to_prop_key(name)}.version", value: "rb.1" ) + Prop.create!( key: "db.#{fixture_name_to_prop_key(name)}.version", value: "file.rb.#{File.mtime(path).strftime('%Y.%m.%d')}" ) end def load_fixtures_builtin( name ) # load from gem (built-in) path = "#{SportDB.root}/db/#{name}.rb" puts "*** loading data '#{name}' (#{path})..." - code = File.read( path ) + code = File.read_utf8( path ) load_fixtures_worker( code ) ## for builtin fixtures use VERSION of gem