blacklight 5.1.1 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -0
  3. data/VERSION +1 -1
  4. data/app/assets/javascripts/blacklight/search_context.js +38 -24
  5. data/app/helpers/blacklight/blacklight_helper_behavior.rb +49 -70
  6. data/app/helpers/blacklight/catalog_helper_behavior.rb +1 -8
  7. data/app/helpers/blacklight/configuration_helper_behavior.rb +10 -2
  8. data/app/helpers/blacklight/facets_helper_behavior.rb +4 -1
  9. data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +2 -2
  10. data/app/helpers/blacklight/url_helper_behavior.rb +41 -7
  11. data/app/views/catalog/_facet_layout.html.erb +2 -2
  12. data/app/views/catalog/_per_page_widget.html.erb +4 -4
  13. data/app/views/catalog/_previous_next_doc.html.erb +1 -1
  14. data/app/views/catalog/_show_tools.html.erb +1 -1
  15. data/app/views/catalog/show.html.erb +1 -1
  16. data/app/views/layouts/blacklight.html.erb +1 -1
  17. data/blacklight.gemspec +1 -1
  18. data/config/jetty.yml +3 -0
  19. data/config/locales/blacklight.es.yml +220 -0
  20. data/gemfiles/rails4.1.gemfile +10 -0
  21. data/lib/blacklight/base.rb +1 -1
  22. data/lib/blacklight/catalog/search_context.rb +15 -15
  23. data/lib/blacklight/catalog.rb +19 -6
  24. data/lib/blacklight/configuration.rb +126 -31
  25. data/lib/blacklight/document_presenter.rb +168 -0
  26. data/lib/blacklight/request_builders.rb +288 -0
  27. data/lib/blacklight/routes.rb +6 -2
  28. data/lib/blacklight/solr/request.rb +1 -1
  29. data/lib/blacklight/solr_helper.rb +50 -323
  30. data/lib/blacklight/solr_response/facets.rb +7 -3
  31. data/lib/blacklight/utils.rb +39 -7
  32. data/lib/blacklight.rb +5 -3
  33. data/lib/generators/blacklight/install_generator.rb +17 -5
  34. data/lib/generators/blacklight/models_generator.rb +0 -1
  35. data/lib/generators/blacklight/templates/catalog_controller.rb +6 -0
  36. data/lib/generators/blacklight/templates/config/jetty.yml +8 -4
  37. data/lib/generators/blacklight/templates/config/solr.yml +2 -0
  38. data/spec/controllers/catalog_controller_spec.rb +41 -22
  39. data/spec/features/alternate_controller_spec.rb +1 -1
  40. data/spec/features/search_filters_spec.rb +24 -24
  41. data/spec/features/search_results_spec.rb +9 -4
  42. data/spec/features/search_sort_spec.rb +1 -1
  43. data/spec/helpers/blacklight_helper_spec.rb +87 -0
  44. data/spec/helpers/catalog_helper_spec.rb +5 -10
  45. data/spec/helpers/configuration_helper_spec.rb +22 -1
  46. data/spec/helpers/facets_helper_spec.rb +6 -0
  47. data/spec/helpers/render_constraints_helper_spec.rb +1 -2
  48. data/spec/helpers/url_helper_spec.rb +45 -2
  49. data/spec/lib/blacklight/routes_spec.rb +4 -4
  50. data/spec/lib/blacklight/solr_helper_spec.rb +364 -253
  51. data/spec/lib/blacklight/solr_response/facets_spec.rb +82 -0
  52. data/spec/lib/blacklight/solr_response_spec.rb +3 -1
  53. data/spec/lib/document_presenter_spec.rb +216 -0
  54. data/spec/lib/utils_spec.rb +8 -0
  55. data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
  56. data/spec/views/catalog/index.html.erb_spec.rb +29 -21
  57. data/spec/views/catalog/show.html.erb_spec.rb +11 -7
  58. data/template.demo.rb +20 -0
  59. metadata +12 -4
  60. data/lib/generators/blacklight/jetty_generator.rb +0 -70
@@ -0,0 +1,82 @@
1
+ require 'spec_helper'
2
+
3
+ describe Blacklight::SolrResponse::Facets do
4
+ describe Blacklight::SolrResponse::Facets::FacetField do
5
+
6
+ describe "A field with default options" do
7
+ subject { Blacklight::SolrResponse::Facets::FacetField.new "my_field", [] }
8
+
9
+ its(:name) { should eq "my_field" }
10
+ its(:limit) { should eq nil }
11
+ its(:sort) { should eq 'index' }
12
+ its(:offset) { should eq 0 }
13
+ end
14
+
15
+ describe "A field with additional options" do
16
+ subject { Blacklight::SolrResponse::Facets::FacetField.new "my_field", [], limit: 15, sort: 'alpha', offset: 23 }
17
+
18
+ its(:name) { should eq "my_field" }
19
+ its(:limit) { should eq 15 }
20
+ its(:sort) { should eq 'alpha' }
21
+ its(:offset) { should eq 23 }
22
+ end
23
+ end
24
+
25
+ describe "#facet_by_field_name" do
26
+ let(:facet_field) { ['my_field', []] }
27
+ let(:response_header) { { params: request_params }}
28
+ let(:request_params) { Hash.new }
29
+ subject { Blacklight::SolrResponse.new({responseHeader: response_header, facet_counts: { facet_fields: [facet_field] }}.with_indifferent_access, request_params) }
30
+
31
+ describe "#limit" do
32
+ it "should extract a field-specific limit value" do
33
+ request_params['f.my_field.facet.limit'] = "10"
34
+ request_params['facet.limit'] = "15"
35
+ expect(subject.facet_by_field_name('my_field').limit).to eq 10
36
+ end
37
+
38
+ it "should extract a global limit value" do
39
+ request_params['facet.limit'] = "15"
40
+ expect(subject.facet_by_field_name('my_field').limit).to eq 15
41
+ end
42
+
43
+ it "should be nil if no value is found" do
44
+ expect(subject.facet_by_field_name('my_field').limit).to be_nil
45
+ end
46
+ end
47
+
48
+ describe "#offset" do
49
+ it "should extract a field-specific offset value" do
50
+ request_params['f.my_field.facet.offset'] = "10"
51
+ request_params['facet.offset'] = "15"
52
+ expect(subject.facet_by_field_name('my_field').offset).to eq 10
53
+ end
54
+
55
+ it "should extract a global offset value" do
56
+ request_params['facet.offset'] = "15"
57
+ expect(subject.facet_by_field_name('my_field').offset).to eq 15
58
+ end
59
+
60
+ it "should be nil if no value is found" do
61
+ expect(subject.facet_by_field_name('my_field').offset).to eq 0
62
+ end
63
+ end
64
+
65
+ describe "#sort" do
66
+ it "should extract a field-specific sort value" do
67
+ request_params['f.my_field.facet.sort'] = "alpha"
68
+ request_params['facet.sort'] = "index"
69
+ expect(subject.facet_by_field_name('my_field').sort).to eq 'alpha'
70
+ end
71
+
72
+ it "should extract a global sort value" do
73
+ request_params['facet.sort'] = "alpha"
74
+ expect(subject.facet_by_field_name('my_field').sort).to eq 'alpha'
75
+ end
76
+
77
+ it "should default to index if no value is found" do
78
+ expect(subject.facet_by_field_name('my_field').sort).to eq 'index'
79
+ end
80
+ end
81
+ end
82
+ end
@@ -48,12 +48,14 @@ describe Blacklight::SolrResponse do
48
48
 
49
49
  r.facets.each do |facet|
50
50
  expect(facet).to respond_to :name
51
+ expect(facet).to respond_to :sort
52
+ expect(facet).to respond_to :offset
53
+ expect(facet).to respond_to :limit
51
54
  facet.items.each do |item|
52
55
  expect(item).to respond_to :value
53
56
  expect(item).to respond_to :hits
54
57
  end
55
58
  end
56
-
57
59
  end
58
60
 
59
61
  it "should provide kaminari pagination helpers" do
@@ -0,0 +1,216 @@
1
+ require 'spec_helper'
2
+
3
+ describe Blacklight::DocumentPresenter do
4
+ include Capybara::RSpecMatchers
5
+ let(:request_context) { double(:add_facet_params => '') }
6
+ let(:document) { double }
7
+ let(:config) { Blacklight::Configuration.new }
8
+
9
+ subject { Blacklight::DocumentPresenter.new(document, request_context, config) }
10
+
11
+ describe "render_index_field_value" do
12
+ let(:config) do
13
+ Blacklight::Configuration.new.configure do |config|
14
+ config.add_index_field 'qwer'
15
+ config.add_index_field 'asdf', :helper_method => :render_asdf_index_field
16
+ config.add_index_field 'link_to_search_true', :link_to_search => true
17
+ config.add_index_field 'link_to_search_named', :link_to_search => :some_field
18
+ config.add_index_field 'highlight', :highlight => true
19
+ config.add_index_field 'solr_doc_accessor', :accessor => true
20
+ config.add_index_field 'explicit_accessor', :accessor => :solr_doc_accessor
21
+ config.add_index_field 'explicit_accessor_with_arg', :accessor => :solr_doc_accessor_with_arg
22
+ end
23
+ end
24
+ it "should check for an explicit value" do
25
+ document.should_not_receive(:get).with('asdf', :sep => nil)
26
+ value = subject.render_index_field_value 'asdf', :value => 'asdf'
27
+ expect(value).to eq 'asdf'
28
+ end
29
+
30
+ it "should check for a helper method to call" do
31
+ document.should_receive(:get).with('asdf', :sep => nil)
32
+ request_context.stub(:render_asdf_index_field).and_return('custom asdf value')
33
+ value = subject.render_index_field_value 'asdf'
34
+ expect(value).to eq 'custom asdf value'
35
+ end
36
+
37
+ it "should check for a link_to_search" do
38
+ document.should_receive(:get).with('link_to_search_true', :sep => nil).and_return('x')
39
+ request_context.should_receive(:add_facet_params).and_return(:f => { :link_to_search_true => ['x'] })
40
+ request_context.should_receive(:search_action_path).with(:f => { :link_to_search_true => ['x'] }).and_return('/foo')
41
+ request_context.should_receive(:link_to).with("x", '/foo').and_return('bar')
42
+ value = subject.render_index_field_value 'link_to_search_true'
43
+ expect(value).to eq 'bar'
44
+ end
45
+
46
+ it "should check for a link_to_search with a field name" do
47
+ document.should_receive(:get).with('link_to_search_named', :sep => nil).and_return('x')
48
+ request_context.should_receive(:add_facet_params).and_return(:f => { :some_field => ['x'] })
49
+ request_context.should_receive(:search_action_path).with(:f => { :some_field => ['x'] }).and_return('/foo')
50
+ request_context.should_receive(:link_to).with("x", '/foo').and_return('bar')
51
+ value = subject.render_index_field_value 'link_to_search_named'
52
+ expect(value).to eq 'bar'
53
+ end
54
+
55
+ it "should gracefully handle when no highlight field is available" do
56
+ document.should_not_receive(:get)
57
+ document.should_receive(:has_highlight_field?).and_return(false)
58
+ value = subject.render_index_field_value 'highlight'
59
+ expect(value).to be_blank
60
+ end
61
+
62
+ it "should check for a highlighted field" do
63
+ document.should_not_receive(:get)
64
+ document.should_receive(:has_highlight_field?).and_return(true)
65
+ document.should_receive(:highlight_field).with('highlight').and_return(['<em>highlight</em>'.html_safe])
66
+ value = subject.render_index_field_value 'highlight'
67
+ expect(value).to eq '<em>highlight</em>'
68
+ end
69
+
70
+ it "should check the document field value" do
71
+ document.should_receive(:get).with('qwer', :sep => nil).and_return('document qwer value')
72
+ value = subject.render_index_field_value 'qwer'
73
+ expect(value).to eq 'document qwer value'
74
+ end
75
+
76
+ it "should work with index fields that aren't explicitly defined" do
77
+ document.should_receive(:get).with('mnbv', :sep => nil).and_return('document mnbv value')
78
+ value = subject.render_index_field_value 'mnbv'
79
+ expect(value).to eq 'document mnbv value'
80
+ end
81
+
82
+ it "should call an accessor on the solr document" do
83
+ document.stub(:solr_doc_accessor => "123")
84
+ value = subject.render_index_field_value 'solr_doc_accessor'
85
+ expect(value).to eq "123"
86
+ end
87
+
88
+ it "should call an explicit accessor on the solr document" do
89
+ document.stub(:solr_doc_accessor => "123")
90
+ value = subject.render_index_field_value 'explicit_accessor'
91
+ expect(value).to eq "123"
92
+ end
93
+
94
+ it "should call an implicit accessor on the solr document" do
95
+ expect(document).to receive(:solr_doc_accessor_with_arg).with('explicit_accessor_with_arg').and_return("123")
96
+ value = subject.render_index_field_value 'explicit_accessor_with_arg'
97
+ expect(value).to eq "123"
98
+ end
99
+ end
100
+
101
+ describe "render_document_show_field_value" do
102
+ let(:config) do
103
+ Blacklight::Configuration.new.configure do |config|
104
+ config.add_show_field 'qwer'
105
+ config.add_show_field 'asdf', :helper_method => :render_asdf_document_show_field
106
+ config.add_show_field 'link_to_search_true', :link_to_search => true
107
+ config.add_show_field 'link_to_search_named', :link_to_search => :some_field
108
+ config.add_show_field 'highlight', :highlight => true
109
+ config.add_show_field 'solr_doc_accessor', :accessor => true
110
+ config.add_show_field 'explicit_accessor', :accessor => :solr_doc_accessor
111
+ config.add_show_field 'explicit_array_accessor', :accessor => [:solr_doc_accessor, :some_method]
112
+ config.add_show_field 'explicit_accessor_with_arg', :accessor => :solr_doc_accessor_with_arg
113
+ end
114
+ end
115
+
116
+ it "should check for an explicit value" do
117
+ document.should_not_receive(:get).with('asdf', :sep => nil)
118
+ request_context.should_not_receive(:render_asdf_document_show_field)
119
+ value = subject.render_document_show_field_value 'asdf', :value => 'val1'
120
+ expect(value).to eq 'val1'
121
+ end
122
+
123
+ it "should check for a helper method to call" do
124
+ document.should_receive(:get).with('asdf', :sep => nil)
125
+ request_context.stub(:render_asdf_document_show_field).and_return('custom asdf value')
126
+ value = subject.render_document_show_field_value 'asdf'
127
+ expect(value).to eq 'custom asdf value'
128
+ end
129
+
130
+ it "should check for a link_to_search" do
131
+ document.should_receive(:get).with('link_to_search_true', :sep => nil).and_return('x')
132
+ request_context.should_receive(:search_action_path).with('').and_return('/foo')
133
+ request_context.should_receive(:link_to).with("x", '/foo').and_return('bar')
134
+ value = subject.render_document_show_field_value 'link_to_search_true'
135
+ expect(value).to eq 'bar'
136
+ end
137
+
138
+ it "should check for a link_to_search with a field name" do
139
+ document.should_receive(:get).with('link_to_search_named', :sep => nil).and_return('x')
140
+ request_context.should_receive(:search_action_path).with('').and_return('/foo')
141
+ request_context.should_receive(:link_to).with("x", '/foo').and_return('bar')
142
+ value = subject.render_document_show_field_value 'link_to_search_named'
143
+ expect(value).to eq 'bar'
144
+ end
145
+
146
+ it "should gracefully handle when no highlight field is available" do
147
+ document.should_not_receive(:get)
148
+ document.should_receive(:has_highlight_field?).and_return(false)
149
+ value = subject.render_document_show_field_value 'highlight'
150
+ expect(value).to be_blank
151
+ end
152
+
153
+ it "should check for a highlighted field" do
154
+ document.should_not_receive(:get)
155
+ document.should_receive(:has_highlight_field?).and_return(true)
156
+ document.should_receive(:highlight_field).with('highlight').and_return(['<em>highlight</em>'.html_safe])
157
+ value = subject.render_document_show_field_value 'highlight'
158
+ expect(value).to eq '<em>highlight</em>'
159
+ end
160
+
161
+
162
+ it "should check the document field value" do
163
+ document.should_receive(:get).with('qwer', :sep => nil).and_return('document qwer value')
164
+ value = subject.render_document_show_field_value 'qwer'
165
+ expect(value).to eq 'document qwer value'
166
+ end
167
+
168
+ it "should work with show fields that aren't explicitly defined" do
169
+ document.should_receive(:get).with('mnbv', :sep => nil).and_return('document mnbv value')
170
+ value = subject.render_document_show_field_value 'mnbv'
171
+ expect(value).to eq 'document mnbv value'
172
+ end
173
+
174
+ it "should call an accessor on the solr document" do
175
+ document.stub(:solr_doc_accessor => "123")
176
+ value = subject.render_document_show_field_value 'solr_doc_accessor'
177
+ expect(value).to eq "123"
178
+ end
179
+
180
+ it "should call an explicit accessor on the solr document" do
181
+ document.stub(:solr_doc_accessor => "123")
182
+ value = subject.render_document_show_field_value 'explicit_accessor'
183
+ expect(value).to eq "123"
184
+ end
185
+
186
+ it "should call an explicit array-style accessor on the solr document" do
187
+ document.stub(:solr_doc_accessor => double(:some_method => "123"))
188
+ value = subject.render_document_show_field_value 'explicit_array_accessor'
189
+ expect(value).to eq "123"
190
+ end
191
+
192
+ it "should call an accessor on the solr document with the field as an argument" do
193
+ expect(document).to receive(:solr_doc_accessor_with_arg).with('explicit_accessor_with_arg').and_return("123")
194
+ value = subject.render_document_show_field_value 'explicit_accessor_with_arg'
195
+ expect(value).to eq "123"
196
+ end
197
+ end
198
+ describe "render_field_value" do
199
+ it "should join and html-safe values" do
200
+ expect(subject.render_field_value(['a', 'b'])).to eq "a, b"
201
+ end
202
+
203
+ it "should join values using the field_value_separator" do
204
+ subject.stub(:field_value_separator).and_return(" -- ")
205
+ expect(subject.render_field_value(['a', 'b'])).to eq "a -- b"
206
+ end
207
+
208
+ it "should use the separator from the Blacklight field configuration by default" do
209
+ expect(subject.render_field_value(['c', 'd'], double(:separator => '; ', :itemprop => nil))).to eq "c; d"
210
+ end
211
+
212
+ it "should include schema.org itemprop attributes" do
213
+ expect(subject.render_field_value('a', double(:separator => nil, :itemprop => 'some-prop'))).to have_selector("span[@itemprop='some-prop']", :text => "a")
214
+ end
215
+ end
216
+ end
@@ -84,5 +84,13 @@ describe 'Blacklight::Utils' do
84
84
  expect(@h[:a]).to eq 'a'
85
85
  end
86
86
  end
87
+
88
+ describe "#to_json" do
89
+ subject { Blacklight::OpenStructWithHashAccess.new a: 1, b: 2}
90
+
91
+ it "should serialize as json" do
92
+ expect(subject.to_json).to eq ({a: 1, b:2}).to_json
93
+ end
94
+ end
87
95
  end
88
96
  end
@@ -23,7 +23,7 @@ class TestAppGenerator < Rails::Generators::Base
23
23
  run "bundle install"
24
24
  end
25
25
 
26
- generate 'blacklight:install', '--devise --marc'
26
+ generate 'blacklight:install', '--devise --marc --jettywrapper'
27
27
  end
28
28
 
29
29
  def run_test_support_generator
@@ -1,30 +1,38 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "catalog/index.html.erb" do
4
- it "should render the sidebar and content panes" do
5
- view.stub(:blacklight_config).and_return(Blacklight::Configuration.new)
6
- render
7
- expect(rendered).to match /id="sidebar"/
8
- expect(rendered).to match /id="content"/
9
- end
10
4
 
11
- it "should render the search_sidebar partial " do
12
- stub_template "catalog/_search_sidebar.html.erb" => "sidebar_content"
5
+ describe "with no search parameters" do
6
+ before do
7
+ view.stub(:has_search_parameters?).and_return(false)
8
+ view.stub(:blacklight_config).and_return(Blacklight::Configuration.new)
9
+ end
10
+ it "should render the sidebar and content panes" do
11
+ render
12
+ expect(rendered).to match /id="sidebar"/
13
+ expect(rendered).to match /id="content"/
14
+ end
13
15
 
14
- view.stub(:blacklight_config).and_return(Blacklight::Configuration.new)
15
- render
16
- expect(rendered).to match /sidebar_content/
16
+ it "should render the search_sidebar partial " do
17
+ stub_template "catalog/_search_sidebar.html.erb" => "sidebar_content"
18
+ render
19
+ expect(rendered).to match /sidebar_content/
20
+ end
17
21
  end
18
22
 
19
- it "should render the search_header partial " do
20
- stub_template "catalog/_results_pagination.html.erb" => ""
21
- stub_template "catalog/_search_header.html.erb" => "header_content"
23
+ describe "with search parameters" do
24
+ before do
25
+ view.stub(:has_search_parameters?).and_return(true)
26
+ stub_template "catalog/_results_pagination.html.erb" => ""
27
+ stub_template "catalog/_search_header.html.erb" => "header_content"
22
28
 
23
- view.stub(:blacklight_config).and_return(Blacklight::Configuration.new)
24
- view.stub(:has_search_parameters?).and_return(true)
25
- view.stub(:render_opensearch_response_metadata).and_return("")
26
- assign(:response, double(:empty? => true))
27
- render
28
- expect(rendered).to match /header_content/
29
+ view.stub(:blacklight_config).and_return(Blacklight::Configuration.new)
30
+ view.stub(:render_opensearch_response_metadata).and_return("")
31
+ assign(:response, double(:empty? => true))
32
+ end
33
+ it "should render the search_header partial " do
34
+ render
35
+ expect(rendered).to match /header_content/
36
+ end
29
37
  end
30
- end
38
+ end
@@ -13,13 +13,21 @@ describe "catalog/show.html.erb" do
13
13
  before :each do
14
14
  view.stub(:has_user_authentication_provider? => false)
15
15
  view.stub(:render_document_sidebar_partial => "Sidebar")
16
+ assign :document, document
17
+ view.stub(:blacklight_config).and_return(blacklight_config)
18
+ end
19
+
20
+ it "should set the @page_title" do
21
+ view.stub(:document_show_html_title).and_return("Heading")
22
+ render
23
+ page_title = view.instance_variable_get(:@page_title)
24
+ expect(page_title).to eq "Heading - Blacklight"
25
+ expect(page_title).to be_html_safe
16
26
  end
17
27
 
18
28
  it "should include schema.org itemscope/type properties" do
19
29
  view.stub(:document_show_html_title).and_return("Heading")
20
30
  document.stub(:itemtype => 'some-item-type-uri')
21
- assign :document, document
22
- view.stub(:blacklight_config).and_return(blacklight_config)
23
31
  render
24
32
 
25
33
  expect(rendered).to have_selector('div#document[@itemscope]')
@@ -28,11 +36,9 @@ describe "catalog/show.html.erb" do
28
36
 
29
37
  it "should render the show_header and show partials by default" do
30
38
  view.stub(:render_grouped_response?).and_return(false)
31
- view.stub(:blacklight_config).and_return(blacklight_config)
32
39
  stub_template "catalog/_show_header_default.html.erb" => "document_header"
33
40
  stub_template "catalog/_show_default.html.erb" => "show_default"
34
41
 
35
- assign :document, document
36
42
  render
37
43
 
38
44
  expect(rendered).to match /document_header/
@@ -42,15 +48,13 @@ describe "catalog/show.html.erb" do
42
48
 
43
49
  it "should use the show.partials parameter to determine the partials to render" do
44
50
  view.stub(:render_grouped_response?).and_return(false)
45
- view.stub(:blacklight_config).and_return(blacklight_config)
46
51
  blacklight_config.show.partials = ['a', 'b', 'c']
47
52
  stub_template "catalog/_a_default.html.erb" => "a_partial"
48
53
  stub_template "catalog/_b_default.html.erb" => "b_partial"
49
54
  stub_template "catalog/_c_default.html.erb" => "c_partial"
50
- assign :document, document
51
55
  render
52
56
  expect(rendered).to match /a_partial/
53
57
  expect(rendered).to match /b_partial/
54
58
  expect(rendered).to match /c_partial/
55
59
  end
56
- end
60
+ end
data/template.demo.rb ADDED
@@ -0,0 +1,20 @@
1
+ gem "blacklight"
2
+
3
+ run "bundle install"
4
+
5
+ # run the blacklight install generator
6
+ generate 'blacklight:install', '--devise --marc --jettywrapper'
7
+
8
+ # run the database migrations
9
+ rake "db:migrate"
10
+
11
+ # index some data
12
+ rake "jetty:clean"
13
+
14
+ require 'rails'
15
+ require 'jettywrapper'
16
+
17
+ jetty_params = Jettywrapper.load_config('development')
18
+ Jettywrapper.wrap(jetty_params) do
19
+ rake "blacklight:solr:seed"
20
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.1
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -115,14 +115,14 @@ dependencies:
115
115
  requirements:
116
116
  - - ">="
117
117
  - !ruby/object:Gem::Version
118
- version: 1.5.2
118
+ version: 1.7.0
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - ">="
124
124
  - !ruby/object:Gem::Version
125
- version: 1.5.2
125
+ version: 1.7.0
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: blacklight-marc
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -353,10 +353,12 @@ files:
353
353
  - blacklight.gemspec
354
354
  - config/jetty.yml
355
355
  - config/locales/blacklight.en.yml
356
+ - config/locales/blacklight.es.yml
356
357
  - config/locales/blacklight.fr.yml
357
358
  - db/migrate/20140202020201_create_searches.rb
358
359
  - db/migrate/20140202020202_create_bookmarks.rb
359
360
  - gemfiles/rails3.gemfile
361
+ - gemfiles/rails4.1.gemfile
360
362
  - gemfiles/rails4.gemfile
361
363
  - lib/blacklight.rb
362
364
  - lib/blacklight/base.rb
@@ -371,10 +373,12 @@ files:
371
373
  - lib/blacklight/configuration/sort_field.rb
372
374
  - lib/blacklight/configuration/view_config.rb
373
375
  - lib/blacklight/controller.rb
376
+ - lib/blacklight/document_presenter.rb
374
377
  - lib/blacklight/engine.rb
375
378
  - lib/blacklight/exceptions.rb
376
379
  - lib/blacklight/facet.rb
377
380
  - lib/blacklight/rails/routes.rb
381
+ - lib/blacklight/request_builders.rb
378
382
  - lib/blacklight/routes.rb
379
383
  - lib/blacklight/search_fields.rb
380
384
  - lib/blacklight/solr.rb
@@ -401,7 +405,6 @@ files:
401
405
  - lib/blacklight/version.rb
402
406
  - lib/generators/blacklight/assets_generator.rb
403
407
  - lib/generators/blacklight/install_generator.rb
404
- - lib/generators/blacklight/jetty_generator.rb
405
408
  - lib/generators/blacklight/models_generator.rb
406
409
  - lib/generators/blacklight/templates/alternate_controller.rb
407
410
  - lib/generators/blacklight/templates/blacklight.css.scss
@@ -451,11 +454,13 @@ files:
451
454
  - spec/lib/blacklight/solr/document_spec.rb
452
455
  - spec/lib/blacklight/solr/request_spec.rb
453
456
  - spec/lib/blacklight/solr_helper_spec.rb
457
+ - spec/lib/blacklight/solr_response/facets_spec.rb
454
458
  - spec/lib/blacklight/solr_response/group_response_spec.rb
455
459
  - spec/lib/blacklight/solr_response/group_spec.rb
456
460
  - spec/lib/blacklight/solr_response_spec.rb
457
461
  - spec/lib/blacklight/user_spec.rb
458
462
  - spec/lib/blacklight_spec.rb
463
+ - spec/lib/document_presenter_spec.rb
459
464
  - spec/lib/tasks/blacklight_task_spec.rb
460
465
  - spec/lib/utils_spec.rb
461
466
  - spec/models/bookmark_spec.rb
@@ -491,6 +496,7 @@ files:
491
496
  - spec/views/catalog/opensearch.xml.builder_spec.rb
492
497
  - spec/views/catalog/show.html.erb_spec.rb
493
498
  - tasks/blacklight.rake
499
+ - template.demo.rb
494
500
  homepage: http://projectblacklight.org/
495
501
  licenses:
496
502
  - Apache 2.0
@@ -555,11 +561,13 @@ test_files:
555
561
  - spec/lib/blacklight/solr/document_spec.rb
556
562
  - spec/lib/blacklight/solr/request_spec.rb
557
563
  - spec/lib/blacklight/solr_helper_spec.rb
564
+ - spec/lib/blacklight/solr_response/facets_spec.rb
558
565
  - spec/lib/blacklight/solr_response/group_response_spec.rb
559
566
  - spec/lib/blacklight/solr_response/group_spec.rb
560
567
  - spec/lib/blacklight/solr_response_spec.rb
561
568
  - spec/lib/blacklight/user_spec.rb
562
569
  - spec/lib/blacklight_spec.rb
570
+ - spec/lib/document_presenter_spec.rb
563
571
  - spec/lib/tasks/blacklight_task_spec.rb
564
572
  - spec/lib/utils_spec.rb
565
573
  - spec/models/bookmark_spec.rb
@@ -1,70 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'openssl'
3
-
4
- module Blacklight
5
- class Jetty < Rails::Generators::Base
6
- source_root File.expand_path('../templates', __FILE__)
7
-
8
-
9
- argument :save_location, :type=>"string", :desc => "where to install the jetty", :default => "./jetty"
10
- class_option :environment, :aliases => "-e", :type=>"string", :desc => "environment to use jetty with. Will insert into solr.yml, and also offer to index test data in test environment.", :default => Rails.env
11
- # change this to a different download if you want to peg to a different
12
- # tagged version of our known-good jetty/solr.
13
- OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE # (Required by jruby)
14
- class_option :download_url, :aliases => "-u", :type=>"string", :default =>"https://github.com/projectblacklight/blacklight-jetty/zipball/v4.0.0" , :desc=>"location of zip file including a jetty with solr setup for blacklight."
15
- class_option :downloaded_package, :aliases => "-d", :type=>"string", :desc => "manual download of BL-jetty zip file"
16
-
17
-
18
- desc """
19
- Installs a jetty container with a solr installed in it. A solr setup known
20
- good with default blacklight setup, including solr conf files for out
21
- of the box blacklight.
22
-
23
- Also adds jetty_path key to solr.yml for selected environment, to refer
24
- to this install.
25
-
26
- Requires system('unzip... ') to work, probably won't work on Windows.
27
-
28
- """
29
-
30
- def download_jetty
31
- tmp_save_dir = File.join(Rails.root, "tmp", "jetty_generator")
32
- empty_directory(tmp_save_dir)
33
-
34
- begin
35
- unless options[:downloaded_package]
36
- begin
37
- say_status("fetching", options[:download_url])
38
- zip_file = File.join(tmp_save_dir, "bl_jetty.zip")
39
- get(options[:download_url], zip_file)
40
- rescue Exception => e
41
- say_status("error", "Could not download #{options[:download_url]} : #{e}", :red)
42
- raise Thor::Error.new("Try downloading manually and then using '-d' option?")
43
- end
44
- else
45
- zip_file = options[:downloaded_package]
46
- end
47
-
48
-
49
- say_status("unzipping", zip_file)
50
- "unzip -d #{tmp_save_dir} -qo #{zip_file}".tap do |command|
51
- system(command) or raise Thor::Error.new("Error executing: #{command}")
52
- end
53
- # It unzips into a top_level directory we've got to find by name
54
- # in the tmp dir, sadly.
55
- expanded_dir = Dir[File.join(tmp_save_dir, "projectblacklight-blacklight-jetty-*")].first
56
-
57
- if File.exists?( save_location ) && ! options[:force]
58
- raise Thor::Error.new("cancelled by user") unless [nil, "", "Y", "y"].include? ask("Copy over existing #{save_location}? [Yn]")
59
- end
60
-
61
- directory(expanded_dir, save_location, :verbose => false)
62
- say_status("installed", save_location )
63
- ensure
64
- remove_dir(tmp_save_dir)
65
- end
66
- end
67
-
68
-
69
- end
70
- end