Class: Hydra::RemoteIdentifier::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/hydra/remote_identifier/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_configObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/generators/hydra/remote_identifier/install_generator.rb', line 4

def create_config
  initializer('hydra-remote_identifier_config.rb') do
    data = []

    data << '# Register and configure remote identifiers for persisted objects'
    data << 'Hydra::RemoteIdentifier.configure do |config|'
    data << '  # doi_credentials = Psych.load_file("/path/to/doi_credentials.yml")'
    data << '  # config.remote_service(:doi, doi_credentials) do |doi|'
    data << '  #   doi.register(PersistedObject) do |map|'
    data << '  #     map.target :url'
    data << '  #     map.creator {|obj| obj.person_name }'
    data << '  #     map.title :title'
    data << '  #     map.publisher :publisher'
    data << '  #     map.publicationyear :publicationyear'
    data << '  #'
    data << '  #     # Make sure that this method persists the value'
    data << '  #     map.set_identifier :set_doi_identifier='
    data << '  #   end'
    data << '  # end'
    data << 'end'
    data << ''

    data.join("\n")
  end
end