blacklight 3.8.2 → 4.0.0.pre6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/README.md +1 -1
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight/blacklight.js +12 -1
- data/app/assets/javascripts/blacklight/bootstrap_dropdowns.js +3 -0
- data/app/assets/javascripts/blacklight/checkbox_submit.js +12 -5
- data/app/assets/javascripts/blacklight/core.js +0 -1
- data/app/assets/javascripts/blacklight/css_dropdowns.js +10 -0
- data/app/assets/javascripts/blacklight/facet_expand_contract.js +5 -5
- data/app/assets/javascripts/blacklight/lightbox_dialog.js +68 -13
- data/app/assets/javascripts/blacklight/select_submit.js +19 -10
- data/app/assets/javascripts/improved-modal/bootstrap-modal.js +282 -0
- data/app/assets/javascripts/improved-modal/bootstrap-modalmanager.js +353 -0
- data/app/assets/stylesheets/blacklight/_blacklight_base.css.scss +16 -5
- data/app/assets/stylesheets/blacklight/_bookmark.css.scss +24 -6
- data/app/assets/stylesheets/blacklight/_catalog.css.scss +115 -141
- data/app/assets/stylesheets/blacklight/_dropdown.css.scss +57 -0
- data/app/assets/stylesheets/blacklight/_facets.css.scss +127 -58
- data/app/assets/stylesheets/blacklight/_footer.css.scss +20 -0
- data/app/assets/stylesheets/blacklight/_header.css.scss +90 -21
- data/app/assets/stylesheets/blacklight/_layout.css.scss +10 -9
- data/app/assets/stylesheets/blacklight/_modal.css.scss +23 -0
- data/app/assets/stylesheets/blacklight/_print.css.scss +0 -7
- data/app/assets/stylesheets/blacklight/_responsive.css.scss +3 -0
- data/app/assets/stylesheets/blacklight/_search_history.css.scss +2 -4
- data/app/assets/stylesheets/blacklight/blacklight.css.scss +0 -1
- data/app/assets/stylesheets/blacklight/blacklight_defaults.css.scss +9 -2
- data/app/assets/stylesheets/blacklight/responsive_partials/_catalog.css.scss +5 -0
- data/app/assets/stylesheets/blacklight/responsive_partials/_facets.css.scss +37 -0
- data/app/assets/stylesheets/blacklight/responsive_partials/_header.css.scss +30 -0
- data/app/assets/stylesheets/improved-modal/bootstrap-modal.css +199 -0
- data/app/controllers/bookmarks_controller.rb +16 -10
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +124 -61
- data/app/helpers/blacklight/catalog_helper_behavior.rb +5 -3
- data/app/helpers/blacklight/facets_helper_behavior.rb +9 -9
- data/app/views/_flash_msg.html.erb +9 -4
- data/app/views/_user_util_links.html.erb +23 -17
- data/app/views/bookmarks/_tools.html.erb +7 -7
- data/app/views/bookmarks/index.html.erb +5 -13
- data/app/views/catalog/_bookmark_control.html.erb +2 -4
- data/app/views/catalog/_bookmark_form.html.erb +1 -1
- data/app/views/catalog/_citation.html.erb +21 -20
- data/app/views/catalog/_constraints.html.erb +8 -6
- data/app/views/catalog/_document_header.html.erb +6 -7
- data/app/views/catalog/_document_list.html.erb +1 -7
- data/app/views/catalog/_email_form.html.erb +42 -16
- data/app/views/catalog/_facet_layout.html.erb +1 -1
- data/app/views/catalog/_facet_limit.html.erb +1 -1
- data/app/views/catalog/_facet_pagination.html.erb +11 -14
- data/app/views/catalog/_facets.html.erb +16 -2
- data/app/views/catalog/_home.html.erb +2 -2
- data/app/views/catalog/_home_text.html.erb +5 -2
- data/app/views/catalog/_index_default.html.erb +2 -2
- data/app/views/catalog/_marc_view.html.erb +0 -1
- data/app/views/catalog/_paginate_compact.html.erb +5 -0
- data/app/views/catalog/_per_page_widget.html.erb +13 -7
- data/app/views/catalog/_previous_next_doc.html.erb +14 -4
- data/app/views/catalog/_refworks_form.html.erb +2 -2
- data/app/views/catalog/_results_pagination.html.erb +4 -1
- data/app/views/catalog/_search_form.html.erb +19 -13
- data/app/views/catalog/_show_default.html.erb +2 -2
- data/app/views/catalog/_show_more_like_this.html.erb +3 -0
- data/app/views/catalog/_show_sidebar.html.erb +14 -1
- data/app/views/catalog/_show_tools.html.erb +18 -18
- data/app/views/catalog/_sms_form.html.erb +35 -10
- data/app/views/catalog/_sort_and_per_page.html.erb +5 -3
- data/app/views/catalog/_sort_widget.html.erb +12 -6
- data/app/views/catalog/citation.html.erb +1 -1
- data/app/views/catalog/citation.js.erb +7 -0
- data/app/views/catalog/email.html.erb +5 -0
- data/app/views/catalog/facet.html.erb +28 -21
- data/app/views/catalog/index.html.erb +26 -26
- data/app/views/catalog/librarian_view.html.erb +7 -0
- data/app/views/catalog/show.html.erb +35 -29
- data/app/views/catalog/sms.html.erb +5 -0
- data/app/views/kaminari/blacklight/_first_page.html.erb +2 -2
- data/app/views/kaminari/blacklight/_gap.html.erb +4 -1
- data/app/views/kaminari/blacklight/_last_page.html.erb +2 -2
- data/app/views/kaminari/blacklight/_next_page.html.erb +3 -3
- data/app/views/kaminari/blacklight/_page.html.erb +4 -3
- data/app/views/kaminari/blacklight/_paginator.html.erb +5 -5
- data/app/views/kaminari/blacklight/_prev_page.html.erb +3 -3
- data/app/views/kaminari/blacklight_compact/_next_page.html.erb +9 -0
- data/app/views/kaminari/blacklight_compact/_paginator.html.erb +15 -0
- data/app/views/kaminari/blacklight_compact/_prev_page.html.erb +9 -0
- data/app/views/layouts/blacklight.html.erb +47 -27
- data/app/views/saved_searches/index.html.erb +2 -2
- data/app/views/search_history/index.html.erb +12 -7
- data/app/views/shared/_footer.html.erb +0 -0
- data/app/views/shared/_header_navbar.html.erb +25 -0
- data/blacklight.gemspec +2 -5
- data/config/locales/blacklight.en.yml +23 -15
- data/lib/blacklight.rb +2 -2
- data/lib/blacklight/catalog.rb +36 -14
- data/lib/blacklight/configuration.rb +10 -2
- data/lib/blacklight/mash.rb +151 -0
- data/lib/blacklight/solr/document.rb +73 -11
- data/lib/blacklight/solr/document/extensions.rb +0 -8
- data/lib/blacklight/solr/document/marc_export.rb +7 -2
- data/lib/blacklight/solr/document/more_like_this.rb +5 -0
- data/lib/blacklight/solr_helper.rb +43 -18
- data/lib/blacklight/solr_response.rb +60 -0
- data/lib/blacklight/solr_response/facets.rb +58 -0
- data/lib/blacklight/solr_response/more_like_this.rb +14 -0
- data/lib/blacklight/solr_response/spelling.rb +92 -0
- data/lib/generators/blacklight/assets_generator.rb +1 -14
- data/lib/generators/blacklight/blacklight_generator.rb +22 -21
- data/lib/generators/blacklight/jetty_generator.rb +1 -35
- data/{test_support → lib/generators/blacklight/templates}/alternate_controller.rb +0 -0
- data/lib/generators/blacklight/templates/blacklight.css.scss +4 -0
- data/lib/generators/blacklight/templates/config/SolrMarc/config-test.properties +2 -2
- data/lib/generators/blacklight/templates/config/jetty.yml +6 -0
- data/lib/generators/blacklight/test_support_generator.rb +35 -0
- data/lib/railties/all_tests.rake +5 -23
- data/lib/railties/blacklight_cucumber.rake +2 -11
- data/lib/railties/blacklight_rspec.rake +2 -12
- data/test_support/bin/run-tests.sh +1 -1
- data/test_support/bin/setup-test-app.sh +123 -0
- data/test_support/bin/test.sh +21 -21
- data/test_support/features/bookmarks.feature +9 -3
- data/test_support/features/saved_searches.feature +3 -3
- data/test_support/features/search.feature +3 -3
- data/test_support/features/search_filters.feature +24 -26
- data/test_support/features/search_history.feature +9 -10
- data/test_support/features/search_sort.feature +4 -6
- data/test_support/features/step_definitions/general_steps.rb +0 -4
- data/test_support/features/step_definitions/search_result_steps.rb +2 -1
- data/test_support/features/step_definitions/search_steps.rb +32 -2
- data/test_support/spec/controllers/application_controller_spec.rb +8 -0
- data/test_support/spec/controllers/catalog_controller_spec.rb +3 -18
- data/test_support/spec/helpers/blacklight_helper_spec.rb +116 -20
- data/test_support/spec/helpers/catalog_helper_spec.rb +14 -6
- data/test_support/spec/helpers/facets_helper_spec.rb +1 -1
- data/test_support/spec/lib/blacklight_solr_document_more_like_this_spec.rb +18 -0
- data/test_support/spec/lib/blacklight_solr_document_spec.rb +54 -1
- data/test_support/spec/lib/blacklight_solr_response_spec.rb +153 -0
- data/test_support/spec/lib/facet_paginator_spec.rb +1 -1
- data/test_support/spec/lib/marc_export_spec.rb +14 -6
- data/test_support/spec/lib/solr_helper_spec.rb +22 -6
- data/test_support/spec/models/solr_docment_spec.rb +1 -4
- data/test_support/spec/{features → requests}/alternate_controller_spec.rb +3 -2
- data/test_support/spec/views/catalog/_facets.html.erb_spec.rb +20 -4
- data/test_support/spec/views/catalog/_show_sidebar.erb_spec.rb +25 -0
- metadata +53 -131
- data/app/assets/javascripts/blacklight/more_facets.js +0 -16
- data/app/assets/javascripts/jquery-1.4.2.min.js +0 -154
- data/app/assets/javascripts/jquery-ui-1.8.1.custom.min.js +0 -756
- data/app/assets/javascripts/jquery.uiExt.ajaxyDialog.js +0 -180
- data/app/assets/stylesheets/blacklight/_formatting.css.scss +0 -164
- data/app/assets/stylesheets/blacklight/grids/_susy_grid.css.scss +0 -72
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-anim_basic_16x16.gif +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_gloss-wave_35_558fd0_500x100.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_2e4f81_256x240.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/stylesheets/jquery/ui-lightness/jquery-ui-1.8.1.custom.css +0 -486
- data/app/models/solr_document.rb +0 -5
- data/app/views/catalog/email.erb +0 -1
- data/app/views/catalog/sms.erb +0 -1
- data/doc/Atom-Responses.md +0 -90
- data/doc/Blacklight-3.2-Release-Notes-and-Upgrade-Guide.md +0 -191
- data/doc/Blacklight-3.3-release-notes-and-upgrade-guide.md +0 -37
- data/doc/Blacklight-3.4-release-notes-and-upgrade-guide.md +0 -27
- data/doc/Blacklight-3.5-release-notes-and-upgrade-guide.md +0 -44
- data/doc/Blacklight-3.6-release-notes-and-upgrade-guide.md +0 -25
- data/doc/Blacklight-3.7-release-notes-and-upgrade-guide.md +0 -78
- data/doc/Blacklight-3.8-release-notes-and-upgrade-guide.md +0 -11
- data/doc/Blacklight-Add-ons.md +0 -28
- data/doc/Blacklight-configuration.md +0 -301
- data/doc/Blacklight-on-Heroku.md +0 -135
- data/doc/Community-principles.md +0 -44
- data/doc/Configuring-and-Customizing-Blacklight.md +0 -271
- data/doc/Contributing-to-Blacklight.md +0 -25
- data/doc/Examples.md +0 -62
- data/doc/Extending-or-Modifying-Blacklight-Search-Behavior.md +0 -141
- data/doc/Home.md +0 -77
- data/doc/How-to-release-a-version.md +0 -37
- data/doc/Indexing-your-data-into-solr.md +0 -5
- data/doc/Integration-with-Rails-Footnotes.md +0 -20
- data/doc/Pagination.md +0 -38
- data/doc/Providing-your-own-view-templates.md +0 -109
- data/doc/Quickstart.md +0 -116
- data/doc/README.md +0 -77
- data/doc/README_SOLR.md +0 -245
- data/doc/Release-Notes-And-Upgrade-Guides.md +0 -14
- data/doc/Sunspot-for-indexing.md +0 -46
- data/doc/User-Authentication.md +0 -60
- data/doc/testing.md +0 -115
- data/lib/generators/blacklight/solr_conf_generator.rb +0 -26
- data/lib/generators/blacklight/templates/assets/standard.css.scss +0 -59
- data/lib/generators/blacklight/templates/config/blacklight_config.rb +0 -3
- data/lib/generators/blacklight/templates/config/compass.rb +0 -2
- data/lib/generators/blacklight/templates/solr_conf/schema.xml +0 -689
- data/lib/generators/blacklight/templates/solr_conf/solrconfig.xml +0 -1846
- data/lib/solrmarc.log.1 +0 -849
- data/test_support/spec/controllers/bookmarks_controller_spec.rb +0 -48
@@ -64,41 +64,7 @@ Requires system('unzip... ') to work, probably won't work on Windows.
|
|
64
64
|
remove_dir(tmp_save_dir)
|
65
65
|
end
|
66
66
|
end
|
67
|
-
|
68
|
-
# the only thing that's REALLY BL-specific is these conf files
|
69
|
-
# installed by another generator. We write em on top of the solr we
|
70
|
-
# just installed. We "force" it because we're usually writing on top of files
|
71
|
-
# we just installed anyway. The user should have said 'no' to overwriting
|
72
|
-
# their dir if they already had one!
|
73
|
-
#
|
74
|
-
# If we later install Solr from somewhere other than BL jetty repo, we'd
|
75
|
-
# still want to write these on top, just like this.
|
76
|
-
def install_conf_files
|
77
|
-
generate("blacklight:solr_conf", "#{File.join(save_location, 'solr', 'conf')} --force")
|
78
|
-
end
|
79
|
-
|
80
|
-
# adds a jetty_path key to solr.yml for the current environment, so
|
81
|
-
# rake tasks for automatically starting jetty/solr (as well as
|
82
|
-
# for indexing with solrmarc) can find it.
|
83
|
-
def add_jetty_path_to_solr_yml
|
84
|
-
# inject_into_file no-ops silently if the :after isn't found, we
|
85
|
-
# want to be noisy.
|
86
|
-
config_file = "config/solr.yml"
|
87
|
-
config_file_full_path = File.expand_path(config_file, destination_root)
|
88
|
-
after_hook = /#{Regexp.escape(options[:environment])}\:[^\n]*\n/
|
89
|
-
|
90
|
-
if !(File.exists?(config_file_full_path) && File.binread( config_file_full_path ) =~ after_hook)
|
91
|
-
say_status("skipped", "Could not find '#{options[:environment]}' block in #{config_file} to add jetty_path to.", :red)
|
92
|
-
elsif File.binread( config_file_full_path ) =~ /#{Regexp.escape(options[:environment])}\:[^\n]*\n.*(?!\n\n).*jetty_path\:/
|
93
|
-
say_status("skipped", "#{config_file} '#{options[:environment]}' block already has jetty_path, not overwriting.", :red)
|
94
|
-
else
|
95
|
-
inject_into_file config_file, :verbose => false, :after => after_hook do
|
96
|
-
" jetty_path: '#{save_location}'\n"
|
97
|
-
end
|
98
|
-
say_status("insert", "#{config_file}: jetty_path key for '#{options[:environment]}' block")
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
67
|
+
|
102
68
|
|
103
69
|
end
|
104
70
|
end
|
File without changes
|
@@ -11,9 +11,9 @@
|
|
11
11
|
# Solr that you want to use, or to a directory of jar files extracted from a
|
12
12
|
# Solr war files. If this is not provided, SolrMarc can only work by
|
13
13
|
# communicating with a running Solr server.
|
14
|
-
solrmarc.solr.war.path=../jetty/webapps/solr.war
|
14
|
+
#solrmarc.solr.war.path=../jetty/webapps/solr.war
|
15
15
|
# Path to your solr instance
|
16
|
-
solr.path = ../jetty/solr
|
16
|
+
#solr.path = ../jetty/solr
|
17
17
|
|
18
18
|
# Relative paths for solr.indexer can be relative to the location of
|
19
19
|
# this config.properties file.
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
# Copy Blacklight test support material in place
|
3
|
+
|
4
|
+
|
5
|
+
# Need the requires here so we can call the generator from environment.rb
|
6
|
+
# as suggested above.
|
7
|
+
require 'rails/generators'
|
8
|
+
require 'rails/generators/base'
|
9
|
+
module Blacklight
|
10
|
+
class TestSupport < Rails::Generators::Base
|
11
|
+
source_root File.expand_path('../templates', __FILE__)
|
12
|
+
desc """
|
13
|
+
Installs a jetty container with a solr installed in it. A solr setup known
|
14
|
+
good with default blacklight setup, including solr conf files for out
|
15
|
+
of the box blacklight.
|
16
|
+
|
17
|
+
Also adds jetty_path key to solr.yml for selected environment, to refer
|
18
|
+
to this install.
|
19
|
+
|
20
|
+
Requires system('unzip... ') to work, probably won't work on Windows.
|
21
|
+
|
22
|
+
"""
|
23
|
+
def alternate_controller
|
24
|
+
copy_file "alternate_controller.rb", "app/controllers/alternate_controller.rb"
|
25
|
+
|
26
|
+
route("resources :alternate do
|
27
|
+
member do
|
28
|
+
get :facet
|
29
|
+
end
|
30
|
+
end")
|
31
|
+
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/railties/all_tests.rake
CHANGED
@@ -9,21 +9,12 @@ namespace :blacklight do
|
|
9
9
|
|
10
10
|
desc "Run Blacklight cucumber and rspec, with test solr"
|
11
11
|
task :hudson do
|
12
|
-
|
13
|
-
if solr_config
|
14
|
-
jetty_path = solr_config["jetty_path"]
|
15
|
-
uri = URI(solr_config["url"])
|
16
|
-
jetty_port = uri.port if ['127.0.0.1', 'localhost'].include? uri.host
|
17
|
-
end
|
18
|
-
raise Exception.new("Can't find jetty path to start test jetty. Expect a jetty_path key in config/solr.yml for test environment.") unless jetty_path
|
12
|
+
Rails.env = 'test' unless ENV['RAILS_ENV']
|
19
13
|
|
20
|
-
error = Jettywrapper.wrap(
|
21
|
-
:jetty_port => jetty_port,
|
22
|
-
:jetty_home => File.expand_path(jetty_path, Rails.root),
|
23
|
-
:sleep_after_start => 2) do
|
14
|
+
error = Jettywrapper.wrap(Jettywrapper.load_config) do
|
24
15
|
Rake::Task["blacklight:spec"].invoke
|
25
16
|
Rake::Task["blacklight:cucumber"].invoke
|
26
|
-
end
|
17
|
+
end
|
27
18
|
|
28
19
|
raise "test failures: #{error}" if error
|
29
20
|
end
|
@@ -31,19 +22,10 @@ namespace :blacklight do
|
|
31
22
|
namespace :all_tests do
|
32
23
|
task :rcov do
|
33
24
|
desc "Run Blacklight rspec and cucumber tests with rcov"
|
34
|
-
solr_config = Blacklight.solr_yml["test"]
|
35
|
-
if solr_config
|
36
|
-
jetty_path = solr_config["jetty_path"]
|
37
|
-
uri = URI(solr_config["url"])
|
38
|
-
jetty_port = uri.port if ['127.0.0.1', 'localhost'].include? uri.host
|
39
|
-
end
|
40
|
-
raise Exception.new("Can't find jetty path to start test jetty. Expect a jetty_path key in config/solr.yml for test environment.") unless jetty_path
|
41
25
|
|
42
26
|
rm "blacklight-coverage.data" if File.exist?("blacklight-coverage.data")
|
43
|
-
|
44
|
-
|
45
|
-
:jetty_home => File.expand_path(jetty_path, Rails.root),
|
46
|
-
:sleep_after_start => 2) do
|
27
|
+
Rails.env = 'test' unless ENV['RAILS_ENV']
|
28
|
+
error = Jettywrapper.wrap(Jettywrapper.load_config) do
|
47
29
|
Rake::Task["blacklight:spec:rcov"].invoke
|
48
30
|
Rake::Task["blacklight:cucumber:rcov"].invoke
|
49
31
|
end
|
@@ -90,18 +90,9 @@ begin
|
|
90
90
|
desc "blacklight:cucumber with jetty/solr launch"
|
91
91
|
task :with_solr do
|
92
92
|
require 'jettywrapper'
|
93
|
-
solr_config = Blacklight.solr_yml["test"]
|
94
|
-
if solr_config
|
95
|
-
jetty_path = solr_config["jetty_path"]
|
96
|
-
uri = URI(solr_config["url"])
|
97
|
-
jetty_port = uri.port if ['127.0.0.1', 'localhost'].include? uri.host
|
98
|
-
end
|
99
|
-
raise Exception.new("Can't find jetty path to start test jetty. Expect a jetty_path key in config/solr.yml for test environment.") unless jetty_path
|
100
93
|
|
101
|
-
|
102
|
-
|
103
|
-
:jetty_home => File.expand_path(jetty_path, Rails.root),
|
104
|
-
:sleep_after_start => 2) do
|
94
|
+
Rails.env = 'test' unless ENV['RAILS_ENV']
|
95
|
+
error = Jettywrapper.wrap(Jettywrapper.load_config) do
|
105
96
|
Rake::Task["blacklight:cucumber"].invoke
|
106
97
|
end
|
107
98
|
|
@@ -86,18 +86,8 @@ begin
|
|
86
86
|
# Need to look up where the test jetty is located
|
87
87
|
# from solr.yml, we don't hardcode it anymore.
|
88
88
|
|
89
|
-
|
90
|
-
|
91
|
-
jetty_path = solr_config["jetty_path"]
|
92
|
-
uri = URI(solr_config["url"])
|
93
|
-
jetty_port = uri.port if ['127.0.0.1', 'localhost'].include? uri.host
|
94
|
-
end
|
95
|
-
raise Exception.new("Can't find jetty path to start test jetty. Expect a jetty_path key in config/solr.yml for test environment.") unless jetty_path
|
96
|
-
|
97
|
-
error = Jettywrapper.wrap(
|
98
|
-
:jetty_port => jetty_port,
|
99
|
-
:jetty_home => File.expand_path(jetty_path, Rails.root),
|
100
|
-
:sleep_after_start => 2) do
|
89
|
+
Rails.env = 'test' unless ENV['RAILS_ENV']
|
90
|
+
error = Jettywrapper.wrap(Jettywrapper.load_config) do
|
101
91
|
Rake::Task["blacklight:spec"].invoke
|
102
92
|
end
|
103
93
|
raise "test failures: #{error}" if error
|
@@ -0,0 +1,123 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
# test.sh
|
3
|
+
# Create a default rails appliaction, install blacklight, and run all the tests.
|
4
|
+
|
5
|
+
#If null or empty, use default value
|
6
|
+
RAILS_VERSION=${RAILS_VERSION:-"~> 3.2"}
|
7
|
+
JETTY_URL=${JETTY_URL:-"https://github.com/projectblacklight/blacklight-jetty/zipball/v3.5.0"}
|
8
|
+
|
9
|
+
before="$(date +%s)"
|
10
|
+
benchmark()
|
11
|
+
{
|
12
|
+
after="$(date +%s)"
|
13
|
+
elapsed_seconds="$(expr $after - $before)"
|
14
|
+
echo "Total Time: ${elapsed_seconds} sec"
|
15
|
+
# as a bonus, make our script exit with the right error code.
|
16
|
+
}
|
17
|
+
|
18
|
+
check_errs()
|
19
|
+
{
|
20
|
+
# Function. Parameter 1 is the return code
|
21
|
+
# Para. 2 is text to display on failure.
|
22
|
+
if [ "${1}" -ne "0" ]; then
|
23
|
+
echo "ERROR # ${1} : ${2}"
|
24
|
+
benchmark
|
25
|
+
exit 1
|
26
|
+
fi
|
27
|
+
}
|
28
|
+
|
29
|
+
# Make sure we are in the blacklight directory
|
30
|
+
if [ ! -f "blacklight.gemspec" ]
|
31
|
+
then
|
32
|
+
echo "You must execute test.sh from the root of your blacklight checkout."
|
33
|
+
exit 1
|
34
|
+
fi
|
35
|
+
|
36
|
+
# Clear out the tmp/ directory.
|
37
|
+
rm -rf tmp/test_app
|
38
|
+
mkdir -p tmp/test_app
|
39
|
+
cd tmp
|
40
|
+
|
41
|
+
|
42
|
+
if [[ $# -gt 0 ]]
|
43
|
+
then
|
44
|
+
# Make certain rvm will work correctly.
|
45
|
+
# Load RVM into a shell session *as a function*
|
46
|
+
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
|
47
|
+
# First try to load from a user install
|
48
|
+
source "$HOME/.rvm/scripts/rvm"
|
49
|
+
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
|
50
|
+
# Then try to load from a root install
|
51
|
+
source "/usr/local/rvm/scripts/rvm"
|
52
|
+
else
|
53
|
+
echo "WARNING: An RVM installation was not found.\n"
|
54
|
+
exit 1
|
55
|
+
fi
|
56
|
+
|
57
|
+
rvm use "$@" --create
|
58
|
+
check_errs $? "rvm failed. please run 'rvm install $@', and then re-run these tests."
|
59
|
+
fi
|
60
|
+
|
61
|
+
if ! gem query -n rails -v "$RAILS_VERSION" --installed > /dev/null; then
|
62
|
+
gem install --no-rdoc --no-ri 'rails' -v "$RAILS_VERSION"
|
63
|
+
fi
|
64
|
+
|
65
|
+
if ! gem query -n bundler -v ">=1.0" --installed > /dev/null; then
|
66
|
+
gem install --no-rdoc --no-ri 'bundler'
|
67
|
+
fi
|
68
|
+
|
69
|
+
rails "_${RAILS_VERSION}_" new test_app
|
70
|
+
|
71
|
+
cd test_app
|
72
|
+
rm public/index.html
|
73
|
+
|
74
|
+
echo "
|
75
|
+
platforms :jruby do
|
76
|
+
gem 'jruby-openssl'
|
77
|
+
gem 'activerecord-jdbcsqlite3-adapter'
|
78
|
+
gem 'jdbc-sqlite3'
|
79
|
+
gem 'mediashelf-loggable', '>= 0.4.8'
|
80
|
+
gem 'therubyrhino'
|
81
|
+
end
|
82
|
+
|
83
|
+
platforms :ruby do
|
84
|
+
gem 'sqlite3'
|
85
|
+
gem 'execjs'
|
86
|
+
gem 'therubyracer'
|
87
|
+
end
|
88
|
+
|
89
|
+
gem 'blacklight', :path => '../../'
|
90
|
+
gem 'jquery-rails'
|
91
|
+
|
92
|
+
group :assets do
|
93
|
+
gem 'compass-rails', '~> 1.0.0'
|
94
|
+
gem 'compass-susy-plugin', '~> 0.9.0'
|
95
|
+
end
|
96
|
+
|
97
|
+
|
98
|
+
# For testing
|
99
|
+
group :development, :test do
|
100
|
+
gem 'rspec'
|
101
|
+
gem 'rspec-rails'
|
102
|
+
gem 'generator_spec'
|
103
|
+
gem 'cucumber-rails'
|
104
|
+
gem 'database_cleaner'
|
105
|
+
gem 'capybara'
|
106
|
+
gem 'rcov', :platform => :mri_18
|
107
|
+
gem 'simplecov', :platform => :mri_19
|
108
|
+
gem 'simplecov-rcov', :platform => :mri_19
|
109
|
+
end
|
110
|
+
|
111
|
+
gem 'jettywrapper', '>= 1.2.0'
|
112
|
+
" >> Gemfile
|
113
|
+
|
114
|
+
bundle install
|
115
|
+
check_errs $? "Bundle install failed."
|
116
|
+
|
117
|
+
rails generate blacklight -d
|
118
|
+
check_errs $? "Blacklight generator failed"
|
119
|
+
|
120
|
+
bundle exec rake db:migrate
|
121
|
+
check_errs $? "Rake Migration failed"
|
122
|
+
|
123
|
+
benchmark
|
data/test_support/bin/test.sh
CHANGED
@@ -4,10 +4,10 @@
|
|
4
4
|
|
5
5
|
#If null or empty, use default value
|
6
6
|
RAILS_VERSION=${RAILS_VERSION:-"~> 3.2"}
|
7
|
-
JETTY_URL=${JETTY_URL:-"https://github.com/projectblacklight/blacklight-jetty/zipball/
|
7
|
+
JETTY_URL=${JETTY_URL:-"https://github.com/projectblacklight/blacklight-jetty/zipball/v4.0.0"}
|
8
8
|
|
9
9
|
before="$(date +%s)"
|
10
|
-
benchmark()
|
10
|
+
benchmark()
|
11
11
|
{
|
12
12
|
after="$(date +%s)"
|
13
13
|
elapsed_seconds="$(expr $after - $before)"
|
@@ -55,7 +55,7 @@ else
|
|
55
55
|
fi
|
56
56
|
|
57
57
|
rvm use "$@" --create
|
58
|
-
check_errs $? "rvm failed. please run 'rvm install $@', and then re-run these tests."
|
58
|
+
check_errs $? "rvm failed. please run 'rvm install $@', and then re-run these tests."
|
59
59
|
fi
|
60
60
|
|
61
61
|
if ! gem query -n rails -v "$RAILS_VERSION" --installed > /dev/null; then
|
@@ -66,7 +66,7 @@ if ! gem query -n bundler -v ">=1.0" --installed > /dev/null; then
|
|
66
66
|
gem install --no-rdoc --no-ri 'bundler'
|
67
67
|
fi
|
68
68
|
|
69
|
-
rails
|
69
|
+
rails new test_app
|
70
70
|
|
71
71
|
cd test_app
|
72
72
|
rm public/index.html
|
@@ -96,13 +96,17 @@ end
|
|
96
96
|
|
97
97
|
|
98
98
|
# For testing
|
99
|
-
group :development, :test do
|
99
|
+
group :development, :test do
|
100
100
|
gem 'rspec'
|
101
101
|
gem 'rspec-rails'
|
102
102
|
gem 'generator_spec'
|
103
103
|
gem 'cucumber-rails'
|
104
104
|
gem 'database_cleaner'
|
105
|
-
|
105
|
+
if defined? :JRUBY_VERSION
|
106
|
+
gem 'capybara', '~> 1.0'
|
107
|
+
else
|
108
|
+
gem 'capybara'
|
109
|
+
end
|
106
110
|
gem 'rcov', :platform => :mri_18
|
107
111
|
gem 'simplecov', :platform => :mri_19
|
108
112
|
gem 'simplecov-rcov', :platform => :mri_19
|
@@ -114,24 +118,17 @@ gem 'jettywrapper', '>= 1.2.0'
|
|
114
118
|
export BUNDLE_GEMFILE=`pwd`/Gemfile
|
115
119
|
|
116
120
|
bundle install
|
117
|
-
check_errs $? "Bundle install failed."
|
121
|
+
check_errs $? "Bundle install failed."
|
118
122
|
|
119
123
|
rails generate blacklight -d
|
120
|
-
check_errs $? "Blacklight generator failed"
|
124
|
+
check_errs $? "Blacklight generator failed"
|
121
125
|
|
122
|
-
bundle exec rake db:migrate
|
123
|
-
check_errs $? "Rake Migration failed"
|
126
|
+
bundle exec rake db:migrate RAILS_ENV=test
|
127
|
+
check_errs $? "Rake Migration failed"
|
124
128
|
|
125
|
-
rails g cucumber:install &> /dev/null
|
129
|
+
rails g cucumber:install &> /dev/null
|
126
130
|
|
127
|
-
|
128
|
-
# add routing for the alternate_controller:
|
129
|
-
# resources :alternate do
|
130
|
-
# member do
|
131
|
-
# get :facet
|
132
|
-
# end
|
133
|
-
# end
|
134
|
-
ruby -pi.bak -e 'gsub(/devise_for :users/, "devise_for :users\n resources :alternate do\n member do\n get :facet\n end\n end")' config/routes.rb
|
131
|
+
rails g blacklight:test_support
|
135
132
|
|
136
133
|
jetty_zip=$( JETTY_URL=$JETTY_URL ruby -e 'puts "/tmp/blacklight_jetty_#{ENV["JETTY_URL"].split("/").last}"')
|
137
134
|
if [ ! -f $jetty_zip ]
|
@@ -143,9 +140,12 @@ fi
|
|
143
140
|
rails g blacklight:jetty test_jetty -e test -d $jetty_zip
|
144
141
|
check_errs $? "Jetty setup failed."
|
145
142
|
|
143
|
+
rake jetty:start RAILS_ENV=test
|
146
144
|
bundle exec rake solr:marc:index_test_data RAILS_ENV=test
|
145
|
+
rake jetty:stop RAILS_ENV=test
|
146
|
+
sleep 2
|
147
147
|
|
148
|
-
bundle exec rake blacklight:hudson
|
149
|
-
check_errs $? "Tests failed."
|
148
|
+
bundle exec rake blacklight:hudson RAILS_ENV=test
|
149
|
+
check_errs $? "Tests failed."
|
150
150
|
|
151
151
|
benchmark
|
@@ -7,8 +7,8 @@ Feature: Bookmarks
|
|
7
7
|
Scenario: Bookmarks Menu Link
|
8
8
|
Given I am logged in as "user1"
|
9
9
|
When I am on the home page
|
10
|
-
Then I should see "
|
11
|
-
When I follow "
|
10
|
+
Then I should see "Bookmarks"
|
11
|
+
When I follow "Bookmarks"
|
12
12
|
Then I should be on the bookmarks page
|
13
13
|
And I should see a stylesheet
|
14
14
|
|
@@ -59,4 +59,10 @@ Feature: Bookmarks
|
|
59
59
|
And I am logged in as "user1"
|
60
60
|
When I go to the bookmarks page
|
61
61
|
Then I should see a "Remove bookmark" button
|
62
|
-
|
62
|
+
|
63
|
+
Scenario: Citing items in bookmarks
|
64
|
+
Given I am on the document page for id 2007020969
|
65
|
+
And I press "Bookmark"
|
66
|
+
When I go to the bookmarks page
|
67
|
+
And I follow "Cite"
|
68
|
+
Then I should see "Strong Medicine speaks"
|