blacklight 3.0pre2 → 3.0.0pre3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +24 -0
- data/VERSION +1 -0
- data/app/helpers/catalog_helper.rb +6 -1
- data/app/views/_user_util_links.html.erb +3 -3
- data/app/views/catalog/_document.html.erb +21 -0
- data/app/views/catalog/_document_list.html.erb +1 -27
- data/app/views/catalog/index.html.erb +0 -2
- data/app/views/catalog/show.html.erb +0 -3
- data/blacklight.gemspec +4 -4
- data/features/default_setup.feature +51 -0
- data/features/generators.feature +19 -38
- data/features/support/aruba.rb +2 -2
- data/lib/blacklight.rb +0 -7
- data/lib/blacklight/solr_helper.rb +1 -1
- data/lib/blacklight/user.rb +0 -5
- data/lib/blacklight/version.rb +5 -1
- data/test_support/spec/helpers/catalog_helper_spec.rb +69 -0
- data/test_support/spec/lib/blacklight_user_spec.rb +76 -0
- metadata +26 -24
- data/README.rdoc +0 -175
- data/app/views/catalog/_solr_request.html.erb +0 -5
data/README.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Blacklight
|
2
|
+
|
3
|
+
Blacklight is open source discovery software. Libraries (or anyone else) can use Blacklight to enable searching and browsing of their collections online. Blacklight uses the [Apache SOLR](http://lucene.apache.org/solr) search engine to index and search full text and/or metadata, and Blacklight has a highly configurable Ruby on Rails front-end. Blacklight was originally developed at the University of Virginia Library and is made public under an Apache 2.0 license.
|
4
|
+
|
5
|
+
|
6
|
+
## Documentation, Information and Support
|
7
|
+
|
8
|
+
* [Project Homepage](http://projectblacklight.org)
|
9
|
+
* [Developer Documentation](https://github.com/projectblacklight/blacklight/wiki)
|
10
|
+
* [Quickstart Guide](https://github.com/projectblacklight/blacklight/wiki/Blacklight-3.x-Quickstart)
|
11
|
+
* [JIRA Issue Tracker](http://jira.projectblacklight.org/jira/secure/Dashboard.jspa)
|
12
|
+
* [Support](http://projectblacklight.org/support.html)
|
13
|
+
|
14
|
+
## Dependencies
|
15
|
+
|
16
|
+
* ruby v1.8.7 or higher
|
17
|
+
* git
|
18
|
+
* java 1.5 or higher
|
19
|
+
* access to a command prompt on the machine to install
|
20
|
+
|
21
|
+
In addition, you must have the Bundler and Rails 3.0 gems installed. Other gem dependencies are defined in the blacklight.gemspec file and will be automatically loaded by Bundler.
|
22
|
+
|
23
|
+
## Configuring Apache Solr
|
24
|
+
You'll also want some information about how Blacklight expects [Apache SOLR](http://lucene.apache.org/solr ) to run, which you can find in [README_SOLR](https://github.com/projectblacklight/blacklight/wiki/README_SOLR)
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.0pre3
|
@@ -12,7 +12,12 @@ module CatalogHelper
|
|
12
12
|
# from will_paginate?
|
13
13
|
def page_entries_info(collection, options = {})
|
14
14
|
start = (collection.current_page - 1) * collection.per_page + 1
|
15
|
-
|
15
|
+
|
16
|
+
# actual WillPaginate::Collection's have #total_entries. RSolr::Ext::Response
|
17
|
+
# has #total instead. We want this to work for both, to do what we want
|
18
|
+
# for RSolr, but not break WillPaginate's usual use.
|
19
|
+
total_hits = collection.respond_to?(:total_entries) ? collection.total_entries : collection.total
|
20
|
+
|
16
21
|
start_num = format_num(start)
|
17
22
|
end_num = format_num(start + collection.size - 1)
|
18
23
|
total_num = format_num(total_hits)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<% if current_user %>
|
2
2
|
<%= link_to "Log Out", destroy_user_session_path %> [<%= link_to current_user, edit_user_registration_path %>]
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
|
|
4
|
+
<%= link_to 'Your Bookmarks', bookmarks_path %>
|
5
|
+
|
|
6
6
|
<%= link_to "Saved Searches", saved_searches_path %>
|
7
7
|
<% else %>
|
8
8
|
<%= link_to 'Login', new_user_session_path %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<% # container for a single doc -%>
|
2
|
+
<div class="document <%= render_document_class document %>">
|
3
|
+
|
4
|
+
<% # header bar for doc items in index view -%>
|
5
|
+
<div class="documentHeader">
|
6
|
+
|
7
|
+
<% # bookmark/folder functions for items/docs -%>
|
8
|
+
<%= render_index_doc_actions document %>
|
9
|
+
|
10
|
+
<% # main title container for doc partial view -%>
|
11
|
+
<div class="yui-u">
|
12
|
+
<h3 class="index_title"><%= document_counter + 1 + @response.params[:start].to_i %>. <%= link_to_document document, :label=>document_show_link_field, :counter => (document_counter + 1 + @response.params[:start].to_i) %></h3>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<% # main container for doc partial view -%>
|
17
|
+
<%= render_document_partial document, :index %>
|
18
|
+
|
19
|
+
<%= render_document_unapi_microformat document %>
|
20
|
+
|
21
|
+
</div>
|
@@ -1,30 +1,4 @@
|
|
1
1
|
<% # container for all documents in index view -%>
|
2
2
|
<div id="documents">
|
3
|
-
|
4
|
-
<% # loop thru each doc -%>
|
5
|
-
<% @document_list.each_with_index do |document,counter| %>
|
6
|
-
|
7
|
-
<% # container for a single doc -%>
|
8
|
-
<div class="document <%= render_document_class document %>">
|
9
|
-
|
10
|
-
<% # header bar for doc items in index view -%>
|
11
|
-
<div class="documentHeader">
|
12
|
-
|
13
|
-
<% # bookmark/folder functions for items/docs -%>
|
14
|
-
<%= render_index_doc_actions document %>
|
15
|
-
|
16
|
-
<% # main title container for doc partial view -%>
|
17
|
-
<div class="yui-u">
|
18
|
-
<h3 class="index_title"><%= counter + 1 + @response.params[:start].to_i %>. <%= link_to_document document, :label=>document_show_link_field, :counter => (counter + 1 + @response.params[:start].to_i) %></h3>
|
19
|
-
</div>
|
20
|
-
</div>
|
21
|
-
|
22
|
-
<% # main container for doc partial view -%>
|
23
|
-
<%= render_document_partial document, :index %>
|
24
|
-
|
25
|
-
<%= render_document_unapi_microformat document %>
|
26
|
-
|
27
|
-
</div>
|
28
|
-
|
29
|
-
<% end %>
|
3
|
+
<%= render :partial => 'document', :collection => @document_list, :as => :document %>
|
30
4
|
</div>
|
data/blacklight.gemspec
CHANGED
@@ -30,10 +30,10 @@ Gem::Specification.new do |s|
|
|
30
30
|
# Required Gems
|
31
31
|
s.add_dependency "rails", "~> 3.0"
|
32
32
|
s.add_dependency "nokogiri", "~>1.5.0.beta.3" # XML Parser
|
33
|
-
s.add_dependency "marc" # Marc record parser
|
34
|
-
s.add_dependency "rsolr", '1.0
|
35
|
-
s.add_dependency "rsolr-ext", '1.0
|
36
|
-
s.add_dependency "will_paginate", "3.0.pre2" # the pagination (page 1,2,3, etc..) of our search results
|
33
|
+
s.add_dependency "marc", "~> 0.3" # Marc record parser
|
34
|
+
s.add_dependency "rsolr", '~> 1.0' # Library for interacting with rSolr.
|
35
|
+
s.add_dependency "rsolr-ext", '~> 1.0' # extension to the above for some rails-ish behaviors - currently embedded in our solr document ojbect.
|
36
|
+
s.add_dependency "will_paginate", "~> 3.0.pre2" # the pagination (page 1,2,3, etc..) of our search results
|
37
37
|
|
38
38
|
|
39
39
|
# TESTING GEM REQUIREMENTS
|
@@ -0,0 +1,51 @@
|
|
1
|
+
Feature:
|
2
|
+
In order to develop and extend the Blacklight GEM - I need to ensure that the changes
|
3
|
+
I make will still allow all tests to pass in a fresh default installation.
|
4
|
+
|
5
|
+
Scenario: The Blacklight generator installs devise when given the -d option, and the tests pass
|
6
|
+
When I run `rails new test_app`
|
7
|
+
And I cd to "test_app"
|
8
|
+
And a file named "Gemfile" with:
|
9
|
+
"""
|
10
|
+
source "http://rubygems.org"
|
11
|
+
gem 'rails', '>=3.0.4'
|
12
|
+
gem 'sqlite3-ruby', :require => 'sqlite3'
|
13
|
+
gem 'blacklight', :path => '../../../'
|
14
|
+
|
15
|
+
# For testing
|
16
|
+
group :development, :test do
|
17
|
+
gem "rspec"
|
18
|
+
gem "rspec-rails", "~>2.5.0"
|
19
|
+
gem "cucumber-rails"
|
20
|
+
gem "database_cleaner"
|
21
|
+
gem "capybara"
|
22
|
+
gem "webrat"
|
23
|
+
gem "aruba"
|
24
|
+
end
|
25
|
+
|
26
|
+
"""
|
27
|
+
And I run `bundle install --local`
|
28
|
+
|
29
|
+
Then the file "app/models/user.rb" should not exist
|
30
|
+
And I run `rails generate blacklight -d`
|
31
|
+
|
32
|
+
# Devise should now be installed.
|
33
|
+
Then a file named "app/models/user.rb" should exist
|
34
|
+
Then a directory named "app/views/devise" should exist
|
35
|
+
Then the file "app/models/user.rb" should contain "devise"
|
36
|
+
|
37
|
+
# And the user model should be setup with Blacklight
|
38
|
+
And the file "app/models/user.rb" should contain "include Blacklight::User"
|
39
|
+
|
40
|
+
And I run `rake db:migrate`
|
41
|
+
|
42
|
+
# And I complete the setup for testing
|
43
|
+
And I run `rails g cucumber:install`
|
44
|
+
And I run `rails generate blacklight:jetty test_jetty -e test`
|
45
|
+
Then a directory named "test_jetty" should exist
|
46
|
+
And I run `rake solr:marc:index_test_data RAILS_ENV=test`
|
47
|
+
And I run `rake blacklight:spec:with_solr`
|
48
|
+
Then the output should contain "0 failures"
|
49
|
+
And I remove the file "public/index.html"
|
50
|
+
And I run `rake blacklight:cucumber:with_solr`
|
51
|
+
Then the output should contain "81 passed"
|
data/features/generators.feature
CHANGED
@@ -4,7 +4,7 @@ Feature:
|
|
4
4
|
I would like to use the blacklight generator.
|
5
5
|
|
6
6
|
Scenario: The Blacklight generators create all the correct files and file modifications when executed with defaults
|
7
|
-
When I run
|
7
|
+
When I run `rails new test_app`
|
8
8
|
And I cd to "test_app"
|
9
9
|
And a file named "Gemfile" with:
|
10
10
|
"""
|
@@ -13,34 +13,32 @@ Feature:
|
|
13
13
|
gem 'sqlite3-ruby', :require => 'sqlite3'
|
14
14
|
gem 'blacklight', :path => '../../../'
|
15
15
|
"""
|
16
|
-
And I run
|
16
|
+
And I run `bundle install --local`
|
17
17
|
|
18
18
|
When I write to "app/models/user.rb" with:
|
19
19
|
"""
|
20
20
|
class User < ActiveRecord::Base
|
21
21
|
end
|
22
22
|
"""
|
23
|
-
And I run
|
23
|
+
And I run `rails generate blacklight`
|
24
24
|
Then the following files should exist:
|
25
25
|
| config/initializers/blacklight_config.rb |
|
26
26
|
| config/solr.yml |
|
27
27
|
| public/images/blacklight/bg.png |
|
28
|
-
| public/javascripts/blacklight.js
|
29
|
-
| public/javascripts/jquery-1.4.2.min.js
|
30
|
-
| public/javascripts/jquery-ui-1.8.1.custom.min.js |
|
31
|
-
| public/stylesheets/blacklight.css
|
32
|
-
| public/stylesheets/yui.css
|
33
|
-
And a directory named "public/stylesheets/jquery" should exist
|
34
|
-
And the file "app/models/user.rb" should contain "
|
28
|
+
| public/javascripts/blacklight/blacklight.js |
|
29
|
+
| public/javascripts/blacklight/jquery-1.4.2.min.js |
|
30
|
+
| public/javascripts/blacklight/jquery-ui-1.8.1.custom.min.js |
|
31
|
+
| public/stylesheets/blacklight/blacklight.css |
|
32
|
+
| public/stylesheets/blacklight/yui.css |
|
33
|
+
And a directory named "public/stylesheets/blacklight/jquery" should exist
|
34
|
+
And the file "app/models/user.rb" should contain "include Blacklight::User"
|
35
35
|
|
36
36
|
# Devise should next exist in thie scenerio
|
37
37
|
And a directory named "app/views/devise" should not exist
|
38
38
|
And the file "app/models/user.rb" should not contain "devise"
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
Scenario: The Blacklight generator installs devise when given the -d option
|
43
|
-
When I run "rails new test_app"
|
40
|
+
Scenario: The Blacklight generator functions correctly when specifying an alternate user model
|
41
|
+
When I run `rails new test_app`
|
44
42
|
And I cd to "test_app"
|
45
43
|
And a file named "Gemfile" with:
|
46
44
|
"""
|
@@ -48,30 +46,13 @@ Feature:
|
|
48
46
|
gem 'rails', '>=3.0.4'
|
49
47
|
gem 'sqlite3-ruby', :require => 'sqlite3'
|
50
48
|
gem 'blacklight', :path => '../../../'
|
51
|
-
|
52
|
-
# For testing
|
53
|
-
gem 'rspec-rails'
|
54
|
-
gem 'cucumber-rails'
|
55
|
-
gem 'webrat' # still needed for rspec view tests
|
56
|
-
gem 'capybara' # used by latest cucumber
|
57
|
-
|
58
49
|
"""
|
59
|
-
And I run
|
60
|
-
|
61
|
-
|
62
|
-
And
|
63
|
-
|
64
|
-
# Devise should now be installed.
|
65
|
-
Then a file named "app/models/user.rb" should exist
|
66
|
-
Then a directory named "app/views/devise" should exist
|
67
|
-
Then the file "app/models/user.rb" should contain "devise"
|
50
|
+
And I run `bundle install --local`
|
51
|
+
And I run `rails generate model person`
|
52
|
+
And I run `rails generate blacklight person`
|
53
|
+
And the file "app/models/person.rb" should contain "include Blacklight::User"
|
68
54
|
|
69
|
-
#
|
70
|
-
And
|
55
|
+
# Devise should not exist in thie scenerio
|
56
|
+
And a directory named "app/views/devise" should not exist
|
57
|
+
And the file "app/models/person.rb" should not contain "devise"
|
71
58
|
|
72
|
-
# And I copy over the rspec and feature tests, just in case I want to test them.
|
73
|
-
And I run "cp -r ../../../test_app/spec ."
|
74
|
-
And I run "cp -r ../../../test_app/features ."
|
75
|
-
And I run "cp ../../../test_app/Rakefile ."
|
76
|
-
And I run "cp -r ../../../test_app/jetty ."
|
77
|
-
|
data/features/support/aruba.rb
CHANGED
data/lib/blacklight.rb
CHANGED
@@ -31,13 +31,6 @@ module Blacklight
|
|
31
31
|
attr_accessor :solr, :solr_config
|
32
32
|
end
|
33
33
|
|
34
|
-
# Just returning a string for the Blacklight version number.
|
35
|
-
# I've just put master here now, should it say when it's running under master? (Master?)
|
36
|
-
# We need to find a better way of increasing this number automatically during releases, but this is a good way for now.
|
37
|
-
def self.version
|
38
|
-
"2.8.0"
|
39
|
-
end
|
40
|
-
|
41
34
|
# Adding a little jruby support
|
42
35
|
def self.jruby?
|
43
36
|
defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
|
@@ -316,7 +316,7 @@ module Blacklight::SolrHelper
|
|
316
316
|
# override any field-specific default in the solr request handler.
|
317
317
|
solr_params[:"f.#{facet_field}.facet.limit"] =
|
318
318
|
if solr_params["facet.limit"]
|
319
|
-
solr_params["facet.limit"] + 1
|
319
|
+
solr_params["facet.limit"].to_i + 1
|
320
320
|
elsif respond_to?(:facet_list_limit)
|
321
321
|
facet_list_limit.to_s.to_i + 1
|
322
322
|
else
|
data/lib/blacklight/user.rb
CHANGED
data/lib/blacklight/version.rb
CHANGED
@@ -0,0 +1,69 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
describe CatalogHelper do
|
3
|
+
include CatalogHelper
|
4
|
+
|
5
|
+
def mock_collection args
|
6
|
+
current_page = args[:current_page] || 1
|
7
|
+
per_page = args[:per_page] || 10
|
8
|
+
total = args[:total]
|
9
|
+
arr = (1..total).to_a
|
10
|
+
|
11
|
+
page_results = WillPaginate::Collection.create(current_page, per_page, total) do |pager|
|
12
|
+
pager.replace(arr.slice(pager.offset, pager.per_page))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "page_entries_info" do
|
17
|
+
before(:all) do
|
18
|
+
end
|
19
|
+
|
20
|
+
it "with no results" do
|
21
|
+
@collection = mock_collection :total => 0
|
22
|
+
|
23
|
+
html = page_entries_info(@collection, { :entry_name => 'entry_name' })
|
24
|
+
html.should == "No entry_names found"
|
25
|
+
html.html_safe?.should == true
|
26
|
+
end
|
27
|
+
|
28
|
+
it "with a single result" do
|
29
|
+
@collection = mock_collection :total => 1
|
30
|
+
|
31
|
+
html = page_entries_info(@collection, { :entry_name => 'entry_name' })
|
32
|
+
html.should == "Displaying <b>1</b> entry_name"
|
33
|
+
html.html_safe?.should == true
|
34
|
+
end
|
35
|
+
|
36
|
+
it "with a single page of results" do
|
37
|
+
@collection = mock_collection :total => 7
|
38
|
+
|
39
|
+
html = page_entries_info(@collection, { :entry_name => 'entry_name' })
|
40
|
+
html.should == "Displaying <b>all 7</b> entry_names"
|
41
|
+
html.html_safe?.should == true
|
42
|
+
end
|
43
|
+
|
44
|
+
it "on the first page of multiple pages of results" do
|
45
|
+
@collection = mock_collection :total => 15, :per_page => 10
|
46
|
+
|
47
|
+
html = page_entries_info(@collection, { :entry_name => 'entry_name' })
|
48
|
+
html.should == "Displaying entry_names <b>1 - 10</b> of <b>15</b>"
|
49
|
+
html.html_safe?.should == true
|
50
|
+
end
|
51
|
+
|
52
|
+
it "on the second page of multiple pages of results" do
|
53
|
+
@collection = mock_collection :total => 47, :per_page => 10, :current_page => 2
|
54
|
+
|
55
|
+
html = page_entries_info(@collection, { :entry_name => 'entry_name' })
|
56
|
+
html.should == "Displaying entry_names <b>11 - 20</b> of <b>47</b>"
|
57
|
+
html.html_safe?.should == true
|
58
|
+
end
|
59
|
+
|
60
|
+
it "on the last page of results" do
|
61
|
+
@collection = mock_collection :total => 47, :per_page => 10, :current_page => 5
|
62
|
+
|
63
|
+
html = page_entries_info(@collection, { :entry_name => 'entry_name' })
|
64
|
+
html.should == "Displaying entry_names <b>41 - 47</b> of <b>47</b>"
|
65
|
+
html.html_safe?.should == true
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe "Blacklight::User" do
|
4
|
+
class MockUser
|
5
|
+
include Blacklight::User::InstanceMethods
|
6
|
+
attr_accessor :searches
|
7
|
+
attr_accessor :bookmarks
|
8
|
+
end
|
9
|
+
|
10
|
+
class MockBookmark
|
11
|
+
attr_accessor :document_id
|
12
|
+
|
13
|
+
def initialize document_id
|
14
|
+
self.document_id = document_id
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
before(:each) do
|
19
|
+
@user = MockUser.new
|
20
|
+
@user.searches = []
|
21
|
+
@user.bookmarks = []
|
22
|
+
end
|
23
|
+
|
24
|
+
def mock_bookmark doc_id
|
25
|
+
MockBookmark.new doc_id
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should know if it doesn't have bookmarks" do
|
29
|
+
@user.has_bookmarks?.should == false
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should know if it has bookmarkss" do
|
33
|
+
@user.bookmarks.push(mock_bookmark(1))
|
34
|
+
@user.bookmarks.push(mock_bookmark(2))
|
35
|
+
@user.has_bookmarks?.should == true
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should know if it has a bookmarked document" do
|
39
|
+
@user.bookmarks.push(mock_bookmark(1))
|
40
|
+
@user.should be_document_is_bookmarked(1)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should return a bookmark it a document is bookmarked" do
|
44
|
+
@user.bookmarks.push(mock_bookmark(1))
|
45
|
+
@user.existing_bookmark_for(1).should be_a_kind_of(MockBookmark)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should be able to create bookmarks in batches" do
|
49
|
+
@md1 = { :document_id => 1 }
|
50
|
+
@md2 = { :document_id => 2 }
|
51
|
+
@md3 = { :document_id => 3 }
|
52
|
+
@user.bookmarks.should_receive(:create).with(@md1)
|
53
|
+
@user.bookmarks.should_receive(:create).with(@md2)
|
54
|
+
@user.bookmarks.should_receive(:create).with(@md3)
|
55
|
+
|
56
|
+
@user.documents_to_bookmark= [@md1,@md2,@md3]
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should not recreate bookmarks for documents already bookmarked" do
|
60
|
+
@md1 = { :document_id => 1 }
|
61
|
+
@user.bookmarks.should_not_receive(:create).with(@md1)
|
62
|
+
|
63
|
+
@user.bookmarks.push(mock_bookmark(1))
|
64
|
+
@user.documents_to_bookmark=[@md1]
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should know if it doesn't have a search" do
|
68
|
+
@user.has_searches?.should == false
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should know if it has a search" do
|
72
|
+
@user.searches.push(1)
|
73
|
+
@user.has_searches?.should == true
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: -766259868
|
5
|
+
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
|
11
|
-
version: 3.0pre2
|
9
|
+
- 0pre3
|
10
|
+
version: 3.0.0pre3
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- jrochkind
|
@@ -22,7 +21,7 @@ autorequire:
|
|
22
21
|
bindir: bin
|
23
22
|
cert_chain: []
|
24
23
|
|
25
|
-
date: 2011-05-
|
24
|
+
date: 2011-05-11 00:00:00 -04:00
|
26
25
|
default_executable:
|
27
26
|
dependencies:
|
28
27
|
- !ruby/object:Gem::Dependency
|
@@ -78,12 +77,13 @@ dependencies:
|
|
78
77
|
requirement: &id004 !ruby/object:Gem::Requirement
|
79
78
|
none: false
|
80
79
|
requirements:
|
81
|
-
- -
|
80
|
+
- - ~>
|
82
81
|
- !ruby/object:Gem::Version
|
83
|
-
hash:
|
82
|
+
hash: 13
|
84
83
|
segments:
|
85
84
|
- 0
|
86
|
-
|
85
|
+
- 3
|
86
|
+
version: "0.3"
|
87
87
|
type: :runtime
|
88
88
|
version_requirements: *id004
|
89
89
|
- !ruby/object:Gem::Dependency
|
@@ -92,14 +92,13 @@ dependencies:
|
|
92
92
|
requirement: &id005 !ruby/object:Gem::Requirement
|
93
93
|
none: false
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - ~>
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
hash:
|
97
|
+
hash: 15
|
98
98
|
segments:
|
99
99
|
- 1
|
100
100
|
- 0
|
101
|
-
|
102
|
-
version: 1.0.0
|
101
|
+
version: "1.0"
|
103
102
|
type: :runtime
|
104
103
|
version_requirements: *id005
|
105
104
|
- !ruby/object:Gem::Dependency
|
@@ -108,14 +107,13 @@ dependencies:
|
|
108
107
|
requirement: &id006 !ruby/object:Gem::Requirement
|
109
108
|
none: false
|
110
109
|
requirements:
|
111
|
-
- -
|
110
|
+
- - ~>
|
112
111
|
- !ruby/object:Gem::Version
|
113
|
-
hash:
|
112
|
+
hash: 15
|
114
113
|
segments:
|
115
114
|
- 1
|
116
115
|
- 0
|
117
|
-
|
118
|
-
version: 1.0.0
|
116
|
+
version: "1.0"
|
119
117
|
type: :runtime
|
120
118
|
version_requirements: *id006
|
121
119
|
- !ruby/object:Gem::Dependency
|
@@ -124,14 +122,13 @@ dependencies:
|
|
124
122
|
requirement: &id007 !ruby/object:Gem::Requirement
|
125
123
|
none: false
|
126
124
|
requirements:
|
127
|
-
- -
|
125
|
+
- - ~>
|
128
126
|
- !ruby/object:Gem::Version
|
129
|
-
hash:
|
127
|
+
hash: 270495401
|
130
128
|
segments:
|
131
129
|
- 3
|
132
130
|
- 0
|
133
|
-
-
|
134
|
-
- 2
|
131
|
+
- pre2
|
135
132
|
version: 3.0.pre2
|
136
133
|
type: :runtime
|
137
134
|
version_requirements: *id007
|
@@ -150,8 +147,9 @@ files:
|
|
150
147
|
- .yardopts
|
151
148
|
- Gemfile
|
152
149
|
- LICENSE
|
153
|
-
- README.
|
150
|
+
- README.md
|
154
151
|
- Rakefile
|
152
|
+
- VERSION
|
155
153
|
- app/controllers/bookmarks_controller.rb
|
156
154
|
- app/controllers/feedback_controller.rb
|
157
155
|
- app/controllers/folder_controller.rb
|
@@ -177,6 +175,7 @@ files:
|
|
177
175
|
- app/views/catalog/_constraints.html.erb
|
178
176
|
- app/views/catalog/_constraints_element.html.erb
|
179
177
|
- app/views/catalog/_did_you_mean.html.erb
|
178
|
+
- app/views/catalog/_document.html.erb
|
180
179
|
- app/views/catalog/_document_list.html.erb
|
181
180
|
- app/views/catalog/_email_form.html.erb
|
182
181
|
- app/views/catalog/_facet_limit.html.erb
|
@@ -196,7 +195,6 @@ files:
|
|
196
195
|
- app/views/catalog/_show_sidebar.html.erb
|
197
196
|
- app/views/catalog/_show_tools.html.erb
|
198
197
|
- app/views/catalog/_sms_form.html.erb
|
199
|
-
- app/views/catalog/_solr_request.html.erb
|
200
198
|
- app/views/catalog/_sort_and_per_page.html.erb
|
201
199
|
- app/views/catalog/_unapi_microformat.html.erb
|
202
200
|
- app/views/catalog/citation.html.erb
|
@@ -228,6 +226,7 @@ files:
|
|
228
226
|
- config.ru
|
229
227
|
- config/routes.rb
|
230
228
|
- db/seeds.rb
|
229
|
+
- features/default_setup.feature
|
231
230
|
- features/generators.feature
|
232
231
|
- features/support/aruba.rb
|
233
232
|
- install.rb
|
@@ -352,6 +351,7 @@ files:
|
|
352
351
|
- test_support/spec/data/sample_docs.yml
|
353
352
|
- test_support/spec/data/test_data.utf8.mrc
|
354
353
|
- test_support/spec/helpers/blacklight_helper_spec.rb
|
354
|
+
- test_support/spec/helpers/catalog_helper_spec.rb
|
355
355
|
- test_support/spec/helpers/hash_as_hidden_fields_spec.rb
|
356
356
|
- test_support/spec/helpers/render_constraints_helper_spec.rb
|
357
357
|
- test_support/spec/helpers/search_history_helper_spec.rb
|
@@ -362,6 +362,7 @@ files:
|
|
362
362
|
- test_support/spec/lib/blacklight_solr_document_marc_spec.rb
|
363
363
|
- test_support/spec/lib/blacklight_solr_document_spec.rb
|
364
364
|
- test_support/spec/lib/blacklight_spec.rb
|
365
|
+
- test_support/spec/lib/blacklight_user_spec.rb
|
365
366
|
- test_support/spec/lib/configurable_spec.rb
|
366
367
|
- test_support/spec/lib/facet_paginator_spec.rb
|
367
368
|
- test_support/spec/lib/marc_export_spec.rb
|
@@ -419,10 +420,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
419
420
|
requirements: []
|
420
421
|
|
421
422
|
rubyforge_project: blacklight
|
422
|
-
rubygems_version: 1.
|
423
|
+
rubygems_version: 1.3.7
|
423
424
|
signing_key:
|
424
425
|
specification_version: 3
|
425
426
|
summary: A next-geration Library Catalag for Universities
|
426
427
|
test_files:
|
428
|
+
- features/default_setup.feature
|
427
429
|
- features/generators.feature
|
428
430
|
- features/support/aruba.rb
|
data/README.rdoc
DELETED
@@ -1,175 +0,0 @@
|
|
1
|
-
Please note: The main Blacklight website is http://projectblacklight.org
|
2
|
-
|
3
|
-
=Installing Blacklight
|
4
|
-
|
5
|
-
== Some background information
|
6
|
-
|
7
|
-
Blacklight is open source discovery software. Libraries (or anyone else) can use Blacklight to enable searching and browsing of their collections online. Blacklight uses the Apache SOLR ( http://lucene.apache.org/solr ) search engine to index and search full text and/or metadata, and Blacklight has a highly configurable Ruby on Rails front-end. Blacklight was originally developed at the University of Virginia Library and is made public under an Apache 2.0 license.
|
8
|
-
|
9
|
-
== Install & Use (With Devise)
|
10
|
-
|
11
|
-
Create a new rails 3 application
|
12
|
-
|
13
|
-
$ rails new my_app
|
14
|
-
|
15
|
-
Add blacklight to your gem file
|
16
|
-
|
17
|
-
/my_app/Gemfile
|
18
|
-
...
|
19
|
-
gem 'blackight'
|
20
|
-
|
21
|
-
Install blacklight
|
22
|
-
|
23
|
-
$ rails generate blacklight --devise
|
24
|
-
|
25
|
-
Run your database migrations
|
26
|
-
|
27
|
-
$ rake db:migrate
|
28
|
-
|
29
|
-
You will need a Solr setup, referred to in your config/solr.yml. You can install
|
30
|
-
an example jetty container with Solr, that has Solr configured to work with
|
31
|
-
Blacklight's defaults, like:
|
32
|
-
$ rails generate blacklight:jetty
|
33
|
-
|
34
|
-
You can also install your own Solr or use an existing install. But Blacklight
|
35
|
-
configuration needs to match your Solr setup, and there are certain things
|
36
|
-
in a Solr setup that Blacklight requires. To generate some Solr config files
|
37
|
-
that match what default Blacklight expects:
|
38
|
-
$ rails generate blacklight:solr_conf path/to/output/directory/
|
39
|
-
|
40
|
-
Start up your application
|
41
|
-
|
42
|
-
$ rails server
|
43
|
-
|
44
|
-
Visit the catalog at: http://localhost/catalog
|
45
|
-
|
46
|
-
|
47
|
-
== Install and Use (with a custom user authentication system)
|
48
|
-
|
49
|
-
Blacklight 3 requires Rails 3.0 or greater.
|
50
|
-
|
51
|
-
Add the blacklight gem to your ./Gemfile
|
52
|
-
|
53
|
-
gem 'blacklight'
|
54
|
-
|
55
|
-
$ bundle install
|
56
|
-
|
57
|
-
If you have a user model already, the Blacklight generator will connect to it automatically during installation. However, you will need to make sure the following named routes are included in your /config/routes.rb file:
|
58
|
-
|
59
|
-
match 'new_user_session', :to => 'Your User Session Controller # Log in action'
|
60
|
-
match 'destroy_user_session', :to => 'Your User Session Controller # Log Out action'
|
61
|
-
|
62
|
-
One blacklight view uses #to_s on your user model to get a user-displayable
|
63
|
-
account name/identifier for the currently logged in account, you probably
|
64
|
-
want to have such a method.
|
65
|
-
|
66
|
-
(TODO: Instructions on how to tell BL the name of your user model if it's
|
67
|
-
not User?)
|
68
|
-
|
69
|
-
And you will need to make sure the following methods are available both
|
70
|
-
on controllers and as helpers:
|
71
|
-
|
72
|
-
current_user - Which should return a user object that include Blacklight::User
|
73
|
-
user_session - Which should return a user session
|
74
|
-
|
75
|
-
Once these are in place, you can run the Blacklight Installation Generator:
|
76
|
-
|
77
|
-
rails generate blacklight
|
78
|
-
|
79
|
-
Execute your migrations, and you should be good to go.
|
80
|
-
|
81
|
-
rake db:migrate
|
82
|
-
|
83
|
-
Start up your application
|
84
|
-
|
85
|
-
$ rails server
|
86
|
-
|
87
|
-
Visit the catalog at: http://localhost/catalog
|
88
|
-
|
89
|
-
== Using Blacklight source checkout as gem for development
|
90
|
-
|
91
|
-
The ordinary install instructions install the BL gem (which is not
|
92
|
-
full source code) in wherever your system installs gems.
|
93
|
-
|
94
|
-
Sometimes, especially for development, it's useful to check out
|
95
|
-
a complete copy of the blacklight source code, and link your app
|
96
|
-
to that as a 'gem' instead.
|
97
|
-
|
98
|
-
Checkout the code:
|
99
|
-
|
100
|
-
$ git clone git@github.com:projectblacklight/blacklight.git
|
101
|
-
|
102
|
-
(While the rails3 branch is still a seperate branch called 'rails3',
|
103
|
-
if you'd like to checkout the rails3 branch, or any other particular
|
104
|
-
branch/tag using ordinary git commands:
|
105
|
-
$ cd blacklight
|
106
|
-
$ git checkout -t origin/rails3
|
107
|
-
)
|
108
|
-
|
109
|
-
Now, in your local app's Gemfile, simply specify that it should find
|
110
|
-
the Blacklight gem at this source checkout location:
|
111
|
-
|
112
|
-
gem 'blacklight', :path=>"./relative/path/to/blacklight_checkout"
|
113
|
-
|
114
|
-
You can have the blacklight source checkout anywhere you want, referred
|
115
|
-
to by absolute or relative path. You can have it inside your local app's
|
116
|
-
directory if you want, or you can have it outside using a relative path
|
117
|
-
beginning with "../". If you have it inside your app's root, you can
|
118
|
-
even use 'git submodule' techniques to link your app to a particular
|
119
|
-
git commit, like some of us did in Rails2 Blacklight. (But you probably
|
120
|
-
don't want it in your local apps ./vendor/plugins, that'll likely
|
121
|
-
confuse Rails, since it's already being referred to in your Gemfile).
|
122
|
-
|
123
|
-
== Running Blacklight's own tests
|
124
|
-
|
125
|
-
Any application that refers to a Blacklight gem using a source checkout
|
126
|
-
(see above) can run the automated tests (cucumber and rspec) that
|
127
|
-
come with Blacklight source.
|
128
|
-
|
129
|
-
Of course, if you've customized the app quite a bit, the tests may not
|
130
|
-
pass, as they test expected default behavior in some cases. So ordinarily
|
131
|
-
tests are run against a pretty basic stub app. The tests also
|
132
|
-
test authentication features, so expect the app to have auth features
|
133
|
-
installed, for instance with a Devise install.
|
134
|
-
|
135
|
-
To run the tests:
|
136
|
-
|
137
|
-
* Create a stub app with BL with devise, following the ordinary instructions for
|
138
|
-
installing blacklight, but linking to a source checkout of Blacklight
|
139
|
-
following the instructions above in "Using Blacklight source checkout
|
140
|
-
as gem for development"
|
141
|
-
* You also need to include some gems in your test app's Gemfile needed for
|
142
|
-
running our tests:
|
143
|
-
group :development, :test do
|
144
|
-
gem "rspec"
|
145
|
-
gem "rspec-rails", "~>2.5.0"
|
146
|
-
gem "cucumber-rails"
|
147
|
-
gem "database_cleaner"
|
148
|
-
gem "capybara"
|
149
|
-
gem "webrat"
|
150
|
-
gem "aruba"
|
151
|
-
end
|
152
|
-
* run `bundle install` in the test app, and don't forget `rake db:migrate`
|
153
|
-
* complete the install of cucumber: 'rails g cucumber:install'
|
154
|
-
* remove /public/index.html (blacklight tests expect / to map to catalog)
|
155
|
-
* You need to install a jetty/solr with test data for testing. You can do that
|
156
|
-
like this (from your stub app home directory):
|
157
|
-
rails generate blacklight:jetty test_jetty -e test
|
158
|
-
rake solr:marc:index_test_data RAILS_ENV=test
|
159
|
-
* Now use some rake tasks that come with Blacklight to actually run the tests.
|
160
|
-
Run these from your stub app:
|
161
|
-
* rake blacklight:cucumber:with_solr -- run tests in BL, start and stop the test jetty/solr around tests
|
162
|
-
* rake blacklight:cucumber -- run tests in BL, no jetty/solr. (Tests will fail unless you start it yourself)
|
163
|
-
* rake blacklight:spec:with_solr
|
164
|
-
* rake blacklight:spec
|
165
|
-
* the standard rails tasks for cucumber/rspec are all included with
|
166
|
-
blacklight: prefix, and should work as expected, but using
|
167
|
-
specs/features defined in BL plugin instead of in your local
|
168
|
-
app. (Not every variant has a :with_solr yet).
|
169
|
-
|
170
|
-
|
171
|
-
==Pre-requisites
|
172
|
-
Whichever method you choose for installation, be sure you have all the pre-requisites in place. You can find these detailed in {PRE-REQUISITES}[https://github.com/projectblacklight/blacklight/wiki/PRE-REQUISITES]
|
173
|
-
|
174
|
-
==Running solr
|
175
|
-
You'll also want some information about how Blacklight expects Apache SOLR ( http://lucene.apache.org/solr ) to run, which you can find in {README_SOLR}[https://github.com/projectblacklight/blacklight/wiki/README_SOLR]
|