Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

57 lines (50 sloc) 1.423 kB
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$:.unshift File.dirname(__FILE__)
require "bundler/setup"
require 'rspec'
require 'rdf'
require 'rdf/isomorphic'
require 'json/ld'
require 'rdf/nquads'
require 'rdf/turtle'
require 'rdf/trig'
require 'rdf/spec'
require 'rdf/spec/matchers'
require 'yaml'
require 'open-uri/cached'
require 'matchers'
JSON_STATE = JSON::State.new(
:indent => " ",
:space => " ",
:space_before => "",
:object_nl => "\n",
:array_nl => "\n"
)
# Create and maintain a cache of downloaded URIs
URI_CACHE = File.expand_path(File.join(File.dirname(__FILE__), "uri-cache"))
Dir.mkdir(URI_CACHE) unless File.directory?(URI_CACHE)
OpenURI::Cache.class_eval { @cache_path = URI_CACHE }
::RSpec.configure do |c|
c.filter_run :focus => true
c.run_all_when_everything_filtered = true
c.exclusion_filter = {
:ruby => lambda { |version| !(RUBY_VERSION.to_s =~ /^#{version.to_s}/) },
}
c.include(RDF::Spec::Matchers)
end
# Heuristically detect the input stream
def detect_format(stream)
# Got to look into the file to see
if stream.is_a?(IO) || stream.is_a?(StringIO)
stream.rewind
string = stream.read(1000)
stream.rewind
else
string = stream.to_s
end
case string
when /<html/i then RDF::RDFa::Reader
when /\{\s*\"@\"/i then JSON::LD::Reader
else RDF::Turtle::Reader
end
end
Jump to Line
Something went wrong with that request. Please try again.