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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
test:
runs-on: ubuntu-latest
name: test
name: test
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
Expand Down
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,12 @@

# Ignore google verification
/public/google*.html

.env
.env.*

master.key

config/settings.local.yml
config/settings/*.local.yml
config/environments/*.local.yml
4 changes: 0 additions & 4 deletions Figsfile

This file was deleted.

3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
source 'https://rubygems.org'

gem 'blacklight'
gem 'config'
gem 'devise'
gem 'figs'
gem 'geoblacklight', '~> 1.9.0'
gem 'jbuilder'
gem 'jquery-rails'
Expand Down Expand Up @@ -32,6 +32,7 @@ group :development, :test do
gem 'capybara'
gem 'capybara-screenshot'
gem 'database_cleaner'
gem 'dotenv-rails'
gem 'factory_bot_rails'
gem 'geckodriver-helper'
gem 'puma'
Expand Down
13 changes: 6 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ GEM
warden (~> 1.2.3)
diff-lcs (1.4.4)
docile (1.3.2)
dotenv (2.8.1)
dotenv-rails (2.8.1)
dotenv (= 2.8.1)
railties (>= 3.2)
dry-configurable (0.11.6)
concurrent-ruby (~> 1.0)
dry-core (~> 0.4, >= 0.4.7)
Expand Down Expand Up @@ -165,9 +169,6 @@ GEM
faraday_middleware (0.14.0)
faraday (>= 0.7.4, < 1.0)
ffi (1.15.5)
figs (3.0.0)
git (~> 1.2)
rake (>= 10.1)
font-awesome-rails (4.7.0.5)
railties (>= 3.2, < 6.1)
geckodriver-helper (0.24.0)
Expand Down Expand Up @@ -195,8 +196,6 @@ GEM
mime-types
rails (~> 5.0)
geoblacklight-icons (1.4.0)
git (1.7.0)
rchardet (~> 1.8)
globalid (0.4.2)
activesupport (>= 4.2.0)
handlebars_assets (0.23.8)
Expand Down Expand Up @@ -309,7 +308,6 @@ GEM
thor (>= 0.19.0, < 2.0)
rainbow (3.0.0)
rake (13.0.1)
rchardet (1.8.0)
rdoc (6.2.1)
regexp_parser (1.7.1)
responders (3.0.1)
Expand Down Expand Up @@ -428,10 +426,11 @@ DEPENDENCIES
byebug
capybara
capybara-screenshot
config
database_cleaner
devise
dotenv-rails
factory_bot_rails
figs
geckodriver-helper
geoblacklight (~> 1.9.0)
jbuilder
Expand Down
7 changes: 2 additions & 5 deletions config/application.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
require File.expand_path('../boot', __FILE__)
require File.expand_path('boot', __dir__)

require 'rails/all'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

require 'figs'
Figs.load(stage: Rails.env)

module NyuGeoblacklight
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
config.assets.precompile += %w[*.png *.jpg *.jpeg *.gif]

# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
Expand Down
8 changes: 4 additions & 4 deletions config/blacklight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

development:
adapter: solr
url: <%= ENV['SOLR_URL'] %>
url: <%= Settings.SOLR_URL %>
test: &test
adapter: solr
url: <%= ENV['SOLR_URL'] %>
url: <%= Settings.SOLR_URL %>
staging:
adapter: solr
url: <%= ENV['SOLR_URL'] %>
url: <%= Settings.SOLR_URL %>
production:
adapter: solr
url: <%= ENV['SOLR_URL'] %>
url: <%= Settings.SOLR_URL %>
10 changes: 5 additions & 5 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
default: &default
adapter: mysql2
encoding: utf8
host: <%= ENV['SQL_HOST'] %>
port: <%= ENV['SQL_PORT'] %>
database: <%= ENV['SQL_DB'] %>
username: <%= ENV['SQL_USER'] %>
password: <%= ENV['SQL_PASS'] %>
host: <%= Settings.SQL_HOST %>
port: <%= Settings.SQL_PORT %>
database: <%= Settings.SQL_DB %>
username: <%= Settings.SQL_USER %>
password: <%= Settings.SQL_PASS %>

development:
adapter: sqlite3
Expand Down
55 changes: 55 additions & 0 deletions config/initializers/config.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
Config.setup do |config|
# Name of the constant exposing loaded settings
config.const_name = 'Settings'

# Ability to remove elements of the array set in earlier loaded settings file. For example value: '--'.
#
# config.knockout_prefix = nil

# Overwrite an existing value when merging a `nil` value.
# When set to `false`, the existing value is retained after merge.
#
# config.merge_nil_values = true

# Overwrite arrays found in previously loaded settings file. When set to `false`, arrays will be merged.
#
# config.overwrite_arrays = true

# Load environment variables from the `ENV` object and override any settings defined in files.
#
# config.use_env = false

# Define ENV variable prefix deciding which variables to load into config.
#
# Reading variables from ENV is case-sensitive. If you define lowercase value below, ensure your ENV variables are
# prefixed in the same way.
#
# When not set it defaults to `config.const_name`.
#
config.env_prefix = 'SETTINGS'

# What string to use as level separator for settings loaded from ENV variables. Default value of '.' works well
# with Heroku, but you might want to change it for example for '__' to easy override settings from command line, where
# using dots in variable names might not be allowed (eg. Bash).
#
# config.env_separator = '.'

# Ability to process variables names:
# * nil - no change
# * :downcase - convert to lower case
#
# config.env_converter = :downcase

# Parse numeric values as integers instead of strings.
#
# config.env_parse_values = true

# Validate presence and type of specific config values. Check https://github.com/dry-rb/dry-validation for details.
#
# config.schema do
# required(:name).filled
# required(:age).maybe(:int?)
# required(:email).filled(format?: EMAIL_REGEX)
# end

end
14 changes: 6 additions & 8 deletions config/initializers/devise.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
Figs.load() # Load app secrets into ENV

Devise.setup do |config|
config.mailer_sender = 'lib-no-reply@nyu.edu'
require 'devise/orm/active_record'
config.secret_key = ENV['DEVISE_SECRET_TOKEN']
config.strip_whitespace_keys = [ :email ]
config.secret_key = Settings.DEVISE_SECRET_TOKEN
config.strip_whitespace_keys = [:email]
config.skip_session_storage = [:http_auth]
config.stretches = Rails.env.test? ? 1 : 10
config.reconfirmable = true
config.rememberable_options = {}
config.password_length = 8..128
config.reset_password_within = 60.minutes
config.sign_out_via = :get
config.omniauth :nyulibraries, ENV['APP_ID'], ENV['APP_SECRET'], client_options: {
site: ENV['LOGIN_URL'],
authorize_path: '/oauth/authorize'
}
config.omniauth :nyulibraries, Settings.APP_ID, Settings.APP_SECRET, client_options: {
site: Settings.LOGIN_URL,
authorize_path: '/oauth/authorize'
}
end
9 changes: 0 additions & 9 deletions config/initializers/figs.rb

This file was deleted.

8 changes: 4 additions & 4 deletions config/secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
# if you're sharing your code publicly.

development:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
secret_key_base: <%= Settings.SECRET_KEY_BASE %>

test:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
secret_key_base: <%= Settings.SECRET_KEY_BASE %>

staging:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
secret_key_base: <%= Settings.SECRET_KEY_BASE %>

production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
secret_key_base: <%= Settings.SECRET_KEY_BASE %>
6 changes: 6 additions & 0 deletions config/settings/development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SECRET_KEY_BASE: 6c51f19b57fdebd3dfd2a3cf8b69fab7f41a529b6bfbf8bff4a85815934066cbe22ddf7fa6083f227288c04e4eeb6c28f0fd90e31fc02314aaceb135dacecc07

DEVISE_SECRET_TOKEN: 2c847492b6d434c808e63a93ff16a7a897aa4c09943edaaf7aa498a29649048113cf55731282e39a82ae7ce3fb9f1087586d474fc483ad6f63806986a5a02a6c

SOLR_URL: http://127.0.0.1:8983/solr/sdr-core-development
SOLR_VERSION: 7.5.0
6 changes: 6 additions & 0 deletions config/settings/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SECRET_KEY_BASE: 6c51f19b57fdebd3dfd2a3cf8b69fab7f41a529b6bfbf8bff4a85815934066cbe22ddf7fa6083f227288c04e4eeb6c28f0fd90e31fc02314aaceb135dacecc07

DEVISE_SECRET_TOKEN: bfbd360e6b465662c331578b3598323559980c73fde2dea24a8253089a5efa8f27775e9ba60838128e9f3feaec643c67397d8bd5f7c6f67a4b06114b32cc617c

SOLR_URL: http://127.0.0.1:8985/solr/sdr-core-test
SOLR_VERSION: 7.5.0
13 changes: 8 additions & 5 deletions lib/tasks/sdr.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
desc 'Run test suite'
task :ci do
shared_solr_opts = { managed: true, verbose: true, persist: false, download_dir: 'tmp' }
shared_solr_opts[:version] = ENV['SOLR_VERSION'] if ENV['SOLR_VERSION']
shared_solr_opts[:version] = Settings.SOLR_VERSION if Settings.SOLR_VERSION

SolrWrapper.wrap(shared_solr_opts.merge(port: 8985, instance_dir: 'tmp/sdr-core-test')) do |solr|
solr.with_collection(name: 'sdr-core-test', dir: Rails.root.join('solr', 'conf').to_s) do
ENV['SOLR_URL'] = 'http://localhost:8985/solr/sdr-core-test'
system 'RAILS_ENV=test rake geoblacklight:index:seed'
Rake::Task['spec'].invoke
end
Expand All @@ -19,14 +20,15 @@ namespace :sdr do
require 'solr_wrapper'

shared_solr_opts = { managed: true, verbose: true, persist: false, download_dir: 'tmp' }
shared_solr_opts[:version] = ENV['SOLR_VERSION'] if ENV['SOLR_VERSION']
shared_solr_opts[:version] = Settings.SOLR_VERSION if Settings.SOLR_VERSION

SolrWrapper.wrap(shared_solr_opts.merge(port: 8983, instance_dir: 'tmp/sdr-core-development')) do |solr|
solr.with_collection(name: 'sdr-core-development', dir: Rails.root.join('solr', 'conf').to_s) do
puts 'Solr running at http://localhost:8983/solr/sdr-core-development/, ^C to exit'
puts ' '
begin
Rake::Task['geoblacklight:solr:seed'].invoke
ENV['SOLR_URL'] = 'http://localhost:8983/solr/sdr-core-development'
system 'rake geoblacklight:index:seed'
system 'bundle exec rails s -b 0.0.0.0'
sleep
rescue Interrupt
Expand All @@ -40,11 +42,12 @@ namespace :sdr do
task :test do
if Rails.env.test?
shared_solr_opts = { managed: true, verbose: true, persist: false, download_dir: 'tmp' }
shared_solr_opts[:version] = ENV['SOLR_VERSION'] if ENV['SOLR_VERSION']
shared_solr_opts[:version] = Settings.SOLR_VERSION if Settings.SOLR_VERSION

SolrWrapper.wrap(shared_solr_opts.merge(port: 8985, instance_dir: 'tmp/sdr-core-test')) do |solr|
solr.with_collection(name: 'sdr-core-test', dir: Rails.root.join('solr', 'conf').to_s) do
puts 'Solr running at http://localhost:8985/solr/sdr-core-test/, ^C to exit'
ENV['SOLR_URL'] = 'http://localhost:8985/solr/sdr-core-test'
begin
Rake::Task['geoblacklight:solr:seed'].invoke
sleep
Expand All @@ -61,7 +64,7 @@ namespace :sdr do
desc 'Start solr server for development.'
task :development do
shared_solr_opts = { managed: true, verbose: true, persist: false, download_dir: 'tmp' }
shared_solr_opts[:version] = ENV['SOLR_VERSION'] if ENV['SOLR_VERSION']
shared_solr_opts[:version] = Settings.SOLR_VERSION if Settings.SOLR_VERSION

SolrWrapper.wrap(shared_solr_opts.merge(port: 8983, instance_dir: 'tmp/sdr-core-development')) do |solr|
solr.with_collection(name: 'sdr-core-development', dir: Rails.root.join('solr', 'conf').to_s) do
Expand Down