Skip to content

Commit 0d97f34

Browse files
authored
Feature/solrwrapper (#23)
* Gems: update solr_wrapper to 2.0 * SolrWrapper: implement rake tasks with fixtures Adds rake tasks for running Solr in development and test mode; and populating index with fixtures. rake sdr:test rake sdr:development * Fixtures: add NYU and GBL core * Rspec: dependencies, config, passing specs * RSpec: stub homepage features * add nyu-indexmap.json for fixtures list * adds stanford-indexmap.json to fixtures * Development: use sqlite as DB * Init: vagrantfile and provision.sh Adds vagrant. Solr confs for solr-wrapper expectations. * Provision: update rvm keys * Ignore: sdr.box * README: add vagrant details * README: add vars.yml.example * Update README.md * README: FIGS before DB * Specs: show page * DEPRECATION: s/before_filter/before_action * DEPRECATION: raise_in_transactional_callbacks Remove as no longer pertinent. * DEPRECATION: test env fixes for 5.1
1 parent c1d23ed commit 0d97f34

File tree

70 files changed

+2566
-29
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+2566
-29
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@
2626

2727
# Ignore assets
2828
/public/assets/*
29+
30+
# Ignore Vagrant
31+
/.vagrant
32+
/sdr.box

Gemfile

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,15 @@ gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript'
1515
# Figs for var management
1616
gem 'figs'
1717

18-
# MySQL for Rails backend dbter
19-
gem 'mysql2', '~> 0.3.20'
20-
2118
# Loads NYU Libaries omniauth strategy
2219
gem 'omniauth-nyulibraries', github: 'NYULibraries/omniauth-nyulibraries', tag: 'v2.1.2'
2320
gem 'devise', '>= 3.4.1'
2421

2522
gem 'rsolr'
26-
gem 'solr_wrapper'
23+
gem 'solr_wrapper', '~> 2.0'
2724

2825
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
2926
gem 'rails', '>= 5.0.0'
30-
# Use sqlite3 as the database for Active Record
31-
gem 'sqlite3'
3227
# Use SCSS for stylesheets
3328
gem 'sass-rails', '~> 5.0'
3429
# Use Uglifier as compressor for JavaScript assets
@@ -59,6 +54,13 @@ gem 'sdoc', '~> 0.4.0', group: :doc
5954
group :development, :test do
6055
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
6156
gem 'byebug'
57+
gem 'capybara'
58+
gem 'selenium-webdriver'
59+
gem 'chromedriver-helper'
60+
gem 'database_cleaner'
61+
gem 'rspec-rails', '~> 3.5'
62+
gem 'spring'
63+
gem 'sqlite3'
6264
end
6365

6466
group :development do
@@ -67,3 +69,8 @@ group :development do
6769
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
6870
gem 'spring'
6971
end
72+
73+
group :production do
74+
# MySQL for Rails backend dbter
75+
gem 'mysql2', '~> 0.3.20'
76+
end

Gemfile.lock

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ GEM
4848
tzinfo (~> 1.1)
4949
addressable (2.5.2)
5050
public_suffix (>= 2.0.2, < 4.0)
51+
archive-zip (0.11.0)
52+
io-like (~> 0.3.0)
5153
arel (7.1.4)
5254
autoprefixer-rails (8.4.1)
5355
execjs
@@ -69,6 +71,19 @@ GEM
6971
sass (>= 3.3.4)
7072
builder (3.2.3)
7173
byebug (10.0.2)
74+
capybara (3.12.0)
75+
addressable
76+
mini_mime (>= 0.1.3)
77+
nokogiri (~> 1.8)
78+
rack (>= 1.6.0)
79+
rack-test (>= 0.6.3)
80+
regexp_parser (~> 1.2)
81+
xpath (~> 3.2)
82+
childprocess (0.9.0)
83+
ffi (~> 1.0, >= 1.0.11)
84+
chromedriver-helper (2.1.0)
85+
archive-zip (~> 0.10)
86+
nokogiri (~> 1.8)
7287
coderay (1.1.2)
7388
coffee-rails (4.1.1)
7489
coffee-script (>= 2.2.0)
@@ -83,6 +98,7 @@ GEM
8398
deep_merge (~> 1.2.1)
8499
dry-validation (>= 0.10.4)
85100
crass (1.0.4)
101+
database_cleaner (1.7.0)
86102
debug_inspector (0.0.3)
87103
deep_merge (1.2.1)
88104
deprecation (1.0.0)
@@ -93,6 +109,7 @@ GEM
93109
railties (>= 4.1.0, < 6.0)
94110
responders
95111
warden (~> 1.2.3)
112+
diff-lcs (1.3)
96113
dry-configurable (0.7.0)
97114
concurrent-ruby (~> 1.0)
98115
dry-container (0.6.0)
@@ -164,6 +181,7 @@ GEM
164181
i18n (1.0.1)
165182
concurrent-ruby (~> 1.0)
166183
inflecto (0.0.2)
184+
io-like (0.3.0)
167185
jbuilder (2.7.0)
168186
activesupport (>= 4.2.0)
169187
multi_json (>= 1.2)
@@ -256,15 +274,33 @@ GEM
256274
rb-inotify (0.9.10)
257275
ffi (>= 0.5.0, < 2)
258276
rdoc (4.3.0)
277+
regexp_parser (1.3.0)
259278
responders (2.4.0)
260279
actionpack (>= 4.2.0, < 5.3)
261280
railties (>= 4.2.0, < 5.3)
262-
retriable (3.1.1)
281+
retriable (3.1.2)
263282
rsolr (2.2.0)
264283
builder (>= 2.1.2)
265284
faraday (>= 0.9.0)
266-
ruby-progressbar (1.9.0)
267-
rubyzip (1.2.1)
285+
rspec-core (3.8.0)
286+
rspec-support (~> 3.8.0)
287+
rspec-expectations (3.8.2)
288+
diff-lcs (>= 1.2.0, < 2.0)
289+
rspec-support (~> 3.8.0)
290+
rspec-mocks (3.8.0)
291+
diff-lcs (>= 1.2.0, < 2.0)
292+
rspec-support (~> 3.8.0)
293+
rspec-rails (3.8.1)
294+
actionpack (>= 3.0)
295+
activesupport (>= 3.0)
296+
railties (>= 3.0)
297+
rspec-core (~> 3.8.0)
298+
rspec-expectations (~> 3.8.0)
299+
rspec-mocks (~> 3.8.0)
300+
rspec-support (~> 3.8.0)
301+
rspec-support (3.8.0)
302+
ruby-progressbar (1.10.0)
303+
rubyzip (1.2.2)
268304
sanitize (4.6.4)
269305
crass (~> 1.0.2)
270306
nokogiri (>= 1.4.4)
@@ -283,7 +319,10 @@ GEM
283319
sdoc (0.4.2)
284320
json (~> 1.7, >= 1.7.7)
285321
rdoc (~> 4.0)
286-
solr_wrapper (1.2.0)
322+
selenium-webdriver (3.141.0)
323+
childprocess (~> 0.5)
324+
rubyzip (~> 1.2, >= 1.2.2)
325+
solr_wrapper (2.0.0)
287326
faraday
288327
retriable
289328
ruby-progressbar
@@ -322,14 +361,19 @@ GEM
322361
websocket-driver (0.6.5)
323362
websocket-extensions (>= 0.1.0)
324363
websocket-extensions (0.1.3)
364+
xpath (3.2.0)
365+
nokogiri (~> 1.8)
325366

326367
PLATFORMS
327368
ruby
328369

329370
DEPENDENCIES
330371
blacklight
331372
byebug
373+
capybara
374+
chromedriver-helper
332375
coffee-rails (~> 4.1.0)
376+
database_cleaner
333377
devise (>= 3.4.1)
334378
figs
335379
geoblacklight (~> 1.8.0)
@@ -339,9 +383,11 @@ DEPENDENCIES
339383
omniauth-nyulibraries!
340384
rails (>= 5.0.0)
341385
rsolr
386+
rspec-rails (~> 3.5)
342387
sass-rails (~> 5.0)
343388
sdoc (~> 0.4.0)
344-
solr_wrapper
389+
selenium-webdriver
390+
solr_wrapper (~> 2.0)
345391
spring
346392
sqlite3
347393
turbolinks
@@ -350,4 +396,4 @@ DEPENDENCIES
350396
web-console (~> 2.0)
351397

352398
BUNDLED WITH
353-
1.16.1
399+
1.16.6

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,34 @@
33
This tracks the implementation of GeoBlacklight used to power the front-end of our [Spatial Data Repository](https://geo.nyu.edu)
44

55
Check out the [wiki](https://github.com/NYULibraries/spatial_data_repository/wiki) for details about local modifications, as well as a detailed overview of the service architecture.
6+
7+
## Development
8+
9+
### Vagrant / Virtualbox
10+
11+
* Install Vagrant: https://www.vagrantup.com/downloads.html
12+
* Install VirtualBox: https://www.virtualbox.org/wiki/Downloads
13+
14+
#### Run app via these commands
15+
16+
```bash
17+
18+
cd <project-root>
19+
vagrant up
20+
vagrant ssh
21+
cd /vagrant/sdr
22+
23+
# FIGS - Set Dev/Test ENV variables
24+
cp config/vars.yml.example config/vars.yml
25+
26+
# Init database
27+
bundle exec rake db:schema:load
28+
29+
# Run Solr and Rails App server
30+
bundle exec rake sdr:server
31+
```
32+
33+
Application should now be running.
34+
35+
* Solr admin panel at: http://localhost:8983/
36+
* Rails app at: http://localhost:3000

Vagrantfile

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# frozen_string_literal: true
2+
3+
# -*- mode: ruby -*-
4+
# vi: set ft=ruby :
5+
6+
# All Vagrant configuration is done below. The "2" in Vagrant.configure
7+
# configures the configuration version (we support older styles for
8+
# backwards compatibility). Please don't change it unless you know what
9+
# you're doing.
10+
Vagrant.configure(2) do |config|
11+
# The most common configuration options are documented and commented below.
12+
# For a complete reference, please see the online documentation at
13+
# https://docs.vagrantup.com.
14+
15+
# Every Vagrant development environment requires a box. You can search for
16+
# boxes at https://atlas.hashicorp.com/search.
17+
config.vm.box = "bento/centos-7.1"
18+
config.vm.hostname = "sdr-geoblacklight"
19+
config.vm.synced_folder ".", "/vagrant/sdr"
20+
21+
# Disable automatic box update checking. If you disable this, then
22+
# boxes will only be checked for updates when the user runs
23+
# `vagrant box outdated`. This is not recommended.
24+
# config.vm.box_check_update = false
25+
26+
# Create a forwarded port mapping which allows access to a specific port
27+
# within the machine from a port on the host machine. In the example below,
28+
# accessing "localhost:8080" will access port 80 on the guest machine.
29+
# config.vm.network "forwarded_port", guest: 80, host: 8080
30+
config.vm.network "forwarded_port", guest: 8983, host: 8983, auto_correct: true
31+
config.vm.network "forwarded_port", guest: 3000, host: 3000, auto_correct: true
32+
33+
# Create a private network, which allows host-only access to the machine
34+
# using a specific IP.
35+
# config.vm.network "private_network", ip: "192.168.33.10"
36+
37+
# Create a public network, which generally matched to bridged network.
38+
# Bridged networks make the machine appear as another physical device on
39+
# your network.
40+
# config.vm.network "public_network"
41+
42+
# Share an additional folder to the guest VM. The first argument is
43+
# the path on the host to the actual folder. The second argument is
44+
# the path on the guest to mount the folder. And the optional third
45+
# argument is a set of non-required options.
46+
# config.vm.synced_folder "../data", "/vagrant_data"
47+
48+
# Provider-specific configuration so you can fine-tune various
49+
# backing providers for Vagrant. These expose provider-specific options.
50+
# Example for VirtualBox:
51+
#
52+
# config.vm.provider "virtualbox" do |vb|
53+
# # Display the VirtualBox GUI when booting the machine
54+
# vb.gui = true
55+
#
56+
# # Customize the amount of memory on the VM:
57+
# vb.memory = "1024"
58+
# end
59+
#
60+
# View the documentation for the provider you are using for more
61+
# information on available options.
62+
63+
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
64+
# such as FTP and Heroku are also available. See the documentation at
65+
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
66+
# config.push.define "atlas" do |push|
67+
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
68+
# end
69+
70+
# Enable provisioning with a shell script. Additional provisioners such as
71+
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
72+
# documentation for more information about their specific syntax and use.
73+
# config.vm.provision "shell", inline: <<-SHELL
74+
# sudo apt-get update
75+
# sudo apt-get install -y apache2
76+
# SHELL
77+
78+
config.vm.provision "shell", path: "provision.sh"
79+
end

app/controllers/users/omniauth_callbacks_controller.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
2-
before_filter :require_valid_omniauth, only: :nyulibraries
2+
before_action :require_valid_omniauth, only: :nyulibraries
3+
34
def nyulibraries
45
# Find existing or initialize new user,
56
# and save new attributes each time
@@ -34,7 +35,7 @@ def require_valid_omniauth
3435
def valid_omniauth?
3536
omniauth.present? && omniauth.provider.to_s == 'nyulibraries' && !omniauth_aleph_identity.blank?
3637
# Only accept users with an Aleph ID, authenticated via nyulibraries
37-
end
38+
end
3839

3940
def omniauth
4041
@omniauth ||= request.env["omniauth.auth"]
@@ -98,4 +99,4 @@ def failure
9899
redirect_to root_path
99100
end
100101

101-
end
102+
end

config/application.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,5 @@ class Application < Rails::Application
2323
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
2424
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
2525
# config.i18n.default_locale = :de
26-
27-
# Do not swallow errors in after_commit/after_rollback callbacks.
28-
config.active_record.raise_in_transactional_callbacks = true
2926
end
3027
end

config/blacklight.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
# each environment can have a jetty_path with absolute or relative
33
# (to app root) path to a jetty/solr install. This is used
44
# by the rake tasks that start up solr automatically for testing
5-
# and by rake solr:marc:index.
5+
# and by rake solr:marc:index.
66
#
77
# jetty_path is not used by a running Blacklight application
88
# at all. In general you do NOT need to deploy solr in Jetty, you can deploy it
9-
# however you want.
9+
# however you want.
1010
# jetty_path is only required for rake tasks that need to know
11-
# how to start up solr, generally for automated testing.
11+
# how to start up solr, generally for automated testing.
1212

1313
development:
1414
adapter: solr
1515
url: <%= ENV['SOLR_URL'] %>
1616
test: &test
1717
adapter: solr
18-
url: <%= "http://127.0.0.1:#{ENV['TEST_JETTY_PORT'] || 8888}/solr/blacklight-core" %>
18+
url: <%= ENV['SOLR_URL'] %>
1919
staging:
2020
adapter: solr
2121
url: <%= ENV['SOLR_URL'] %>

config/database.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ default: &default
99
password: <%= ENV['SQL_PASS'] %>
1010

1111
development:
12-
<<: *default
12+
adapter: sqlite3
1313
pool: 5
1414
timeout: 5000
15+
database: db/development.sqlite3
1516

1617
staging:
1718
<<: *default

config/environments/test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
config.eager_load = false
1414

1515
# Configure static file server for tests with Cache-Control for performance.
16-
config.serve_static_files = true
17-
config.static_cache_control = 'public, max-age=3600'
16+
config.public_file_server.enabled = true
17+
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
1818

1919
# Show full error reports and disable caching.
2020
config.consider_all_requests_local = true

0 commit comments

Comments
 (0)