hydra-core 6.2.0 → 6.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/hydra/cucumber_support_generator.rb +10 -10
- data/lib/generators/hydra/head_generator.rb +35 -21
- data/lib/generators/hydra/jetty_generator.rb +7 -7
- data/lib/generators/hydra/templates/catalog_controller.rb +43 -43
- data/lib/generators/hydra/templates/config/fedora.yml +1 -1
- data/lib/generators/hydra/templates/config/initializers/hydra_config.rb +1 -1
- data/lib/generators/hydra/templates/config/solr.yml +2 -2
- data/lib/hydra-head/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba071d2871ac8165ecd78b2e5341dd61a8733487
|
4
|
+
data.tar.gz: a394ec1a0f3b5dfb34fdc1c42285b342186dd407
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1ba398230df3af4aa86b67e43dc957d48061c005e810fd180e4f67b94455b3a589cd817424f9250602a3e33ac99885870cfa5be797ca35e16b2d448815a191c
|
7
|
+
data.tar.gz: 1c99ce599d1ec788b87b028e5955270cf55d3eedd54dd4de2ab9afa4913840cb153ad3e9a10347cb390d6ac514009c885e7bd876e79c70d89c28a319cb5aa56a
|
@@ -1,29 +1,29 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require 'rails/generators'
|
3
|
-
require 'rails/generators/migration'
|
3
|
+
require 'rails/generators/migration'
|
4
4
|
|
5
5
|
module Hydra
|
6
6
|
class CucumberSupportGenerator < Rails::Generators::Base
|
7
|
-
|
7
|
+
|
8
8
|
source_root File.expand_path('../../../../test_support/features', __FILE__)
|
9
|
-
|
9
|
+
|
10
10
|
argument :features_dir, :type => :string , :default => "features"
|
11
|
-
|
11
|
+
|
12
12
|
desc """
|
13
13
|
This Generator copies Hydra's cucumber step definitions and paths into your application's features directory.
|
14
14
|
We have plans to provide the step definitions directly through the hydra-head gem without requiring this step of copying the files.
|
15
|
-
In the meantime, you need to copy the files in order to use them.
|
16
|
-
|
15
|
+
In the meantime, you need to copy the files in order to use them.
|
16
|
+
|
17
17
|
Defaults to assuming that your cucumber features live in a directory called \"features\". To pass in an alternative path to your features directory,
|
18
|
-
|
18
|
+
|
19
19
|
rails generate hydra:cucumber_support test_support/features
|
20
|
-
|
20
|
+
|
21
21
|
"""
|
22
|
-
|
22
|
+
|
23
23
|
def copy_cucumber_support
|
24
24
|
directory("step_definitions", "#{features_dir}/step_definitions")
|
25
25
|
copy_file("support/paths.rb", "#{features_dir}/support/paths.rb")
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
end
|
29
29
|
end
|
@@ -1,29 +1,43 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require 'rails/generators'
|
3
|
-
require 'rails/generators/migration'
|
3
|
+
require 'rails/generators/migration'
|
4
4
|
|
5
5
|
module Hydra
|
6
6
|
class HeadGenerator < Rails::Generators::Base
|
7
7
|
include Rails::Generators::Migration
|
8
|
-
|
8
|
+
|
9
9
|
source_root File.expand_path('../templates', __FILE__)
|
10
|
-
|
10
|
+
|
11
11
|
argument :model_name, :type => :string , :default => "user"
|
12
|
-
|
12
|
+
|
13
13
|
desc """
|
14
14
|
This generator makes the following changes to your application:
|
15
15
|
1. Creates a database migration for superusers if they do not exist in /db/migrate
|
16
|
-
2. Adds additional mime types to you application in the file '/config/initializers/mime_types.rb'
|
17
|
-
3. Creates config/initializers/hydra_config.rb
|
16
|
+
2. Adds additional mime types to you application in the file '/config/initializers/mime_types.rb'
|
17
|
+
3. Creates config/initializers/hydra_config.rb
|
18
18
|
4. Creates config/fedora.yml and config/solr.yml which you may need to modify to tell the hydra head where to find fedora & solr
|
19
|
-
5. Creates a number of role_map config files that are used in the placeholder user roles implementation
|
19
|
+
5. Creates a number of role_map config files that are used in the placeholder user roles implementation
|
20
20
|
Enjoy building your Hydra Head!
|
21
21
|
"""
|
22
|
-
|
22
|
+
|
23
23
|
#
|
24
24
|
# Config Files & Initializers
|
25
25
|
#
|
26
|
-
|
26
|
+
|
27
|
+
def inject_test_framework
|
28
|
+
application("\n" <<
|
29
|
+
" config.generators do |g|\n" <<
|
30
|
+
" g.test_framework :rspec, :spec => true\n" <<
|
31
|
+
" end\n\n"
|
32
|
+
)
|
33
|
+
|
34
|
+
gem_group :development, :test do
|
35
|
+
gem "rspec-rails"
|
36
|
+
gem 'jettywrapper'
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
27
41
|
# Copy all files in templates/config directory to host config
|
28
42
|
def create_configuration_files
|
29
43
|
copy_file "catalog_controller.rb", "app/controllers/catalog_controller.rb"
|
@@ -31,10 +45,10 @@ class HeadGenerator < Rails::Generators::Base
|
|
31
45
|
# Initializers
|
32
46
|
file_path = "config/initializers/hydra_config.rb"
|
33
47
|
copy_file "config/initializers/hydra_config.rb", file_path
|
34
|
-
insert_into_file file_path, :after => '# specify the user model' do
|
35
|
-
"\n config[:user_model] = '#{model_name.classify}'"
|
48
|
+
insert_into_file file_path, :after => '# specify the user model' do
|
49
|
+
"\n config[:user_model] = '#{model_name.classify}'"
|
36
50
|
end
|
37
|
-
|
51
|
+
|
38
52
|
copy_file "config/initializers/action_dispatch_http_upload_monkey_patch.rb", "config/initializers/action_dispatch_http_upload_monkey_patch.rb"
|
39
53
|
|
40
54
|
# Role Mappings
|
@@ -42,24 +56,24 @@ class HeadGenerator < Rails::Generators::Base
|
|
42
56
|
copy_file "config/role_map_development.yml", "config/role_map_development.yml"
|
43
57
|
copy_file "config/role_map_production.yml", "config/role_map_production.yml"
|
44
58
|
copy_file "config/role_map_test.yml", "config/role_map_test.yml"
|
45
|
-
|
59
|
+
|
46
60
|
# Fedora & Solr YAML files
|
47
61
|
invoke('active_fedora:config')
|
48
62
|
end
|
49
|
-
|
63
|
+
|
50
64
|
# Add Hydra behaviors to the user model
|
51
65
|
def inject_hydra_user_behavior
|
52
66
|
file_path = "app/models/#{model_name.underscore}.rb"
|
53
|
-
if File.exists?(file_path)
|
54
|
-
inject_into_class file_path, model_name.classify do
|
67
|
+
if File.exists?(file_path)
|
68
|
+
inject_into_class file_path, model_name.classify do
|
55
69
|
"# Connects this user object to Hydra behaviors. " +
|
56
|
-
"\n include Hydra::User\n"
|
70
|
+
"\n include Hydra::User\n"
|
57
71
|
end
|
58
72
|
else
|
59
|
-
puts " \e[31mFailure\e[0m Hydra requires a user object in order to apply access controls. This generators assumes that the model is defined in the file #{file_path}, which does not exist. If you used a different name, please re-run the generator and provide that name as an argument. Such as \b rails -g hydra:head client"
|
60
|
-
end
|
73
|
+
puts " \e[31mFailure\e[0m Hydra requires a user object in order to apply access controls. This generators assumes that the model is defined in the file #{file_path}, which does not exist. If you used a different name, please re-run the generator and provide that name as an argument. Such as \b rails -g hydra:head client"
|
74
|
+
end
|
61
75
|
end
|
62
|
-
|
76
|
+
|
63
77
|
# Inject call to HydraHead.add_routes in config/routes.rb
|
64
78
|
def inject_hydra_routes
|
65
79
|
insert_into_file "config/routes.rb", :after => 'Blacklight.add_routes(self)' do
|
@@ -67,6 +81,6 @@ class HeadGenerator < Rails::Generators::Base
|
|
67
81
|
"\n HydraHead.add_routes(self)"
|
68
82
|
end
|
69
83
|
end
|
70
|
-
|
84
|
+
|
71
85
|
end # HeadGenerator
|
72
86
|
end # Hydra
|
@@ -3,19 +3,19 @@ require 'jettywrapper'
|
|
3
3
|
|
4
4
|
module Hydra
|
5
5
|
class Jetty < Rails::Generators::Base
|
6
|
-
|
7
|
-
desc """
|
8
|
-
Installs a jetty container with a solr and fedora installed in it.
|
6
|
+
|
7
|
+
desc """
|
8
|
+
Installs a jetty container with a solr and fedora installed in it.
|
9
9
|
|
10
10
|
Requires system('unzip... ') to work, probably won't work on Windows.
|
11
11
|
|
12
12
|
"""
|
13
|
-
|
14
|
-
def download_jetty
|
13
|
+
|
14
|
+
def download_jetty
|
15
15
|
Jettywrapper.unzip
|
16
16
|
end
|
17
|
-
|
18
|
-
|
17
|
+
|
18
|
+
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require 'blacklight/catalog'
|
3
3
|
|
4
|
-
class CatalogController < ApplicationController
|
4
|
+
class CatalogController < ApplicationController
|
5
5
|
|
6
6
|
include Blacklight::Catalog
|
7
7
|
include Hydra::Controller::ControllerBehavior
|
@@ -14,9 +14,9 @@ class CatalogController < ApplicationController
|
|
14
14
|
|
15
15
|
|
16
16
|
configure_blacklight do |config|
|
17
|
-
config.default_solr_params = {
|
17
|
+
config.default_solr_params = {
|
18
18
|
:qt => 'search',
|
19
|
-
:rows => 10
|
19
|
+
:rows => 10
|
20
20
|
}
|
21
21
|
|
22
22
|
# solr field configuration for search results/index views
|
@@ -35,25 +35,25 @@ class CatalogController < ApplicationController
|
|
35
35
|
# * If left unset, then all facet values returned by solr will be displayed.
|
36
36
|
# * If set to an integer, then "f.somefield.facet.limit" will be added to
|
37
37
|
# solr request, with actual solr request being +1 your configured limit --
|
38
|
-
# you configure the number of items you actually want _tsimed_ in a page.
|
38
|
+
# you configure the number of items you actually want _tsimed_ in a page.
|
39
39
|
# * If set to 'true', then no additional parameters will be sent to solr,
|
40
40
|
# but any 'sniffed' request limit parameters will be used for paging, with
|
41
|
-
# paging at requested limit -1. Can sniff from facet.limit or
|
41
|
+
# paging at requested limit -1. Can sniff from facet.limit or
|
42
42
|
# f.specific_field.facet.limit solr request params. This 'true' config
|
43
43
|
# can be used if you set limits in :default_solr_params, or as defaults
|
44
44
|
# on the solr side in the request handler itself. Request handler defaults
|
45
45
|
# sniffing requires solr requests to be made with "echoParams=all", for
|
46
|
-
# app code to actually have it echo'd back to see it.
|
46
|
+
# app code to actually have it echo'd back to see it.
|
47
47
|
#
|
48
|
-
# :show may be set to false if you don't want the facet to be drawn in the
|
48
|
+
# :show may be set to false if you don't want the facet to be drawn in the
|
49
49
|
# facet bar
|
50
|
-
config.add_facet_field solr_name('object_type', :facetable), :label => 'Format'
|
51
|
-
config.add_facet_field solr_name('pub_date', :facetable), :label => 'Publication Year'
|
52
|
-
config.add_facet_field solr_name('subject_topic', :facetable), :label => 'Topic', :limit => 20
|
53
|
-
config.add_facet_field solr_name('language', :facetable), :label => 'Language', :limit => true
|
54
|
-
config.add_facet_field solr_name('lc1_letter', :facetable), :label => 'Call Number'
|
55
|
-
config.add_facet_field solr_name('subject_geo', :facetable), :label => 'Region'
|
56
|
-
config.add_facet_field solr_name('subject_era', :facetable), :label => 'Era'
|
50
|
+
config.add_facet_field solr_name('object_type', :facetable), :label => 'Format'
|
51
|
+
config.add_facet_field solr_name('pub_date', :facetable), :label => 'Publication Year'
|
52
|
+
config.add_facet_field solr_name('subject_topic', :facetable), :label => 'Topic', :limit => 20
|
53
|
+
config.add_facet_field solr_name('language', :facetable), :label => 'Language', :limit => true
|
54
|
+
config.add_facet_field solr_name('lc1_letter', :facetable), :label => 'Call Number'
|
55
|
+
config.add_facet_field solr_name('subject_geo', :facetable), :label => 'Region'
|
56
|
+
config.add_facet_field solr_name('subject_era', :facetable), :label => 'Era'
|
57
57
|
|
58
58
|
# Have BL send all facet field names to Solr, which has been the default
|
59
59
|
# previously. Simply remove these lines if you'd rather use Solr request
|
@@ -64,26 +64,26 @@ class CatalogController < ApplicationController
|
|
64
64
|
|
65
65
|
|
66
66
|
# solr fields to be displayed in the index (search results) view
|
67
|
-
# The ordering of the field names is the order of the display
|
68
|
-
config.add_index_field solr_name('title', :stored_searchable, type: :string), :label => 'Title:'
|
69
|
-
config.add_index_field solr_name('title_vern', :stored_searchable, type: :string), :label => 'Title:'
|
70
|
-
config.add_index_field solr_name('author', :stored_searchable, type: :string), :label => 'Author:'
|
71
|
-
config.add_index_field solr_name('author_vern', :stored_searchable, type: :string), :label => 'Author:'
|
72
|
-
config.add_index_field solr_name('format', :symbol), :label => 'Format:'
|
67
|
+
# The ordering of the field names is the order of the display
|
68
|
+
config.add_index_field solr_name('title', :stored_searchable, type: :string), :label => 'Title:'
|
69
|
+
config.add_index_field solr_name('title_vern', :stored_searchable, type: :string), :label => 'Title:'
|
70
|
+
config.add_index_field solr_name('author', :stored_searchable, type: :string), :label => 'Author:'
|
71
|
+
config.add_index_field solr_name('author_vern', :stored_searchable, type: :string), :label => 'Author:'
|
72
|
+
config.add_index_field solr_name('format', :symbol), :label => 'Format:'
|
73
73
|
config.add_index_field solr_name('language', :stored_searchable, type: :string), :label => 'Language:'
|
74
74
|
config.add_index_field solr_name('published', :stored_searchable, type: :string), :label => 'Published:'
|
75
75
|
config.add_index_field solr_name('published_vern', :stored_searchable, type: :string), :label => 'Published:'
|
76
76
|
config.add_index_field solr_name('lc_callnum', :stored_searchable, type: :string), :label => 'Call number:'
|
77
77
|
|
78
78
|
# solr fields to be displayed in the show (single result) view
|
79
|
-
# The ordering of the field names is the order of the display
|
80
|
-
config.add_show_field solr_name('title', :stored_searchable, type: :string), :label => 'Title:'
|
81
|
-
config.add_show_field solr_name('title_vern', :stored_searchable, type: :string), :label => 'Title:'
|
82
|
-
config.add_show_field solr_name('subtitle', :stored_searchable, type: :string), :label => 'Subtitle:'
|
83
|
-
config.add_show_field solr_name('subtitle_vern', :stored_searchable, type: :string), :label => 'Subtitle:'
|
84
|
-
config.add_show_field solr_name('author', :stored_searchable, type: :string), :label => 'Author:'
|
85
|
-
config.add_show_field solr_name('author_vern', :stored_searchable, type: :string), :label => 'Author:'
|
86
|
-
config.add_show_field solr_name('format', :symbol), :label => 'Format:'
|
79
|
+
# The ordering of the field names is the order of the display
|
80
|
+
config.add_show_field solr_name('title', :stored_searchable, type: :string), :label => 'Title:'
|
81
|
+
config.add_show_field solr_name('title_vern', :stored_searchable, type: :string), :label => 'Title:'
|
82
|
+
config.add_show_field solr_name('subtitle', :stored_searchable, type: :string), :label => 'Subtitle:'
|
83
|
+
config.add_show_field solr_name('subtitle_vern', :stored_searchable, type: :string), :label => 'Subtitle:'
|
84
|
+
config.add_show_field solr_name('author', :stored_searchable, type: :string), :label => 'Author:'
|
85
|
+
config.add_show_field solr_name('author_vern', :stored_searchable, type: :string), :label => 'Author:'
|
86
|
+
config.add_show_field solr_name('format', :symbol), :label => 'Format:'
|
87
87
|
config.add_show_field solr_name('url_fulltext_tsim', :stored_searchable, type: :string), :label => 'URL:'
|
88
88
|
config.add_show_field solr_name('url_suppl_tsim', :stored_searchable, type: :string), :label => 'More Information:'
|
89
89
|
config.add_show_field solr_name('language', :stored_searchable, type: :string), :label => 'Language:'
|
@@ -104,43 +104,43 @@ class CatalogController < ApplicationController
|
|
104
104
|
# The :key is what will be used to identify this BL search field internally,
|
105
105
|
# as well as in URLs -- so changing it after deployment may break bookmarked
|
106
106
|
# urls. A display label will be automatically calculated from the :key,
|
107
|
-
# or can be specified manually to be different.
|
107
|
+
# or can be specified manually to be different.
|
108
108
|
|
109
109
|
# This one uses all the defaults set by the solr request handler. Which
|
110
110
|
# solr request handler? The one set in config[:default_solr_parameters][:qt],
|
111
|
-
# since we aren't specifying it otherwise.
|
112
|
-
|
111
|
+
# since we aren't specifying it otherwise.
|
112
|
+
|
113
113
|
config.add_search_field 'all_fields', :label => 'All Fields'
|
114
|
-
|
114
|
+
|
115
115
|
|
116
116
|
# Now we see how to over-ride Solr request handler defaults, in this
|
117
117
|
# case for a BL "search field", which is really a dismax aggregate
|
118
|
-
# of Solr search fields.
|
119
|
-
|
118
|
+
# of Solr search fields.
|
119
|
+
|
120
120
|
config.add_search_field('title') do |field|
|
121
121
|
# :solr_local_parameters will be sent using Solr LocalParams
|
122
122
|
# syntax, as eg {! qf=$title_qf }. This is neccesary to use
|
123
123
|
# Solr parameter de-referencing like $title_qf.
|
124
124
|
# See: http://wiki.apache.org/solr/LocalParams
|
125
|
-
field.solr_local_parameters = {
|
125
|
+
field.solr_local_parameters = {
|
126
126
|
:qf => '$title_qf',
|
127
127
|
:pf => '$title_pf'
|
128
128
|
}
|
129
129
|
end
|
130
|
-
|
130
|
+
|
131
131
|
config.add_search_field('author') do |field|
|
132
|
-
field.solr_local_parameters = {
|
132
|
+
field.solr_local_parameters = {
|
133
133
|
:qf => '$author_qf',
|
134
134
|
:pf => '$author_pf'
|
135
135
|
}
|
136
136
|
end
|
137
|
-
|
137
|
+
|
138
138
|
# Specifying a :qt only to show it's possible, and so our internal automated
|
139
|
-
# tests can test it. In this case it's the same as
|
140
|
-
# config[:default_solr_parameters][:qt], so isn't actually neccesary.
|
139
|
+
# tests can test it. In this case it's the same as
|
140
|
+
# config[:default_solr_parameters][:qt], so isn't actually neccesary.
|
141
141
|
config.add_search_field('subject') do |field|
|
142
142
|
field.qt = 'search'
|
143
|
-
field.solr_local_parameters = {
|
143
|
+
field.solr_local_parameters = {
|
144
144
|
:qf => '$subject_qf',
|
145
145
|
:pf => '$subject_pf'
|
146
146
|
}
|
@@ -155,11 +155,11 @@ class CatalogController < ApplicationController
|
|
155
155
|
config.add_sort_field 'author_tesi asc, title_tesi asc', :label => 'author'
|
156
156
|
config.add_sort_field 'title_tesi asc, pub_date_dtsi desc', :label => 'title'
|
157
157
|
|
158
|
-
# If there are more than this many search results, no spelling ("did you
|
158
|
+
# If there are more than this many search results, no spelling ("did you
|
159
159
|
# mean") suggestion is offered.
|
160
160
|
config.spell_max = 5
|
161
161
|
end
|
162
162
|
|
163
163
|
|
164
164
|
|
165
|
-
end
|
165
|
+
end
|
@@ -23,6 +23,6 @@ if Hydra.respond_to?(:configure)
|
|
23
23
|
:owner => ActiveFedora::SolrService.solr_name("depositor", indexer),
|
24
24
|
:embargo_release_date => ActiveFedora::SolrService.solr_name("embargo_release_date", Solrizer::Descriptor.new(:date, :stored, :indexed))
|
25
25
|
}
|
26
|
-
|
26
|
+
|
27
27
|
end
|
28
28
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# This is a sample config file that does not have multiple solr instances. You will also need to be sure to
|
2
|
-
# edit the fedora.yml file to match the solr URL for active-fedora.
|
2
|
+
# edit the fedora.yml file to match the solr URL for active-fedora.
|
3
3
|
development:
|
4
4
|
url: http://localhost:8983/solr/development
|
5
5
|
test: &TEST
|
@@ -7,4 +7,4 @@ test: &TEST
|
|
7
7
|
cucumber:
|
8
8
|
<<: *TEST
|
9
9
|
production:
|
10
|
-
url: http://your.production.server:8080/bl_solr/core0
|
10
|
+
url: http://your.production.server:8080/bl_solr/core0
|
data/lib/hydra-head/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.2.
|
4
|
+
version: 6.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Zumwalt, Bess Sadler, Julie Meloni, Naomi Dushay, Jessie Keck, John Scofield,
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-06-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -87,14 +87,14 @@ dependencies:
|
|
87
87
|
requirements:
|
88
88
|
- - '='
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: 6.2.
|
90
|
+
version: 6.2.1
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - '='
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: 6.2.
|
97
|
+
version: 6.2.1
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: jettywrapper
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|