blacklight 6.0.0 → 6.1.0

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.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +6 -6
  3. data/.rubocop_todo.yml +448 -87
  4. data/.travis.yml +2 -0
  5. data/README.md +3 -5
  6. data/VERSION +1 -1
  7. data/app/controllers/concerns/blacklight/bookmarks.rb +8 -8
  8. data/app/controllers/concerns/blacklight/catalog.rb +5 -5
  9. data/app/controllers/concerns/blacklight/controller.rb +5 -5
  10. data/app/controllers/concerns/blacklight/saved_searches.rb +70 -0
  11. data/app/controllers/concerns/blacklight/search_context.rb +3 -0
  12. data/app/controllers/concerns/blacklight/token_based_user.rb +1 -1
  13. data/app/controllers/saved_searches_controller.rb +1 -60
  14. data/app/helpers/blacklight/blacklight_helper_behavior.rb +3 -3
  15. data/app/helpers/blacklight/catalog_helper_behavior.rb +20 -9
  16. data/app/helpers/blacklight/configuration_helper_behavior.rb +1 -1
  17. data/app/helpers/blacklight/deprecated_url_helper_behavior.rb +1 -1
  18. data/app/helpers/blacklight/facets_helper_behavior.rb +2 -2
  19. data/app/helpers/blacklight/hash_as_hidden_fields_helper_behavior.rb +1 -1
  20. data/app/helpers/blacklight/render_constraints_helper_behavior.rb +18 -8
  21. data/app/helpers/blacklight/render_partials_helper.rb +15 -3
  22. data/app/models/concerns/blacklight/configurable.rb +4 -8
  23. data/app/models/concerns/blacklight/document/dublin_core.rb +1 -1
  24. data/app/models/concerns/blacklight/document/extensions.rb +1 -1
  25. data/app/models/concerns/blacklight/document.rb +3 -3
  26. data/app/models/concerns/blacklight/user.rb +1 -1
  27. data/app/models/record_mailer.rb +6 -1
  28. data/app/models/search.rb +2 -2
  29. data/app/views/catalog/_facets.html.erb +7 -7
  30. data/app/views/catalog/_results_pagination.html.erb +1 -1
  31. data/blacklight.gemspec +7 -4
  32. data/config/locales/blacklight.de.yml +1 -0
  33. data/config/locales/blacklight.en.yml +1 -0
  34. data/config/locales/blacklight.es.yml +1 -0
  35. data/config/locales/blacklight.fr.yml +1 -0
  36. data/config/locales/blacklight.it.yml +1 -0
  37. data/config/locales/blacklight.pt-BR.yml +1 -0
  38. data/lib/blacklight/abstract_repository.rb +2 -2
  39. data/lib/blacklight/configuration/field.rb +1 -1
  40. data/lib/blacklight/configuration/search_field.rb +1 -1
  41. data/lib/blacklight/configuration/sort_field.rb +1 -1
  42. data/lib/blacklight/search_builder.rb +8 -4
  43. data/lib/blacklight/search_state.rb +3 -3
  44. data/lib/blacklight/solr/repository.rb +3 -3
  45. data/lib/blacklight/solr/request.rb +2 -2
  46. data/lib/blacklight/solr/response/spelling.rb +1 -1
  47. data/lib/blacklight/solr/response.rb +1 -1
  48. data/lib/blacklight/solr/search_builder_behavior.rb +7 -7
  49. data/lib/blacklight/utils.rb +5 -5
  50. data/lib/blacklight.rb +2 -2
  51. data/lib/generators/blacklight/assets_generator.rb +1 -1
  52. data/lib/generators/blacklight/controller_generator.rb +13 -15
  53. data/lib/generators/blacklight/document_generator.rb +5 -4
  54. data/lib/generators/blacklight/install_generator.rb +26 -26
  55. data/lib/generators/blacklight/models_generator.rb +18 -16
  56. data/lib/generators/blacklight/search_builder_generator.rb +4 -4
  57. data/lib/generators/blacklight/solr4_generator.rb +14 -9
  58. data/lib/generators/blacklight/solr5_generator.rb +4 -2
  59. data/lib/generators/blacklight/templates/solr_document.rb +6 -8
  60. data/lib/generators/blacklight/test_support_generator.rb +5 -3
  61. data/lib/generators/blacklight/user_generator.rb +18 -12
  62. data/lib/railties/blacklight.rake +2 -2
  63. data/solr/conf/solrconfig.xml +0 -1
  64. data/spec/test_app_templates/Gemfile.extra +0 -2
  65. data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
  66. data/tasks/blacklight.rake +1 -3
  67. metadata +23 -15
  68. data/.rubocop_hound.yml +0 -1063
  69. /data/lib/generators/blacklight/templates/{blacklight.css.scss → blacklight.scss} +0 -0
data/blacklight.gemspec CHANGED
@@ -11,7 +11,10 @@ Gem::Specification.new do |s|
11
11
  s.email = ["blacklight-development@googlegroups.com"]
12
12
  s.homepage = "http://projectblacklight.org/"
13
13
  s.summary = "Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr) index."
14
- s.description = %{Blacklight is an open source Solr user interface discovery platform. You can use Blacklight to enable searching and browsing of your collections. Blacklight uses the Apache Solr search engine to search full text and/or metadata.}
14
+ s.description = %(Blacklight is an open source Solr user interface discovery platform.
15
+ You can use Blacklight to enable searching and browsing of your
16
+ collections. Blacklight uses the Apache Solr search engine to search
17
+ full text and/or metadata.)
15
18
  s.license = "Apache 2.0"
16
19
 
17
20
  s.files = `git ls-files -z`.split("\x0")
@@ -20,13 +23,13 @@ Gem::Specification.new do |s|
20
23
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
24
  s.require_paths = ["lib"]
22
25
 
23
- s.required_ruby_version = '~> 2.0'
26
+ s.required_ruby_version = '~> 2.1'
24
27
 
25
- s.add_dependency "rails", ">= 4.1", "< 5"
28
+ s.add_dependency "rails", ">= 4.2", "< 6"
26
29
  s.add_dependency "globalid"
27
30
  s.add_dependency "nokogiri", "~>1.6" # XML Parser
28
31
  s.add_dependency "kaminari", ">= 0.15" # the pagination (page 1,2,3, etc..) of our search results
29
- s.add_dependency "rsolr", "~> 1.0.11" # Library for interacting with rSolr.
32
+ s.add_dependency "rsolr", "~> 1.0", ">= 1.0.6" # Library for interacting with rSolr.
30
33
  s.add_dependency "bootstrap-sass", "~> 3.2"
31
34
  s.add_dependency "deprecation"
32
35
  s.add_dependency "twitter-typeahead-rails", '~> 0.11'
@@ -100,6 +100,7 @@ de:
100
100
  message: 'Meldung:'
101
101
  submit: 'Abgeben'
102
102
  text:
103
+ default_title: 'N/A'
103
104
  title: 'Titel: %{value}'
104
105
  author: 'Autor: %{value}'
105
106
  format: 'Format: %{value}'
@@ -100,6 +100,7 @@ en:
100
100
  message: 'Message:'
101
101
  submit: 'Send'
102
102
  text:
103
+ default_title: 'N/A'
103
104
  title: 'Title: %{value}'
104
105
  author: 'Author: %{value}'
105
106
  format: 'Format: %{value}'
@@ -100,6 +100,7 @@ es:
100
100
  message: 'Mensaje:'
101
101
  submit: 'Enviar'
102
102
  text:
103
+ default_title: 'N/A'
103
104
  title: 'Titulo: %{value}'
104
105
  author: 'Autor: %{value}'
105
106
  format: 'Formato: %{value}'
@@ -102,6 +102,7 @@ fr:
102
102
  message: 'Message :'
103
103
  submit: 'Envoyer'
104
104
  text:
105
+ default_title: 'N/A'
105
106
  title: 'Titre : %{value}'
106
107
  author: 'Auteur : %{value}'
107
108
  format: 'Format : %{value}'
@@ -100,6 +100,7 @@ it:
100
100
  message: 'Messaggio:'
101
101
  submit: 'Invia'
102
102
  text:
103
+ default_title: 'N/A'
103
104
  title: 'Titolo: %{value}'
104
105
  author: 'Autore: %{value}'
105
106
  format: 'Formato: %{value}'
@@ -99,6 +99,7 @@ pt-BR:
99
99
  message: 'Mensagem:'
100
100
  submit: 'Enviar'
101
101
  text:
102
+ default_title: 'N/A'
102
103
  title: 'Título: %{value}'
103
104
  author: 'Autor: %{value}'
104
105
  format: 'Formato: %{value}'
@@ -22,14 +22,14 @@ module Blacklight
22
22
  # @param [String] document's unique key value
23
23
  # @param [Hash] additional query parameters
24
24
  def find(id, params = {})
25
- fail NotImplementedError
25
+ raise NotImplementedError
26
26
  end
27
27
 
28
28
  ##
29
29
  # Execute a search query against a search index
30
30
  # @param [Hash] query parameters
31
31
  def search(params = {})
32
- fail NotImplementedError
32
+ raise NotImplementedError
33
33
  end
34
34
 
35
35
  protected
@@ -14,7 +14,7 @@ module Blacklight
14
14
  end
15
15
 
16
16
  def validate!
17
- raise ArgumentError.new("Must supply a field name") if self.field.nil?
17
+ raise ArgumentError, "Must supply a field name" if self.field.nil?
18
18
  end
19
19
 
20
20
  def default_label
@@ -11,7 +11,7 @@ module Blacklight
11
11
  end
12
12
 
13
13
  def validate!
14
- raise ArgumentError.new("Must supply a search field key") if self.key.nil?
14
+ raise ArgumentError, "Must supply a search field key" if self.key.nil?
15
15
  end
16
16
  end
17
17
  end
@@ -12,7 +12,7 @@ module Blacklight
12
12
  end
13
13
 
14
14
  def validate!
15
- raise ArgumentError.new("Must supply a sort string") if self.sort.nil?
15
+ raise ArgumentError.new, "Must supply a sort string" if self.sort.nil?
16
16
  end
17
17
  end
18
18
  end
@@ -210,14 +210,18 @@ module Blacklight
210
210
  end
211
211
  end
212
212
 
213
- alias_method :per, :rows
213
+ alias per rows
214
214
 
215
215
  def sort
216
- field = if blacklight_params[:sort].blank? and sort_field = blacklight_config.default_sort_field
216
+ sort_field = if blacklight_params[:sort].blank?
217
217
  # no sort param provided, use default
218
- sort_field.sort
219
- elsif sort_field = blacklight_config.sort_fields[blacklight_params[:sort]]
218
+ blacklight_config.default_sort_field
219
+ else
220
220
  # check for sort field key
221
+ blacklight_config.sort_fields[blacklight_params[:sort]]
222
+ end
223
+
224
+ field = if sort_field.present?
221
225
  sort_field.sort
222
226
  else
223
227
  # just pass the key through
@@ -74,7 +74,7 @@ module Blacklight
74
74
  # Delete any request params from facet-specific action, needed
75
75
  # to redir to index action properly.
76
76
  request_keys = blacklight_config.facet_paginator_class.request_keys
77
- new_params.extract! *request_keys.values
77
+ new_params.extract!(*request_keys.values)
78
78
 
79
79
  new_params
80
80
  end
@@ -101,7 +101,7 @@ module Blacklight
101
101
  p[:f] = (p[:f] || {}).dup
102
102
  p[:f][url_field] = (p[:f][url_field] || []).dup
103
103
  p[:f][url_field] = p[:f][url_field] - [value]
104
- p[:f].delete(url_field) if p[:f][url_field].size == 0
104
+ p[:f].delete(url_field) if p[:f][url_field].empty?
105
105
  p.delete(:f) if p[:f].empty?
106
106
  p
107
107
  end
@@ -158,7 +158,7 @@ module Blacklight
158
158
  p[:f] = (p[:f] || {}).dup # the command above is not deep in rails3, !@#$!@#$
159
159
  p[:f][url_field] = (p[:f][url_field] || []).dup
160
160
 
161
- if facet_config.single and not p[:f][url_field].empty?
161
+ if facet_config.single and p[:f][url_field].present?
162
162
  p[:f][url_field] = []
163
163
  end
164
164
 
@@ -12,7 +12,7 @@ module Blacklight::Solr
12
12
  .merge(blacklight_config.document_unique_id_param => id)
13
13
 
14
14
  solr_response = send_and_receive blacklight_config.document_solr_path || blacklight_config.solr_path, doc_params
15
- raise Blacklight::Exceptions::RecordNotFound.new if solr_response.documents.empty?
15
+ raise Blacklight::Exceptions::RecordNotFound if solr_response.documents.empty?
16
16
  solr_response
17
17
  end
18
18
 
@@ -45,9 +45,9 @@ module Blacklight::Solr
45
45
  solr_response
46
46
  end
47
47
  rescue Errno::ECONNREFUSED => e
48
- raise Blacklight::Exceptions::ECONNREFUSED.new("Unable to connect to Solr instance using #{connection.inspect}: #{e.inspect}")
48
+ raise Blacklight::Exceptions::ECONNREFUSED, "Unable to connect to Solr instance using #{connection.inspect}: #{e.inspect}"
49
49
  rescue RSolr::Error::Http => e
50
- raise Blacklight::Exceptions::InvalidRequest.new(e.message)
50
+ raise Blacklight::Exceptions::InvalidRequest, e.message
51
51
  end
52
52
 
53
53
  protected
@@ -3,8 +3,8 @@ class Blacklight::Solr::InvalidParameter < ArgumentError; end
3
3
 
4
4
  class Blacklight::Solr::Request < ActiveSupport::HashWithIndifferentAccess
5
5
 
6
- SINGULAR_KEYS = %w{facet fl q qt rows start spellcheck spellcheck.q sort per_page wt hl group defType}
7
- ARRAY_KEYS = %w{facet.field facet.query facet.pivot fq hl.fl}
6
+ SINGULAR_KEYS = %w(facet fl q qt rows start spellcheck spellcheck.q sort per_page wt hl group defType)
7
+ ARRAY_KEYS = %w(facet.field facet.query facet.pivot fq hl.fl)
8
8
 
9
9
  def initialize(constructor = {})
10
10
  if constructor.is_a?(Hash)
@@ -11,7 +11,7 @@ module Blacklight::Solr::Response::Spelling
11
11
 
12
12
  class Base
13
13
 
14
- attr :response
14
+ attr_reader :response
15
15
 
16
16
  def initialize(response)
17
17
  @response = response
@@ -76,7 +76,7 @@ class Blacklight::Solr::Response < ActiveSupport::HashWithIndifferentAccess
76
76
  end
77
77
 
78
78
  def grouped?
79
- self.has_key? "grouped"
79
+ self.key? "grouped"
80
80
  end
81
81
 
82
82
  def export_formats
@@ -52,8 +52,8 @@ module Blacklight::Solr
52
52
  # solr LocalParams in config, using solr LocalParams syntax.
53
53
  # http://wiki.apache.org/solr/LocalParams
54
54
  ##
55
- if (search_field && hash = search_field.solr_local_parameters)
56
- local_params = hash.collect do |key, val|
55
+ if search_field && search_field.solr_local_parameters.present?
56
+ local_params = search_field.solr_local_parameters.map do |key, val|
57
57
  key.to_s + "=" + solr_param_quote(val, :quote => "'")
58
58
  end.join(" ")
59
59
  solr_parameters[:q] = "{!#{local_params}}#{blacklight_params[:q]}"
@@ -91,7 +91,7 @@ module Blacklight::Solr
91
91
  end
92
92
 
93
93
  # :fq, map from :f.
94
- if ( blacklight_params[:f])
94
+ if blacklight_params[:f]
95
95
  f_request_params = blacklight_params[:f]
96
96
 
97
97
  f_request_params.each_pair do |facet_field, value_list|
@@ -202,7 +202,7 @@ module Blacklight::Solr
202
202
  end
203
203
 
204
204
  page = blacklight_params.fetch(request_keys[:page], 1).to_i
205
- offset = (page - 1) * (limit)
205
+ offset = (page - 1) * limit
206
206
 
207
207
  sort = blacklight_params[request_keys[:sort]]
208
208
  prefix = blacklight_params[request_keys[:prefix]]
@@ -281,7 +281,7 @@ module Blacklight::Solr
281
281
  def facet_value_to_fq_string(facet_field, value)
282
282
  facet_config = blacklight_config.facet_fields[facet_field]
283
283
 
284
- solr_field = facet_config.field if facet_config and not facet_config.query
284
+ solr_field = facet_config.field if facet_config and !facet_config.query
285
285
  solr_field ||= facet_field
286
286
 
287
287
  local_params = []
@@ -307,9 +307,9 @@ module Blacklight::Solr
307
307
  def convert_to_term_value(value)
308
308
  case
309
309
  when (value.is_a?(DateTime) or value.is_a?(Time))
310
- "#{value.utc.strftime("%Y-%m-%dT%H:%M:%SZ")}"
310
+ value.utc.strftime("%Y-%m-%dT%H:%M:%SZ")
311
311
  when value.is_a?(Date)
312
- "#{value.to_time(:local).strftime("%Y-%m-%dT%H:%M:%SZ")}"
312
+ value.to_time(:local).strftime("%Y-%m-%dT%H:%M:%SZ")
313
313
  else
314
314
  value.to_s
315
315
  end
@@ -85,11 +85,11 @@ module Blacklight
85
85
  end
86
86
 
87
87
  lazy_configs.each do |k,v|
88
- if v.is_a? nested_class
89
- hash[k] = v
90
- else
91
- hash[k] = nested_class.new v
92
- end
88
+ hash[k] = if v.is_a? nested_class
89
+ v
90
+ else
91
+ nested_class.new v
92
+ end
93
93
  end
94
94
 
95
95
  super hash
data/lib/blacklight.rb CHANGED
@@ -63,7 +63,7 @@ module Blacklight
63
63
  require 'yaml'
64
64
 
65
65
  return @blacklight_yml if @blacklight_yml
66
- unless File.exists?(blacklight_config_file)
66
+ unless File.exist?(blacklight_config_file)
67
67
  raise "You are missing a configuration file: #{blacklight_config_file}. Have you run \"rails generate blacklight:install\"?"
68
68
  end
69
69
 
@@ -74,7 +74,7 @@ module Blacklight
74
74
  end
75
75
 
76
76
  begin
77
- @blacklight_yml = YAML::load(blacklight_erb)
77
+ @blacklight_yml = YAML.load(blacklight_erb)
78
78
  rescue => e
79
79
  raise("#{blacklight_config_file} was found, but could not be parsed.\n#{e.inspect}")
80
80
  end
@@ -4,7 +4,7 @@ module Blacklight
4
4
  source_root File.expand_path('../templates', __FILE__)
5
5
 
6
6
  def assets
7
- copy_file "blacklight.css.scss", "app/assets/stylesheets/blacklight.css.scss"
7
+ copy_file "blacklight.scss", "app/assets/stylesheets/blacklight.scss"
8
8
 
9
9
  return if has_blacklight_assets?
10
10
 
@@ -6,20 +6,18 @@ module Blacklight
6
6
 
7
7
  argument :controller_name , type: :string , default: "catalog"
8
8
 
9
- desc """
10
- This generator makes the following changes to your application:
11
- 1. Injects behavior into your user application_controller.rb
12
- 2. Creates a Blacklight::Catalog-based controller
13
- 3. Adds routes for your controller
14
-
15
- Thank you for Installing Blacklight.
16
- """
9
+ desc <<-EOS
10
+ This generator makes the following changes to your application:
11
+ 1. Injects behavior into your user application_controller.rb
12
+ 2. Creates a Blacklight::Catalog-based controller
13
+ 3. Adds routes for your controller
14
+ EOS
17
15
 
18
16
  # Add Blacklight to the application controller
19
17
  def inject_blacklight_controller_behavior
20
18
  inject_into_class "app/controllers/application_controller.rb", "ApplicationController" do
21
- " # Adds a few additional behaviors into the application controller \n" +
22
- " include Blacklight::Controller\n" +
19
+ " # Adds a few additional behaviors into the application controller\n" \
20
+ " include Blacklight::Controller\n" \
23
21
  " layout 'blacklight'\n\n"
24
22
  end
25
23
  end
@@ -30,12 +28,12 @@ module Blacklight
30
28
  end
31
29
 
32
30
  def inject_blacklight_routes
33
- route <<-EOF.strip_heredoc
34
- concern :searchable, Blacklight::Routes::Searchable.new
31
+ route <<-EOF
32
+ concern :searchable, Blacklight::Routes::Searchable.new
35
33
 
36
- resource :catalog, only: [:index], as: 'catalog', path: '/catalog', controller: 'catalog' do
37
- concerns :searchable
38
- end
34
+ resource :catalog, only: [:index], as: 'catalog', path: '/catalog', controller: 'catalog' do
35
+ concerns :searchable
36
+ end
39
37
  EOF
40
38
  end
41
39
  end
@@ -9,10 +9,11 @@ module Blacklight
9
9
 
10
10
  argument :model_name, :type => :string , :default => "solr_document"
11
11
 
12
- desc """
13
- This generator makes the following changes to your application:
14
- 1. Creates a blacklight document in your /app/models directory
15
- """
12
+ desc <<-EOS
13
+ This generator makes the following changes to your application:
14
+ 1. Creates a blacklight document in your /app/models directory
15
+ EOS
16
+
16
17
  def create_solr_document
17
18
  template "solr_document.rb", "app/models/#{model_name}.rb"
18
19
  end
@@ -13,30 +13,31 @@ module Blacklight
13
13
  class_option :devise , type: :boolean, default: false, aliases: "-d", desc: "Use Devise as authentication logic."
14
14
  class_option :jettywrapper, type: :boolean, default: false, desc: "Use jettywrapper to download and control Jetty"
15
15
  class_option :marc , type: :boolean, default: false, aliases: "-m", desc: "Generate MARC-based demo ."
16
+ class_option :'skip-assets', type: :boolean, default: false, desc: "Skip generating javascript and css assets into the application"
16
17
 
17
- desc """
18
- This generator makes the following changes to your application:
19
- 1. Generates blacklight:models
20
- 2. Generates utilities for working with solr
21
- 3. Adds globalid to the Gemfile
22
- 4. Creates a number of public assets, including images, stylesheets, and javascript
23
- 5. Injects behavior into your user application_controller.rb
24
- 6. Adds example configurations for dealing with MARC-like data
25
- 7. Adds Blacklight routes to your ./config/routes.rb
18
+ desc <<-EOS
19
+ This generator makes the following changes to your application:
20
+ 1. Generates blacklight:models
21
+ 2. Generates utilities for working with solr
22
+ 3. Creates a number of public assets, including images, stylesheets, and javascript
23
+ 4. Injects behavior into your user application_controller.rb
24
+ 5. Adds example configurations for dealing with MARC-like data
25
+ 6. Adds Blacklight routes to your ./config/routes.rb
26
26
 
27
- Thank you for Installing Blacklight.
28
- """
27
+ Thank you for Installing Blacklight.
28
+ EOS
29
29
 
30
30
  def add_solr_wrapper
31
- if solr_version == 'latest'
32
- generate 'blacklight:solr5'
33
- else
34
- generate "blacklight:solr#{solr_version}"
35
- end
36
- end
37
-
38
- def add_globalid_gem
39
- gem "globalid"
31
+ generator_options = '--jettywrapper' if options[:jettywrapper]
32
+ solr_generator = case
33
+ when options[:jettywrapper]
34
+ 'blacklight:solr4'
35
+ when solr_version == 'latest'
36
+ 'blacklight:solr5'
37
+ else
38
+ "blacklight:solr#{solr_version}"
39
+ end
40
+ generate solr_generator, generator_options
40
41
  end
41
42
 
42
43
  def bundle_install
@@ -49,7 +50,7 @@ module Blacklight
49
50
  # Call external generator in AssetsGenerator, so we can
50
51
  # leave that callable seperately too.
51
52
  def copy_public_assets
52
- generate "blacklight:assets"
53
+ generate "blacklight:assets" unless options[:'skip-assets']
53
54
  end
54
55
 
55
56
  def generate_blacklight_document
@@ -85,7 +86,7 @@ module Blacklight
85
86
  def add_sass_configuration
86
87
 
87
88
  insert_into_file "config/application.rb", :after => "config.assets.enabled = true" do <<EOF
88
-
89
+
89
90
  # Default SASS Configuration, check out https://github.com/rails/sass-rails for details
90
91
  config.assets.compress = !Rails.env.development?
91
92
  EOF
@@ -98,7 +99,8 @@ EOF
98
99
 
99
100
  def generate_blacklight_marc_demo
100
101
  if options[:marc]
101
- gem "blacklight-marc", "~> 5.0"
102
+ blacklight_marc = String.new('blacklight-marc')
103
+ gem blacklight_marc, '~> 6.0'
102
104
 
103
105
  Bundler.with_clean_env do
104
106
  run "bundle install"
@@ -109,9 +111,7 @@ EOF
109
111
  end
110
112
 
111
113
  def add_routes
112
- route <<-EOF
113
- mount Blacklight::Engine => '/'
114
- EOF
114
+ route "mount Blacklight::Engine => '/'"
115
115
  end
116
116
  end
117
117
  end
@@ -8,11 +8,12 @@ module Blacklight
8
8
 
9
9
  source_root File.expand_path('../templates', __FILE__)
10
10
 
11
- desc """
12
- This generator makes the following changes to your application:
13
- 1. Creates several database migrations if they do not exist in /db/migrate
14
- 2. Creates config/blacklight.yml with a default configuration
15
- """
11
+ desc <<-EOS
12
+ This generator makes the following changes to your application:
13
+ 1. Creates several database migrations if they do not exist in /db/migrate
14
+ 2. Creates config/blacklight.yml with a default configuration
15
+ EOS
16
+
16
17
  # Copy all files in templates/config directory to host config
17
18
  def create_configuration_files
18
19
  copy_file "config/blacklight.yml", "config/blacklight.yml"
@@ -25,20 +26,21 @@ This generator makes the following changes to your application:
25
26
  end
26
27
 
27
28
  def add_routes
28
- route <<-EOF.strip_heredoc
29
- concern :exportable, Blacklight::Routes::Exportable.new
29
+ route <<-EOF
30
+
31
+ concern :exportable, Blacklight::Routes::Exportable.new
30
32
 
31
- resources :solr_documents, only: [:show], path: '/catalog', controller: 'catalog' do
32
- concerns :exportable
33
- end
33
+ resources :solr_documents, only: [:show], path: '/catalog', controller: 'catalog' do
34
+ concerns :exportable
35
+ end
34
36
 
35
- resources :bookmarks do
36
- concerns :exportable
37
+ resources :bookmarks do
38
+ concerns :exportable
37
39
 
38
- collection do
39
- delete 'clear'
40
- end
41
- end
40
+ collection do
41
+ delete 'clear'
42
+ end
43
+ end
42
44
  EOF
43
45
  end
44
46
 
@@ -9,10 +9,10 @@ module Blacklight
9
9
 
10
10
  argument :model_name, :type => :string , :default => "search_builder"
11
11
 
12
- desc """
13
- This generator makes the following changes to your application:
14
- 1. Creates a blacklight search builder in your /app/models directory
15
- """
12
+ desc <<-EOS
13
+ This generator makes the following changes to your application:
14
+ 1. Creates a blacklight search builder in your /app/models directory
15
+ EOS
16
16
  def create_search_builder
17
17
  template "search_builder.rb", "app/models/#{model_name}.rb"
18
18
  end
@@ -3,25 +3,30 @@ require 'rails/generators'
3
3
 
4
4
  module Blacklight
5
5
  class Solr4Generator < Rails::Generators::Base
6
- desc """
7
- This generator makes the following changes to your application:
8
- 1. Installs jettywrapper into your application
9
- 2. Adds rsolr to your Gemfile
10
- """
6
+
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ class_option :jettywrapper, type: :boolean, default: false, desc: "Use jettywrapper to download and control Jetty"
10
+
11
+ desc <<-EOS
12
+ This generator makes the following changes to your application:
13
+ 1. Installs jettywrapper into your application
14
+ 2. Adds rsolr to your Gemfile
15
+ EOS
11
16
 
12
17
  def install_jettywrapper
13
18
  return unless options[:jettywrapper]
14
- gem "jettywrapper", ">= 2.0"
15
19
 
16
- copy_file "config/jetty.yml"
20
+ gem "jettywrapper".dup, ">= 2.0"
21
+ copy_file "config/jetty.yml", "config/jetty.yml"
17
22
 
18
23
  append_to_file "Rakefile",
19
- "\nZIP_URL = \"https://github.com/projectblacklight/blacklight-jetty/archive/v4.10.4.zip\"\n" +
24
+ "\nZIP_URL = \"https://github.com/projectblacklight/blacklight-jetty/archive/v4.10.4.zip\"\n" \
20
25
  "require 'jettywrapper'\n"
21
26
  end
22
27
 
23
28
  def add_rsolr_gem
24
- gem "rsolr", "~> 1.0.6"
29
+ gem "rsolr".dup, "~> 1.0"
25
30
  end
26
31
 
27
32
  end
@@ -9,13 +9,15 @@ module Blacklight
9
9
  EOF
10
10
 
11
11
  def install_solrwrapper
12
- gem 'solr_wrapper', '>= 0.3'
12
+ gem_group :development, :test do
13
+ gem 'solr_wrapper', '>= 0.3'
14
+ end
13
15
 
14
16
  append_to_file "Rakefile", "\nrequire 'solr_wrapper/rake_task'\n"
15
17
  end
16
18
 
17
19
  def add_rsolr_gem
18
- gem 'rsolr', '~> 1.0.6'
20
+ gem 'rsolr', '~> 1.0'
19
21
  end
20
22
  end
21
23
  end
@@ -1,21 +1,19 @@
1
1
  # frozen_string_literal: true
2
- class <%= model_name.classify %>
3
-
2
+ class <%= model_name.classify %>
4
3
  include Blacklight::Solr::Document
5
4
 
6
5
  # self.unique_key = 'id'
7
-
6
+
8
7
  # Email uses the semantic field mappings below to generate the body of an email.
9
- SolrDocument.use_extension( Blacklight::Document::Email )
10
-
8
+ SolrDocument.use_extension(Blacklight::Document::Email)
9
+
11
10
  # SMS uses the semantic field mappings below to generate the body of an SMS email.
12
- SolrDocument.use_extension( Blacklight::Document::Sms )
11
+ SolrDocument.use_extension(Blacklight::Document::Sms)
13
12
 
14
13
  # DublinCore uses the semantic field mappings below to assemble an OAI-compliant Dublin Core document
15
14
  # Semantic mappings of solr stored fields. Fields may be multi or
16
15
  # single valued. See Blacklight::Document::SemanticFields#field_semantics
17
16
  # and Blacklight::Document::SemanticFields#to_semantic_values
18
17
  # Recommendation: Use field names from Dublin Core
19
- use_extension( Blacklight::Document::DublinCore)
20
-
18
+ use_extension(Blacklight::Document::DublinCore)
21
19
  end