Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@

# Ignore assets
/public/assets/*

# Ignore Vagrant
/.vagrant
/sdr.box
19 changes: 13 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,15 @@ gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript'
# Figs for var management
gem 'figs'

# MySQL for Rails backend dbter
gem 'mysql2', '~> 0.3.20'

# Loads NYU Libaries omniauth strategy
gem 'omniauth-nyulibraries', github: 'NYULibraries/omniauth-nyulibraries', tag: 'v2.1.2'
gem 'devise', '>= 3.4.1'

gem 'rsolr'
gem 'solr_wrapper'
gem 'solr_wrapper', '~> 2.0'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '>= 5.0.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
Expand Down Expand Up @@ -59,6 +54,13 @@ gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'capybara'
gem 'selenium-webdriver'
gem 'chromedriver-helper'
gem 'database_cleaner'
gem 'rspec-rails', '~> 3.5'
gem 'spring'
gem 'sqlite3'
end

group :development do
Expand All @@ -67,3 +69,8 @@ group :development do
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end

group :production do
# MySQL for Rails backend dbter
gem 'mysql2', '~> 0.3.20'
end
58 changes: 52 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ GEM
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
archive-zip (0.11.0)
io-like (~> 0.3.0)
arel (7.1.4)
autoprefixer-rails (8.4.1)
execjs
Expand All @@ -69,6 +71,19 @@ GEM
sass (>= 3.3.4)
builder (3.2.3)
byebug (10.0.2)
capybara (3.12.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (~> 1.2)
xpath (~> 3.2)
childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11)
chromedriver-helper (2.1.0)
archive-zip (~> 0.10)
nokogiri (~> 1.8)
coderay (1.1.2)
coffee-rails (4.1.1)
coffee-script (>= 2.2.0)
Expand All @@ -83,6 +98,7 @@ GEM
deep_merge (~> 1.2.1)
dry-validation (>= 0.10.4)
crass (1.0.4)
database_cleaner (1.7.0)
debug_inspector (0.0.3)
deep_merge (1.2.1)
deprecation (1.0.0)
Expand All @@ -93,6 +109,7 @@ GEM
railties (>= 4.1.0, < 6.0)
responders
warden (~> 1.2.3)
diff-lcs (1.3)
dry-configurable (0.7.0)
concurrent-ruby (~> 1.0)
dry-container (0.6.0)
Expand Down Expand Up @@ -164,6 +181,7 @@ GEM
i18n (1.0.1)
concurrent-ruby (~> 1.0)
inflecto (0.0.2)
io-like (0.3.0)
jbuilder (2.7.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
Expand Down Expand Up @@ -256,15 +274,33 @@ GEM
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rdoc (4.3.0)
regexp_parser (1.3.0)
responders (2.4.0)
actionpack (>= 4.2.0, < 5.3)
railties (>= 4.2.0, < 5.3)
retriable (3.1.1)
retriable (3.1.2)
rsolr (2.2.0)
builder (>= 2.1.2)
faraday (>= 0.9.0)
ruby-progressbar (1.9.0)
rubyzip (1.2.1)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-rails (3.8.1)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
ruby-progressbar (1.10.0)
rubyzip (1.2.2)
sanitize (4.6.4)
crass (~> 1.0.2)
nokogiri (>= 1.4.4)
Expand All @@ -283,7 +319,10 @@ GEM
sdoc (0.4.2)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
solr_wrapper (1.2.0)
selenium-webdriver (3.141.0)
childprocess (~> 0.5)
rubyzip (~> 1.2, >= 1.2.2)
solr_wrapper (2.0.0)
faraday
retriable
ruby-progressbar
Expand Down Expand Up @@ -322,14 +361,19 @@ GEM
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
xpath (3.2.0)
nokogiri (~> 1.8)

PLATFORMS
ruby

DEPENDENCIES
blacklight
byebug
capybara
chromedriver-helper
coffee-rails (~> 4.1.0)
database_cleaner
devise (>= 3.4.1)
figs
geoblacklight (~> 1.8.0)
Expand All @@ -339,9 +383,11 @@ DEPENDENCIES
omniauth-nyulibraries!
rails (>= 5.0.0)
rsolr
rspec-rails (~> 3.5)
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
solr_wrapper
selenium-webdriver
solr_wrapper (~> 2.0)
spring
sqlite3
turbolinks
Expand All @@ -350,4 +396,4 @@ DEPENDENCIES
web-console (~> 2.0)

BUNDLED WITH
1.16.1
1.16.6
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,34 @@
This tracks the implementation of GeoBlacklight used to power the front-end of our [Spatial Data Repository](https://geo.nyu.edu)

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.

## Development

### Vagrant / Virtualbox

* Install Vagrant: https://www.vagrantup.com/downloads.html
* Install VirtualBox: https://www.virtualbox.org/wiki/Downloads

#### Run app via these commands

```bash

cd <project-root>
vagrant up
vagrant ssh
cd /vagrant/sdr

# FIGS - Set Dev/Test ENV variables
cp config/vars.yml.example config/vars.yml

# Init database
bundle exec rake db:schema:load

# Run Solr and Rails App server
bundle exec rake sdr:server
```

Application should now be running.

* Solr admin panel at: http://localhost:8983/
* Rails app at: http://localhost:3000
79 changes: 79 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# frozen_string_literal: true

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.

# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "bento/centos-7.1"
config.vm.hostname = "sdr-geoblacklight"
config.vm.synced_folder ".", "/vagrant/sdr"

# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network "forwarded_port", guest: 8983, host: 8983, auto_correct: true
config.vm.network "forwarded_port", guest: 3000, host: 3000, auto_correct: true

# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"

# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"

# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"

# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.

# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end

# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# sudo apt-get update
# sudo apt-get install -y apache2
# SHELL

config.vm.provision "shell", path: "provision.sh"
end
7 changes: 4 additions & 3 deletions app/controllers/users/omniauth_callbacks_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
before_filter :require_valid_omniauth, only: :nyulibraries
before_action :require_valid_omniauth, only: :nyulibraries

def nyulibraries
# Find existing or initialize new user,
# and save new attributes each time
Expand Down Expand Up @@ -34,7 +35,7 @@ def require_valid_omniauth
def valid_omniauth?
omniauth.present? && omniauth.provider.to_s == 'nyulibraries' && !omniauth_aleph_identity.blank?
# Only accept users with an Aleph ID, authenticated via nyulibraries
end
end

def omniauth
@omniauth ||= request.env["omniauth.auth"]
Expand Down Expand Up @@ -98,4 +99,4 @@ def failure
redirect_to root_path
end

end
end
3 changes: 0 additions & 3 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,5 @@ class Application < Rails::Application
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de

# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
end
end
8 changes: 4 additions & 4 deletions config/blacklight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
# each environment can have a jetty_path with absolute or relative
# (to app root) path to a jetty/solr install. This is used
# by the rake tasks that start up solr automatically for testing
# and by rake solr:marc:index.
# and by rake solr:marc:index.
#
# jetty_path is not used by a running Blacklight application
# at all. In general you do NOT need to deploy solr in Jetty, you can deploy it
# however you want.
# however you want.
# jetty_path is only required for rake tasks that need to know
# how to start up solr, generally for automated testing.
# how to start up solr, generally for automated testing.

development:
adapter: solr
url: <%= ENV['SOLR_URL'] %>
test: &test
adapter: solr
url: <%= "http://127.0.0.1:#{ENV['TEST_JETTY_PORT'] || 8888}/solr/blacklight-core" %>
url: <%= ENV['SOLR_URL'] %>
staging:
adapter: solr
url: <%= ENV['SOLR_URL'] %>
Expand Down
3 changes: 2 additions & 1 deletion config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ default: &default
password: <%= ENV['SQL_PASS'] %>

development:
<<: *default
adapter: sqlite3
pool: 5
timeout: 5000
database: db/development.sqlite3

staging:
<<: *default
Expand Down
4 changes: 2 additions & 2 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
config.eager_load = false

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

# Show full error reports and disable caching.
config.consider_all_requests_local = true
Expand Down
Loading