File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44# Initialize the Rails application.
55Rails . application . initialize!
6-
7- # Configure OAI-PMH library
8- # see comments in: https://github.com/code4lib/ruby-oai/blob/54ea6f7f5b1e2c1be5d0a7cc61cb696b5e653d8a/lib/oai/provider.rb#L98
9- require 'oai'
10- require 'uri'
11-
12- class OAIRDF < OAI ::Provider ::Metadata ::Format
13- def initialize
14- @prefix = 'rdf'
15- @schema = 'http://www.openarchives.org/OAI/2.0/rdf.xsd'
16- @namespace = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
17- @element_namespace = 'rdf'
18- end
19- end
20-
21- class TrainingProvider < OAI ::Provider ::Base
22- repository_name TeSS ::Config . site [ 'title' ]
23- repository_url "#{ TeSS ::Config . base_url } /oai-pmh"
24- record_prefix "oai:#{ URI ( TeSS ::Config . base_url ) . host } "
25- admin_email TeSS ::Config . contact_email
26- sample_id '142' # so that example id is oai:domain:142
27-
28- register_format ( OAIRDF . instance )
29-
30- begin
31- source_model OAI ::Provider ::ActiveRecordWrapper . new ( Material . where ( visible : true ) )
32- rescue ActiveRecord ::NoDatabaseError
33- Rails . logger . debug 'There is no database yet, so the OAI-PMH endpoint is not configured.'
34- end
35- end
Original file line number Diff line number Diff line change 1+ # Configure OAI-PMH library
2+ # see comments in: https://github.com/code4lib/ruby-oai/blob/54ea6f7f5b1e2c1be5d0a7cc61cb696b5e653d8a/lib/oai/provider.rb#L98
3+ require 'oai'
4+ require 'uri'
5+
6+ class OAIRDF < OAI ::Provider ::Metadata ::Format
7+ def initialize
8+ @prefix = 'rdf'
9+ @schema = 'http://www.openarchives.org/OAI/2.0/rdf.xsd'
10+ @namespace = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
11+ @element_namespace = 'rdf'
12+ end
13+ end
14+
15+ class TrainingProvider < OAI ::Provider ::Base
16+ repository_name TeSS ::Config . site [ 'title' ]
17+ repository_url "#{ TeSS ::Config . base_url } /oai-pmh"
18+ record_prefix "oai:#{ URI ( TeSS ::Config . base_url ) . host } "
19+ admin_email TeSS ::Config . contact_email
20+ sample_id '142' # so that example id is oai:domain:142
21+
22+ register_format ( OAIRDF . instance )
23+ end
24+
25+ Rails . application . config . after_initialize do
26+ TrainingProvider . source_model OAI ::Provider ::ActiveRecordWrapper . new ( Material . where ( visible : true ) )
27+ rescue ActiveRecord ::NoDatabaseError
28+ Rails . logger . debug 'There is no database yet, so the OAI-PMH endpoint is not configured.'
29+ end
You can’t perform that action at this time.
0 commit comments