valkyrie_active_fedora 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +8 -1
- data/.travis.yml +5 -9
- data/Gemfile +4 -6
- data/lib/tasks/valkyrie_active_fedora_dev.rake +1 -1
- data/lib/valkyrie_active_fedora.rb +1 -1
- data/lib/valkyrie_active_fedora/base.rb +13 -19
- data/lib/valkyrie_active_fedora/rake_support.rb +0 -3
- data/lib/valkyrie_active_fedora/resource_factory.rb +61 -0
- data/lib/valkyrie_active_fedora/version.rb +1 -2
- data/spec/spec_helper.rb +1 -1
- data/spec/unit/base_spec.rb +8 -6
- data/spec/unit/resource_factory_spec.rb +64 -0
- data/valkyrie_active_fedora.gemspec +2 -4
- metadata +18 -62
- data/lib/generators/valkyrie_active_fedora/config/USAGE +0 -9
- data/lib/generators/valkyrie_active_fedora/config/config_generator.rb +0 -10
- data/lib/generators/valkyrie_active_fedora/config/fedora/fedora_generator.rb +0 -16
- data/lib/generators/valkyrie_active_fedora/config/fedora/templates/.fcrepo_wrapper.yml +0 -4
- data/lib/generators/valkyrie_active_fedora/config/fedora/templates/fcrepo_wrapper_test.yml +0 -4
- data/lib/generators/valkyrie_active_fedora/config/fedora/templates/fedora.yml +0 -15
- data/lib/generators/valkyrie_active_fedora/config/solr/solr_generator.rb +0 -19
- data/lib/generators/valkyrie_active_fedora/config/solr/templates/.solr_wrapper.yml +0 -8
- data/lib/generators/valkyrie_active_fedora/config/solr/templates/solr.yml +0 -7
- data/lib/generators/valkyrie_active_fedora/config/solr/templates/solr/config/_rest_managed.json +0 -3
- data/lib/generators/valkyrie_active_fedora/config/solr/templates/solr/config/admin-extra.html +0 -31
- data/lib/generators/valkyrie_active_fedora/config/solr/templates/solr/config/elevate.xml +0 -36
- data/lib/generators/valkyrie_active_fedora/config/solr/templates/solr/config/mapping-ISOLatin1Accent.txt +0 -246
- data/lib/generators/valkyrie_active_fedora/config/solr/templates/solr/config/protwords.txt +0 -21
- data/lib/generators/valkyrie_active_fedora/config/solr/templates/solr/config/schema.xml +0 -379
- data/lib/generators/valkyrie_active_fedora/config/solr/templates/solr/config/scripts.conf +0 -24
- data/lib/generators/valkyrie_active_fedora/config/solr/templates/solr/config/solrconfig.xml +0 -325
- data/lib/generators/valkyrie_active_fedora/config/solr/templates/solr/config/spellings.txt +0 -2
- data/lib/generators/valkyrie_active_fedora/config/solr/templates/solr/config/stopwords.txt +0 -58
- data/lib/generators/valkyrie_active_fedora/config/solr/templates/solr/config/stopwords_en.txt +0 -58
- data/lib/generators/valkyrie_active_fedora/config/solr/templates/solr/config/synonyms.txt +0 -31
- data/lib/generators/valkyrie_active_fedora/config/solr/templates/solr/config/xslt/example.xsl +0 -132
- data/lib/generators/valkyrie_active_fedora/config/solr/templates/solr/config/xslt/example_atom.xsl +0 -67
- data/lib/generators/valkyrie_active_fedora/config/solr/templates/solr/config/xslt/example_rss.xsl +0 -66
- data/lib/generators/valkyrie_active_fedora/config/solr/templates/solr/config/xslt/luke.xsl +0 -337
- data/lib/generators/valkyrie_active_fedora/config/solr/templates/solr_wrapper_test.yml +0 -8
- data/lib/generators/valkyrie_active_fedora/model/USAGE +0 -11
- data/lib/generators/valkyrie_active_fedora/model/model_generator.rb +0 -31
- data/lib/generators/valkyrie_active_fedora/model/templates/datastream.rb.erb +0 -32
- data/lib/generators/valkyrie_active_fedora/model/templates/datastream_spec.rb.erb +0 -13
- data/lib/generators/valkyrie_active_fedora/model/templates/model.rb.erb +0 -46
- data/lib/generators/valkyrie_active_fedora/model/templates/model_spec.rb.erb +0 -38
@@ -1,11 +0,0 @@
|
|
1
|
-
Description:
|
2
|
-
Generate a class that inherits from ActiveFedora::Base
|
3
|
-
|
4
|
-
Example:
|
5
|
-
rails generate valkyrie_active_fedora:model Journal
|
6
|
-
|
7
|
-
This will create:
|
8
|
-
app/models/journal.rb
|
9
|
-
app/models/datastreams/journal_metadata.rb
|
10
|
-
spec/models/journal_spec.rb
|
11
|
-
spec/models/datastreams/journal_metadata_spec.rb
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'rails/generators'
|
2
|
-
|
3
|
-
module ActiveFedora
|
4
|
-
class ModelGenerator < Rails::Generators::NamedBase
|
5
|
-
source_root ::File.expand_path('../templates', __FILE__)
|
6
|
-
check_class_collision
|
7
|
-
|
8
|
-
class_option :directory, type: :string, default: 'models', desc: "Which directory to generate? (i.e. app/DIRECTORY)"
|
9
|
-
class_option :datastream_directory, type: :string, default: 'models/datastreams', desc: "Which datastream directory to generate? (i.e. models/datastreams)"
|
10
|
-
class_option :has_subresource, type: :string, default: nil, desc: "Name a file to attach"
|
11
|
-
class_option :datastream, type: :string, default: nil, desc: "Name a metadata datastream to create"
|
12
|
-
|
13
|
-
def install
|
14
|
-
template('model.rb.erb', ::File.join('app', directory, "#{file_name}.rb"))
|
15
|
-
template('model_spec.rb.erb', ::File.join('spec', directory, "#{file_name}_spec.rb"))
|
16
|
-
return unless options[:datastream]
|
17
|
-
template('datastream.rb.erb', ::File.join('app', datastream_directory, "#{file_name}_metadata.rb"))
|
18
|
-
template('datastream_spec.rb.erb', ::File.join('spec', datastream_directory, "#{file_name}_metadata_spec.rb"))
|
19
|
-
end
|
20
|
-
|
21
|
-
protected
|
22
|
-
|
23
|
-
def directory
|
24
|
-
options[:directory]
|
25
|
-
end
|
26
|
-
|
27
|
-
def datastream_directory
|
28
|
-
options[:datastream_directory]
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# Generated via
|
2
|
-
# `rails generate valkyrie_active_fedora:model <%= class_name %>`
|
3
|
-
class <%= class_name %>Metadata < ValkyrieActiveFedora::OmDatastream
|
4
|
-
|
5
|
-
# Define a terminology for parsing this XML document
|
6
|
-
# See: https://github.com/samvera/om/wiki/Tame-your-XML-with-OM
|
7
|
-
#
|
8
|
-
# set_terminology do |t|
|
9
|
-
# t.root(path: "fields")
|
10
|
-
# t.title
|
11
|
-
# t.author
|
12
|
-
# end
|
13
|
-
|
14
|
-
|
15
|
-
# Describe what an empty document looks like
|
16
|
-
#
|
17
|
-
# def self.xml_template
|
18
|
-
# Nokogiri::XML.parse("<fields/>")
|
19
|
-
# end
|
20
|
-
#
|
21
|
-
|
22
|
-
|
23
|
-
# "If you need to add additional attributes to the SOLR document, define the
|
24
|
-
# #to_solr method and make sure to use super"
|
25
|
-
#
|
26
|
-
# def to_solr(solr_document={}, options={})
|
27
|
-
# super(solr_document, options)
|
28
|
-
# solr_document["my_attribute_s"] = my_attribute
|
29
|
-
# return solr_document
|
30
|
-
# end
|
31
|
-
|
32
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# Generated via
|
2
|
-
# `rails generate valkyrie_active_fedora:model <%= class_name %>`
|
3
|
-
require 'rails_helper'
|
4
|
-
|
5
|
-
describe <%= class_name %>Metadata do
|
6
|
-
it 'should have a title' do
|
7
|
-
pending "Create a terminology for <%= class_name %>Metadata, then enable this test"
|
8
|
-
subject.title = 'War and Peace'
|
9
|
-
expect(subject.title).to eq ['War and Peace']
|
10
|
-
end
|
11
|
-
|
12
|
-
end
|
13
|
-
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# Generated via
|
2
|
-
# `rails generate valkyrie_active_fedora:model <%= class_name %>`
|
3
|
-
class <%= class_name %> < ValkyrieActiveFedora::Base
|
4
|
-
<% if options['datastream'] %>
|
5
|
-
has_subresource :descMetadata, class_name: "<%= options['datastream'] %>"
|
6
|
-
<% else %>
|
7
|
-
# Define some properties to store:
|
8
|
-
#
|
9
|
-
property :title, predicate: ::RDF::Vocab::DC.title do |index|
|
10
|
-
index.as :stored_searchable, :facetable
|
11
|
-
end
|
12
|
-
property :creator, predicate: ::RDF::Vocab::DC.creator do |index|
|
13
|
-
index.as :stored_searchable, :facetable
|
14
|
-
end
|
15
|
-
property :contributor, predicate: ::RDF::Vocab::DC.contributor do |index|
|
16
|
-
index.as :stored_searchable, :facetable
|
17
|
-
end
|
18
|
-
property :description, predicate: ::RDF::Vocab::DC.description do |index|
|
19
|
-
index.as :stored_searchable
|
20
|
-
end
|
21
|
-
<%- end -%>
|
22
|
-
<% if options['has_subresource'] %>
|
23
|
-
has_subresource :<%= options['has_subresource'] %>"
|
24
|
-
<% else %>
|
25
|
-
# Uncomment the following lines to add an #attachment method that is a file
|
26
|
-
#
|
27
|
-
# has_subresource "attachment"
|
28
|
-
<% end %>
|
29
|
-
#
|
30
|
-
# If you need to add additional attributes to the SOLR document, extend the default indexer:
|
31
|
-
#
|
32
|
-
# def indexer
|
33
|
-
# MyApp::IndexingService
|
34
|
-
# end
|
35
|
-
#
|
36
|
-
# This can go into app/services/my_app/indexing_service.rb
|
37
|
-
# module MyApp
|
38
|
-
# class IndexingService < ActiveFedora::IndexingService
|
39
|
-
# def generate_solr_document
|
40
|
-
# super.tap do |solr_doc|
|
41
|
-
# solr_doc["my_attribute_s"] = object.my_attribute
|
42
|
-
# end
|
43
|
-
# end
|
44
|
-
# end
|
45
|
-
# end
|
46
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# Generated via
|
2
|
-
# `rails generate valkyrie_active_fedora:model <%= class_name %>`
|
3
|
-
require 'rails_helper'
|
4
|
-
require 'valkyrie_active_fedora/test_support'
|
5
|
-
|
6
|
-
describe <%= class_name %> do
|
7
|
-
it_behaves_like 'An ActiveModel'
|
8
|
-
include ActiveFedora::TestSupport
|
9
|
-
subject { <%= class_name %>.new }
|
10
|
-
|
11
|
-
describe "when persisted to fedora" do
|
12
|
-
before { subject.save! }
|
13
|
-
after { subject.destroy }
|
14
|
-
it 'should exist' do
|
15
|
-
expect(<%= class_name %>.exists?(subject.id)).to be true
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
<% if options['datastream'] %>
|
20
|
-
it 'should have a descMetadata datastream' do
|
21
|
-
expect(subject.descMetadata).to be_kind_of <%= options['descMetadata'] ? options['descMetadata'] : "#{class_name}Metadata" %>
|
22
|
-
end
|
23
|
-
<% else %>
|
24
|
-
it 'should have a title' do
|
25
|
-
subject.title = ['War and Peace']
|
26
|
-
expect(subject.title).to eq ['War and Peace']
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "#to_solr" do
|
30
|
-
subject { <%= class_name %>.new(title: ['War and Peace']).to_solr }
|
31
|
-
|
32
|
-
it 'should have a title' do
|
33
|
-
expect(subject['title_tesim']).to eq ['War and Peace']
|
34
|
-
end
|
35
|
-
end
|
36
|
-
<% end %>
|
37
|
-
|
38
|
-
end
|