sinatra-rdf 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (8) hide show
  1. checksums.yaml +7 -0
  2. data/AUTHORS +2 -0
  3. data/CREDITS +0 -0
  4. data/README.md +165 -0
  5. data/UNLICENSE +1 -0
  6. data/VERSION +1 -0
  7. data/lib/sinatra/rdf.rb +38 -0
  8. metadata +119 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e516a436e774fc7437c9dc789359cf12b1adc1dc8bd6a47f8391dbcd9a400045
4
+ data.tar.gz: ae78fd4b0f019c63bbee680dc794d19250fd7bc740e0ab2604cdcc49fd243d59
5
+ SHA512:
6
+ metadata.gz: eecaa51d9126a3be128b855c72368f43d113e95a592cba667769f7b716018941cb5f95a2590cb0f277bf0e40c8e8c5ce7331ac8b7e52b6d4be02e67cc0b6281b
7
+ data.tar.gz: fdd81c746d875411c84d576199aff8d341a38d0f485a2d9a6c6b5d9e7ead131ee250117d6cd033a3cadafd68c59680f2ed994a93e66c6006733bc66274ec7d75
data/AUTHORS ADDED
@@ -0,0 +1,2 @@
1
+ * Arto Bendiken <arto.bendiken@gmail.com>
2
+ * Gregg Kellogg <gregg@greggkellogg.net>
data/CREDITS ADDED
File without changes
@@ -0,0 +1,165 @@
1
+ # Linked Data Content Negotiation for Sinatra Applications
2
+
3
+ This is a [Sinatra][] extension that provides [Linked Data][] content
4
+ negotiation for Sinatra applications.
5
+
6
+ This version is based on [rack-linkeddata][] without the hard dependency on the [linkeddata][] gem, to allow applications to better manage their dependencies
7
+
8
+ * <http://github.com/datagraph/sinatra-rdf>
9
+
10
+ [![Gem Version](https://badge.fury.io/rb/sinatra-rdf.svg)](http://badge.fury.io/rb/sinatra-rdf)
11
+ [![Build Status](https://travis-ci.org/ruby-rdf/sinatra-rdf.svg?branch=master)](http://travis-ci.org/ruby-rdf/sinatra-rdf)
12
+
13
+ ## Features
14
+
15
+ * Implements [HTTP content negotiation][conneg] for RDF content types using
16
+ the [`Rack::RDF`][Rack::RDF] middleware.
17
+ * Supports all [RDF.rb][]-compatible serialization formats.
18
+ * Supports both classic and modular Sinatra applications.
19
+
20
+ ## Examples
21
+
22
+ ### Adding Linked Data content negotiation to a classic Sinatra application
23
+
24
+ ```ruby
25
+ #!/usr/bin/env ruby -rubygems
26
+ require 'sinatra'
27
+ require 'sinatra/rdf'
28
+
29
+ get '/hello' do
30
+ RDF::Graph.new do |graph|
31
+ graph << [RDF::Node.new, RDF::DC.title, "Hello, world!"]
32
+ end
33
+ end
34
+ ```
35
+
36
+ ### Adding Linked Data content negotiation to a modular Sinatra application
37
+
38
+ ```ruby
39
+ #!/usr/bin/env ruby -rubygems
40
+ require 'sinatra/base'
41
+ require 'sinatra/rdf'
42
+
43
+ module My
44
+ class Application < Sinatra::Base
45
+ register Sinatra::RDF
46
+
47
+ get '/hello' do
48
+ RDF::Graph.new do |graph|
49
+ graph << [RDF::Node.new, RDF::DC.title, "Hello, world!"]
50
+ end
51
+ end
52
+ end
53
+ end
54
+
55
+ My::Application.run! :host => '127.0.0.1', :port => 4567
56
+ ```
57
+
58
+ ### Adding Linked Data content negotiation to a Rackup application
59
+
60
+ ```ruby
61
+ #!/usr/bin/env rackup
62
+ require 'sinatra/base'
63
+ require 'sinatra/rdf'
64
+
65
+ module My
66
+ class Application < Sinatra::Base
67
+ register Sinatra::RDF
68
+
69
+ get '/hello' do
70
+ RDF::Graph.new do |graph|
71
+ graph << [RDF::Node.new, RDF::DC.title, "Hello, world!"]
72
+ end
73
+ end
74
+ end
75
+ end
76
+
77
+ run My::Application
78
+ ```
79
+
80
+ ### Testing Linked Data content negotiation using `rackup` and `curl`
81
+
82
+ $ rackup doc/examples/config.ru
83
+
84
+ $ curl -iH "Accept: application/n-triples" http://localhost:9292/hello
85
+ $ curl -iH "Accept: application/turtle" http://localhost:9292/hello
86
+ $ curl -iH "Accept: application/rdf+xml" http://localhost:9292/hello
87
+ $ curl -iH "Accept: application/json" http://localhost:9292/hello
88
+ $ curl -iH "Accept: application/trix" http://localhost:9292/hello
89
+ $ curl -iH "Accept: */*" http://localhost:9292/hello
90
+
91
+ ## Description
92
+
93
+ `Sinatra::RDF` is a thin Sinatra-specific wrapper around the
94
+ [`Rack::RDF`][Rack::RDF] middleware, which implements Linked
95
+ Data content negotiation for Rack applications.
96
+
97
+ At the moment the Sinatra extension simply corresponds
98
+ to doing the following manually in a Sinatra application:
99
+
100
+ ```ruby
101
+ require 'rack/rdf'
102
+
103
+ module My
104
+ class Application < Sinatra::Base
105
+ use Rack::RDF::ContentNegotiation
106
+ helpers Sinatra::RDF::Helpers
107
+ include ::RDF
108
+ end
109
+ end
110
+ ```
111
+
112
+ See the `Rack::RDF` documentation for more information on the
113
+ operation and details of the content negotiation.
114
+
115
+ ## Documentation
116
+
117
+ * [Sinatra::RDF](https://www.rubydoc.info/github/ruby-rdf/sinatra-rdf/master)
118
+
119
+ ## Dependencies
120
+
121
+ * [Sinatra](http://rubygems.org/gems/sinatra) (~> 2.0)
122
+ * [Rack::RDF](http://rubygems.org/gems/rack-rdf) (~> 3.1)
123
+
124
+ ## Installation
125
+
126
+ The recommended installation method is via [RubyGems](http://rubygems.org/).
127
+ To install the latest official release of the gem, do:
128
+
129
+ % [sudo] gem install sinatra-rdf
130
+
131
+ ## Download
132
+
133
+ To get a local working copy of the development repository, do:
134
+
135
+ % git clone git://github.com/ruby-rdf/sinatra-rdf.git
136
+
137
+ Alternatively, you can download the latest development version as a tarball
138
+ as follows:
139
+
140
+ % wget http://github.com/ruby-rdf/sinatra-rdf/tarball/master
141
+
142
+ ## References
143
+
144
+ * <http://www.w3.org/DesignIssues/LinkedData.html>
145
+ * <http://linkeddata.org/docs/how-to-publish>
146
+ * <http://linkeddata.org/conneg-303-redirect-code-samples>
147
+ * <http://www.w3.org/TR/cooluris/>
148
+ * <http://www.w3.org/TR/swbp-vocab-pub/>
149
+ * <http://patterns.dataincubator.org/book/publishing-patterns.html>
150
+
151
+ ## Authors
152
+
153
+ * [Arto Bendiken](http://github.com/bendiken) - <http://ar.to/>
154
+
155
+ ## License
156
+
157
+ `Sinatra::RDF` is free and unencumbered public domain software. For more
158
+ information, see <http://unlicense.org/> or the accompanying UNLICENSE file.
159
+
160
+ [Sinatra]: http://www.sinatrarb.com/
161
+ [Rack]: http://rack.github.com/
162
+ [RDF.rb]: http://ruby-rdf.github.com/rdf/
163
+ [Rack::RDF]: http://datagraph.rubyforge.org/rack-rdf/
164
+ [Linked Data]: http://linkeddata.org/
165
+ [conneg]: http://en.wikipedia.org/wiki/Content_negotiation
@@ -0,0 +1 @@
1
+ ./LICENSE
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 3.1.0
@@ -0,0 +1,38 @@
1
+ require 'sinatra/base'
2
+ require 'rack/rdf'
3
+
4
+ module Sinatra
5
+ ##
6
+ # To override negotiation on Content-Type, set :format in `linkeddata_options` to a RDF Format class, or symbol identifying a format.
7
+ #
8
+ # @see http://www.sinatrarb.com/extensions.html
9
+ module RDF
10
+ autoload :VERSION, 'sinatra/rdf/version'
11
+
12
+ ##
13
+ # Helper methods.
14
+ module Helpers
15
+ # TODO
16
+ end
17
+
18
+ ##
19
+ # * Registers Rack::LinkedData::ContentNegotiation
20
+ # * adds helpers
21
+ # * includes RDF and LinkedData
22
+ # * defines `linkeddata_options`, which are passed to the Rack middleware
23
+ # available as `settings.linkeddata_options` and as options within
24
+ # the LinkedData Rack middleware.
25
+ #
26
+ # @param [Sinatra::Base] app
27
+ # @return [void]
28
+ def self.registered(app)
29
+ options = {}
30
+ app.set :linkeddata_options, options
31
+ app.use(Rack::RDF::ContentNegotiation, options)
32
+ app.helpers(Sinatra::RDF::Helpers)
33
+ app.send(:include, ::RDF)
34
+ end
35
+ end
36
+ end
37
+
38
+ Sinatra.register(Sinatra::RDF)
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sinatra-rdf
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Arto Bendiken
8
+ - Gregg Kellogg
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2020-02-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rack-rdf
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '3.1'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '3.1'
28
+ - !ruby/object:Gem::Dependency
29
+ name: sinatra
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '2.0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '2.0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: yard
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: 0.9.20
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: 0.9.20
56
+ - !ruby/object:Gem::Dependency
57
+ name: rspec
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '3.9'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '3.9'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rack-test
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '1.1'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '1.1'
84
+ description: Sinatra extension for Linked Data content negotiation.
85
+ email: public-rdf-ruby@w3.org
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - AUTHORS
91
+ - CREDITS
92
+ - README.md
93
+ - UNLICENSE
94
+ - VERSION
95
+ - lib/sinatra/rdf.rb
96
+ homepage: http://ruby-rdf.github.com/sinatra-rdf
97
+ licenses:
98
+ - Unlicense
99
+ metadata: {}
100
+ post_install_message:
101
+ rdoc_options: []
102
+ require_paths:
103
+ - lib
104
+ required_ruby_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '2.4'
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ requirements: []
115
+ rubygems_version: 3.1.2
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: Linked Data content negotiation for Sinatra applications.
119
+ test_files: []