sufia-models 4.0.0.beta3 → 4.0.0.beta4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 63a65dabcbadf31012b903126436b9a24b8ee4ea
4
- data.tar.gz: cab66737a44fe6bea825acdfbc8a38c4fbd679c8
3
+ metadata.gz: 26e357f1f6b832085b27631a3f0b27a6965e5e5d
4
+ data.tar.gz: 1848e22539c05d4fc6e65c4caf95dbb5bae3853d
5
5
  SHA512:
6
- metadata.gz: a82f963bd402cac50068911c17d906578534710f39a5b070fae36fec7db886f2511b8d564eedcc3a2573472abeef10298e6c21464d8676b0bed4503744b30074
7
- data.tar.gz: fb673e84039480923a9d400814a48c59fd7d55bcd6bc3ea13e1db30a6269ee677544e23d84a9d73d5997c58dccb429cdb3e941d6d160dc7bade36d1bb2a619f3
6
+ metadata.gz: 46eef68b1e122d8a97d163b8af48276506129800d77713866097738d1f41930f93f1ca9d01f098ffc295bc2d964ca9c3f373edfb8983089d1507907637609b1d
7
+ data.tar.gz: 692a11e6afe0f3fe8545eb12600f50233dc72b7de3fbee2e5bde078ed200e8d03497be4beb12354aaf666e36e651fd35243c3276870476566a9bb60cb51c679d
@@ -97,11 +97,6 @@ module Sufia
97
97
  end
98
98
  end
99
99
 
100
- # Redefine this for more intuitive keys in Redis
101
- def to_param
102
- noid
103
- end
104
-
105
100
  def label=(new_label)
106
101
  @inner_object.label = new_label
107
102
  if self.title.empty?
@@ -9,14 +9,21 @@ module Sufia
9
9
  has_file_datastream "content", type: FileContentDatastream
10
10
  has_file_datastream "thumbnail"
11
11
 
12
-
13
12
  has_attributes :relative_path, :depositor, :import_url, datastream: :properties, multiple: false
14
- has_attributes :date_uploaded, :date_modified, datastream: :descMetadata, multiple: false
13
+ has_attributes :date_uploaded, :date_modified, datastream: :descMetadata, multiple: false
15
14
  has_attributes :related_url, :based_near, :part_of, :creator,
16
15
  :contributor, :title, :tag, :description, :rights,
17
16
  :publisher, :date_created, :subject,
18
17
  :resource_type, :identifier, :language, datastream: :descMetadata, multiple: true
19
18
  end
19
+
20
+ # Add a schema.org itemtype
21
+ def itemtype
22
+ # Look up the first non-empty resource type value in a hash from the config
23
+ Sufia.config.resource_types_to_schema[resource_type.to_a.reject { |type| type.empty? }.first] || 'http://schema.org/CreativeWork'
24
+ rescue
25
+ 'http://schema.org/CreativeWork'
26
+ end
20
27
  end
21
28
  end
22
29
  end
@@ -16,7 +16,7 @@ module Sufia
16
16
  # override this method if you need to initialize more complex RDF assertions (b-nodes)
17
17
  def initialize_fields
18
18
  terms_for_editing.each do |key|
19
- # if value is empty, we create an one element array to loop over for output
19
+ # if value is empty, we create an one element array to loop over for output
20
20
  self[key] = [''] if self[key].empty?
21
21
  end
22
22
  end
@@ -34,7 +34,7 @@ module Sufia
34
34
  module ClassMethods
35
35
  def terms_for_display
36
36
  [:resource_type, :title, :creator, :contributor, :description, :tag, :rights, :publisher, :date_created,
37
- :date_uploaded, :date_modified, :subject, :language, :identifier, :based_near, :related_url]
37
+ :subject, :language, :identifier, :based_near, :related_url]
38
38
  end
39
39
  end
40
40
 
@@ -4,7 +4,7 @@ class GenericFileRdfDatastream < ActiveFedora::NtriplesRDFDatastream
4
4
  index.as :stored_searchable, :facetable
5
5
  end
6
6
  property :title, predicate: RDF::DC.title do |index|
7
- index.as :stored_searchable
7
+ index.as :stored_searchable, :facetable
8
8
  end
9
9
  property :creator, predicate: RDF::DC.creator do |index|
10
10
  index.as :stored_searchable, :facetable
@@ -1,28 +1,33 @@
1
1
  module Sufia
2
2
  module Noid
3
- def Noid.noidify(identifier)
4
- String(identifier).split(":").last
5
- end
6
-
7
- def Noid.namespaceize(identifier)
8
- if identifier.start_with?(Noid.namespace)
9
- identifier
10
- else
11
- "#{Noid.namespace}:#{identifier}"
12
- end
13
- end
14
3
 
15
4
  def noid
16
5
  Noid.noidify(self.pid)
17
6
  end
18
7
 
19
- def normalize_identifier
20
- params[:id] = Noid.namespaceize(params[:id])
8
+ # Redefine this for more intuitive keys in Redis
9
+ def to_param
10
+ noid
21
11
  end
22
12
 
23
- protected
24
- def Noid.namespace
25
- Sufia.config.id_namespace
13
+ class << self
14
+ def noidify(identifier)
15
+ String(identifier).split(":").last
16
+ end
17
+
18
+ def namespaceize(identifier)
19
+ if identifier.start_with?(namespace)
20
+ identifier
21
+ else
22
+ "#{namespace}:#{identifier}"
23
+ end
24
+ end
25
+
26
+ protected
27
+
28
+ def namespace
29
+ Sufia.config.id_namespace
30
+ end
26
31
  end
27
32
  end
28
33
  end
@@ -13,9 +13,8 @@ This generator makes the following changes to your application:
13
13
  1. Creates several database migrations if they do not exist in /db/migrate
14
14
  2. Adds user behavior to the user model
15
15
  3. Creates the sufia.rb configuration file
16
- 4. Adds Sufia::SolrDocumentBehavior to app/models/solr_document.rb
17
- 5. Generates mailboxer
18
- 6. Generates usage stats config
16
+ 4. Generates mailboxer
17
+ 5. Generates usage stats config
19
18
  """
20
19
 
21
20
  # Implement the required interface for Rails::Generators::Migration.
@@ -83,19 +82,6 @@ This generator makes the following changes to your application:
83
82
  copy_file 'config/resque_config.rb', 'config/initializers/resque_config.rb'
84
83
  end
85
84
 
86
- # Add behaviors to the SolrDocument model
87
- def inject_sufia_solr_document_behavior
88
- file_path = "app/models/solr_document.rb"
89
- if File.exists?(file_path)
90
- inject_into_file file_path, after: /include Blacklight::Solr::Document.*$/ do
91
- "\n # Adds Sufia behaviors to the SolrDocument.\n" +
92
- " include Sufia::SolrDocumentBehavior\n"
93
- end
94
- else
95
- puts " \e[31mFailure\e[0m Sufia requires a SolrDocument object. This generators assumes that the model is defined in the file #{file_path}, which does not exist."
96
- end
97
- end
98
-
99
85
  def install_mailboxer
100
86
  generate "mailboxer:install"
101
87
  end
@@ -48,6 +48,29 @@ Sufia.config do |config|
48
48
  "Other" => "Other",
49
49
  }
50
50
 
51
+ config.resource_types_to_schema = {
52
+ "Article" => "http://schema.org/Article",
53
+ "Audio" => "http://schema.org/AudioObject",
54
+ "Book" => "http://schema.org/Book",
55
+ "Capstone Project" => "http://schema.org/CreativeWork",
56
+ "Conference Proceeding" => "http://schema.org/ScholarlyArticle",
57
+ "Dataset" => "http://schema.org/Dataset",
58
+ "Dissertation" => "http://schema.org/ScholarlyArticle",
59
+ "Image" => "http://schema.org/ImageObject",
60
+ "Journal" => "http://schema.org/CreativeWork",
61
+ "Map or Cartographic Material" => "http://schema.org/Map",
62
+ "Masters Thesis" => "http://schema.org/ScholarlyArticle",
63
+ "Part of Book" => "http://schema.org/Book",
64
+ "Poster" => "http://schema.org/CreativeWork",
65
+ "Presentation" => "http://schema.org/CreativeWork",
66
+ "Project" => "http://schema.org/CreativeWork",
67
+ "Report" => "http://schema.org/CreativeWork",
68
+ "Research Paper" => "http://schema.org/ScholarlyArticle",
69
+ "Software or Program Code" => "http://schema.org/Code",
70
+ "Video" => "http://schema.org/VideoObject",
71
+ "Other" => "http://schema.org/CreativeWork",
72
+ }
73
+
51
74
  config.permission_levels = {
52
75
  "Choose Access"=>"none",
53
76
  "View/Download" => "read",
@@ -1,5 +1,5 @@
1
1
  module Sufia
2
2
  module Models
3
- VERSION = "4.0.0.beta3"
3
+ VERSION = "4.0.0.beta4"
4
4
  end
5
5
  end
data/sufia-models.gemspec CHANGED
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
34
34
  spec.add_dependency 'resque', '~> 1.23'
35
35
  spec.add_dependency 'resque-pool', '0.3.0'
36
36
  spec.add_dependency 'noid', '~> 0.6.6'
37
- spec.add_dependency 'mailboxer', '~> 0.12.0.rc1'
37
+ spec.add_dependency 'mailboxer', '~> 0.12.0.rc2'
38
38
  spec.add_dependency 'acts_as_follower', '>= 0.1.1', '< 0.3'
39
39
  spec.add_dependency 'carrierwave', '~> 0.9.0'
40
40
  spec.add_dependency 'hydra-derivatives', '~> 0.1'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sufia-models
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.beta3
4
+ version: 4.0.0.beta4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Friesen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-16 00:00:00.000000000 Z
11
+ date: 2014-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -148,14 +148,14 @@ dependencies:
148
148
  requirements:
149
149
  - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: 0.12.0.rc1
151
+ version: 0.12.0.rc2
152
152
  type: :runtime
153
153
  prerelease: false
154
154
  version_requirements: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - "~>"
157
157
  - !ruby/object:Gem::Version
158
- version: 0.12.0.rc1
158
+ version: 0.12.0.rc2
159
159
  - !ruby/object:Gem::Dependency
160
160
  name: acts_as_follower
161
161
  requirement: !ruby/object:Gem::Requirement