blacklight_cql 1.2.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/VERSION +1 -1
  2. data/app/views/blacklight_cql/{explain/explain.xml.builder → explain.xml.builder} +3 -5
  3. data/lib/blacklight_cql/engine.rb +2 -11
  4. data/lib/blacklight_cql/explain_behavior.rb +14 -0
  5. data/spec/internal/Gemfile +50 -0
  6. data/spec/internal/Gemfile.lock +157 -0
  7. data/spec/internal/README.rdoc +28 -0
  8. data/spec/internal/Rakefile +6 -0
  9. data/spec/internal/app/assets/javascripts/application.js +16 -0
  10. data/spec/internal/app/assets/stylesheets/application.css +13 -0
  11. data/spec/internal/app/controllers/application_controller.rb +3 -2
  12. data/spec/internal/app/helpers/application_helper.rb +2 -0
  13. data/spec/internal/app/views/layouts/application.html.erb +14 -0
  14. data/spec/internal/bin/bundle +3 -0
  15. data/spec/internal/bin/rails +4 -0
  16. data/spec/internal/bin/rake +4 -0
  17. data/spec/internal/config.ru +4 -0
  18. data/spec/internal/config/application.rb +23 -0
  19. data/spec/internal/config/boot.rb +4 -0
  20. data/spec/internal/config/database.yml +24 -2
  21. data/spec/internal/config/environment.rb +5 -0
  22. data/spec/internal/config/environments/development.rb +29 -0
  23. data/spec/internal/config/environments/production.rb +80 -0
  24. data/spec/internal/config/environments/test.rb +36 -0
  25. data/spec/internal/config/initializers/backtrace_silencers.rb +7 -0
  26. data/spec/internal/config/initializers/filter_parameter_logging.rb +4 -0
  27. data/spec/internal/config/initializers/inflections.rb +16 -0
  28. data/spec/internal/config/initializers/mime_types.rb +5 -0
  29. data/spec/internal/config/initializers/secret_token.rb +12 -0
  30. data/spec/internal/config/initializers/session_store.rb +3 -0
  31. data/spec/internal/config/initializers/wrap_parameters.rb +14 -0
  32. data/spec/internal/config/locales/en.yml +23 -0
  33. data/spec/internal/config/routes.rb +53 -3
  34. data/spec/internal/db/{combustion_test.sqlite → development.sqlite3} +0 -0
  35. data/spec/internal/db/schema.rb +2 -39
  36. data/spec/internal/db/seeds.rb +7 -0
  37. data/spec/internal/db/test.sqlite3 +0 -0
  38. data/spec/internal/lib/generators/test_app_generator.rb +8 -0
  39. data/spec/internal/log/development.log +7 -0
  40. data/spec/internal/log/test.log +2 -0
  41. data/spec/internal/public/404.html +58 -0
  42. data/spec/internal/public/422.html +58 -0
  43. data/spec/internal/public/500.html +57 -0
  44. data/spec/internal/public/robots.txt +5 -0
  45. data/spec/internal/test/test_helper.rb +15 -0
  46. data/spec/spec_helper.rb +7 -11
  47. data/spec/test_app_templates/Gemfile.extra +1 -0
  48. data/spec/test_app_templates/lib/generators/test_app_generator.rb +8 -0
  49. data/spec/views/explain.xml.builder_spec.rb +8 -8
  50. metadata +102 -15
  51. data/app/controllers/blacklight_cql/explain_controller.rb +0 -17
  52. data/lib/blacklight_cql/route_sets.rb +0 -19
  53. data/spec/internal/app/models/solr_document.rb +0 -3
  54. data/spec/internal/config/solr.yml +0 -18
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.1
1
+ 2.0.0
@@ -5,20 +5,18 @@ xml.explain("xmlns" => "http://explain.z3950.org/dtd/2.0/") do
5
5
  xml.serverInfo("protocol" => "http-cql") do
6
6
  xml.host request.host
7
7
  xml.port request.port
8
- xml.database url_for(:controller => "/catalog", :action => "index", :search_field => BlacklightCql::SolrHelperExtension.pseudo_search_field[:key])
8
+ xml.database url_for(:action => "index", :search_field => BlacklightCql::SolrHelperExtension.pseudo_search_field[:key], :only_path => false)
9
9
  end
10
10
 
11
11
  xml.indexInfo do
12
12
  xml.set(:name => CqlRuby.to_solr_defaults[:solr_field_prefix],
13
13
  :identifier =>
14
- url_for(:controller => "/catalog",
15
- :action => "index",
14
+ url_for(:action => "index",
16
15
  :anchor => "local_solr_field",
17
16
  :only_path => false))
18
17
  xml.set(:name => CqlRuby.to_solr_defaults[:blacklight_field_prefix],
19
18
  :identifier =>
20
- url_for(:controller => "/catalog",
21
- :action => "index",
19
+ url_for(:action => "index",
22
20
  :anchor => "local_app_field",
23
21
  :only_path => false))
24
22
  #context set for our solr.dismax relation
@@ -6,6 +6,7 @@ require 'blacklight_cql'
6
6
 
7
7
  require 'blacklight_cql/solr_helper_extension'
8
8
  require 'blacklight_cql/template_helper_extension'
9
+ require 'blacklight_cql/explain_behavior'
9
10
 
10
11
 
11
12
  module BlacklightCql
@@ -22,17 +23,7 @@ module BlacklightCql
22
23
  end
23
24
  end
24
25
 
25
-
26
-
27
- require 'blacklight_cql/route_sets'
28
- initializer "blacklight.cql.routes" do
29
- if defined? Blacklight::Routes
30
- Blacklight::Routes.send(:include, BlacklightCql::RouteSets)
31
- end
32
- end
33
-
34
-
35
-
26
+
36
27
  # Wrapping in Dispatcher.to_prepare will, theoretically, take care of things
37
28
  # working properly even in development mode with cache_classes=false (per-request
38
29
  # class reloading).
@@ -0,0 +1,14 @@
1
+ module BlacklightCql
2
+
3
+ # Provides an #explain action method which can be mixed into
4
+ # a Blacklight CatalogController type controller, to provide an
5
+ # explain response.
6
+ module ExplainBehavior
7
+ def cql_explain
8
+ @luke_response = HashWithIndifferentAccess.new(blacklight_solr.get('admin/luke'))
9
+ @config = blacklight_config
10
+
11
+ render "blacklight_cql/explain.xml.builder", :content_type => "application/xml", :layout => false
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,50 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
4
+ gem 'rails', '4.0.2'
5
+
6
+ # Use sqlite3 as the database for Active Record
7
+ gem 'sqlite3'
8
+
9
+ # Use SCSS for stylesheets
10
+ gem 'sass-rails', '~> 4.0.0'
11
+
12
+ # Use Uglifier as compressor for JavaScript assets
13
+ gem 'uglifier', '>= 1.3.0'
14
+
15
+ # Use CoffeeScript for .js.coffee assets and views
16
+ gem 'coffee-rails', '~> 4.0.0'
17
+
18
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
19
+ # gem 'therubyracer', platforms: :ruby
20
+
21
+ # Use jquery as the JavaScript library
22
+ gem 'jquery-rails'
23
+
24
+ # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
25
+ gem 'turbolinks'
26
+
27
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
28
+ gem 'jbuilder', '~> 1.2'
29
+
30
+ group :doc do
31
+ # bundle exec rake doc:rails generates the API under doc/api.
32
+ gem 'sdoc', require: false
33
+ end
34
+
35
+ # Use ActiveModel has_secure_password
36
+ # gem 'bcrypt-ruby', '~> 3.1.2'
37
+
38
+ # Use unicorn as the app server
39
+ # gem 'unicorn'
40
+
41
+ # Use Capistrano for deployment
42
+ # gem 'capistrano', group: :development
43
+
44
+ # Use debugger
45
+ # gem 'debugger', group: [:development, :test]
46
+ gem 'blacklight_cql', :path => '/Users/jrochkind/code/blacklight_cql'
47
+
48
+ if File.exists?("/Users/jrochkind/code/blacklight_cql/spec/test_app_templates/Gemfile.extra")
49
+ eval File.read("/Users/jrochkind/code/blacklight_cql/spec/test_app_templates/Gemfile.extra"), nil, "/Users/jrochkind/code/blacklight_cql/spec/test_app_templates/Gemfile.extra"
50
+ end
@@ -0,0 +1,157 @@
1
+ PATH
2
+ remote: /Users/jrochkind/code/blacklight_cql
3
+ specs:
4
+ blacklight_cql (2.0.0)
5
+ blacklight (>= 3.2.0, < 6.0.0)
6
+ cql-ruby (>= 0.8.1)
7
+ rails
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actionmailer (4.0.2)
13
+ actionpack (= 4.0.2)
14
+ mail (~> 2.5.4)
15
+ actionpack (4.0.2)
16
+ activesupport (= 4.0.2)
17
+ builder (~> 3.1.0)
18
+ erubis (~> 2.7.0)
19
+ rack (~> 1.5.2)
20
+ rack-test (~> 0.6.2)
21
+ activemodel (4.0.2)
22
+ activesupport (= 4.0.2)
23
+ builder (~> 3.1.0)
24
+ activerecord (4.0.2)
25
+ activemodel (= 4.0.2)
26
+ activerecord-deprecated_finders (~> 1.0.2)
27
+ activesupport (= 4.0.2)
28
+ arel (~> 4.0.0)
29
+ activerecord-deprecated_finders (1.0.3)
30
+ activesupport (4.0.2)
31
+ i18n (~> 0.6, >= 0.6.4)
32
+ minitest (~> 4.2)
33
+ multi_json (~> 1.3)
34
+ thread_safe (~> 0.1)
35
+ tzinfo (~> 0.3.37)
36
+ arel (4.0.2)
37
+ atomic (1.1.14)
38
+ blacklight (4.6.2)
39
+ bootstrap-sass (>= 2.2.0, < 2.4)
40
+ deprecation
41
+ kaminari (~> 0.13)
42
+ marc (>= 0.4.3, < 1.1)
43
+ nokogiri (~> 1.6)
44
+ rails (>= 3.2.6, < 5)
45
+ rsolr (~> 1.0.6)
46
+ sass-rails
47
+ bootstrap-sass (2.3.2.2)
48
+ sass (~> 3.2)
49
+ builder (3.1.4)
50
+ coffee-rails (4.0.1)
51
+ coffee-script (>= 2.2.0)
52
+ railties (>= 4.0.0, < 5.0)
53
+ coffee-script (2.2.0)
54
+ coffee-script-source
55
+ execjs
56
+ coffee-script-source (1.7.0)
57
+ cql-ruby (0.9.1)
58
+ deprecation (0.1.0)
59
+ activesupport
60
+ ensure_valid_encoding (0.5.3)
61
+ erubis (2.7.0)
62
+ execjs (2.0.2)
63
+ hike (1.2.3)
64
+ i18n (0.6.9)
65
+ jbuilder (1.5.3)
66
+ activesupport (>= 3.0.0)
67
+ multi_json (>= 1.2.0)
68
+ jquery-rails (3.1.0)
69
+ railties (>= 3.0, < 5.0)
70
+ thor (>= 0.14, < 2.0)
71
+ json (1.8.1)
72
+ kaminari (0.15.1)
73
+ actionpack (>= 3.0.0)
74
+ activesupport (>= 3.0.0)
75
+ mail (2.5.4)
76
+ mime-types (~> 1.16)
77
+ treetop (~> 1.4.8)
78
+ marc (0.8.1)
79
+ ensure_valid_encoding
80
+ unf
81
+ mime-types (1.25.1)
82
+ mini_portile (0.5.2)
83
+ minitest (4.7.5)
84
+ multi_json (1.8.4)
85
+ nokogiri (1.6.1)
86
+ mini_portile (~> 0.5.0)
87
+ polyglot (0.3.3)
88
+ rack (1.5.2)
89
+ rack-test (0.6.2)
90
+ rack (>= 1.0)
91
+ rails (4.0.2)
92
+ actionmailer (= 4.0.2)
93
+ actionpack (= 4.0.2)
94
+ activerecord (= 4.0.2)
95
+ activesupport (= 4.0.2)
96
+ bundler (>= 1.3.0, < 2.0)
97
+ railties (= 4.0.2)
98
+ sprockets-rails (~> 2.0.0)
99
+ railties (4.0.2)
100
+ actionpack (= 4.0.2)
101
+ activesupport (= 4.0.2)
102
+ rake (>= 0.8.7)
103
+ thor (>= 0.18.1, < 2.0)
104
+ rake (10.1.1)
105
+ rdoc (4.1.1)
106
+ json (~> 1.4)
107
+ rsolr (1.0.9)
108
+ builder (>= 2.1.2)
109
+ sass (3.2.14)
110
+ sass-rails (4.0.1)
111
+ railties (>= 4.0.0, < 5.0)
112
+ sass (>= 3.1.10)
113
+ sprockets-rails (~> 2.0.0)
114
+ sdoc (0.4.0)
115
+ json (~> 1.8)
116
+ rdoc (~> 4.0, < 5.0)
117
+ sprockets (2.10.1)
118
+ hike (~> 1.2)
119
+ multi_json (~> 1.0)
120
+ rack (~> 1.0)
121
+ tilt (~> 1.1, != 1.3.0)
122
+ sprockets-rails (2.0.1)
123
+ actionpack (>= 3.0)
124
+ activesupport (>= 3.0)
125
+ sprockets (~> 2.8)
126
+ sqlite3 (1.3.8)
127
+ thor (0.18.1)
128
+ thread_safe (0.1.3)
129
+ atomic
130
+ tilt (1.4.1)
131
+ treetop (1.4.15)
132
+ polyglot
133
+ polyglot (>= 0.3.1)
134
+ turbolinks (2.2.1)
135
+ coffee-rails
136
+ tzinfo (0.3.38)
137
+ uglifier (2.4.0)
138
+ execjs (>= 0.3.0)
139
+ json (>= 1.8.0)
140
+ unf (0.1.3)
141
+ unf_ext
142
+ unf_ext (0.0.6)
143
+
144
+ PLATFORMS
145
+ ruby
146
+
147
+ DEPENDENCIES
148
+ blacklight_cql!
149
+ coffee-rails (~> 4.0.0)
150
+ jbuilder (~> 1.2)
151
+ jquery-rails
152
+ rails (= 4.0.2)
153
+ sass-rails (~> 4.0.0)
154
+ sdoc
155
+ sqlite3
156
+ turbolinks
157
+ uglifier (>= 1.3.0)
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Internal::Application.load_tasks
@@ -0,0 +1,16 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require turbolinks
16
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -1,4 +1,5 @@
1
1
  class ApplicationController < ActionController::Base
2
- include Blacklight::Controller
3
-
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
4
5
  end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Internal</title>
5
+ <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
6
+ <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,23 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # Require the gems listed in Gemfile, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env)
8
+
9
+ module Internal
10
+ class Application < Rails::Application
11
+ # Settings in config/environments/* take precedence over those specified here.
12
+ # Application configuration should go into files in config/initializers
13
+ # -- all .rb files in that directory are automatically loaded.
14
+
15
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
16
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
17
+ # config.time_zone = 'Central Time (US & Canada)'
18
+
19
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
21
+ # config.i18n.default_locale = :de
22
+ end
23
+ end
@@ -0,0 +1,4 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -1,3 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
1
15
  test:
2
- adapter: sqlite3
3
- database: db/combustion_test.sqlite
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000