Skip to content

Commit

Permalink
Merge branch 'release/0.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ewlarson committed Nov 22, 2024
2 parents e0a0ed9 + 52e10ec commit 2424e4b
Show file tree
Hide file tree
Showing 178 changed files with 3,939 additions and 711 deletions.
2 changes: 1 addition & 1 deletion .env.test.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
POSTGRES_HOST = localhost
POSTGRES_PORT = 5432
POSTGRES_PORT = 5555
POSTGRES_DB = geoblacklight_test
POSTGRES_USER = postgres
POSTGRES_PASSWORD = postgres
70 changes: 67 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,76 @@ jobs:
linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.1
ruby-version: 3.3.5
- name: Install dependencies
run: bundle install
- name: Run linter
run: bundle exec standardrb
run: bundle exec standardrb

test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby_version: ['3.3']
rails_version: [7.1.4]

services:
postgres:
image: postgres:latest
env:
POSTGRES_HOST: 127.0.0.1
POSTGRES_PORT: 5555
POSTGRES_DB: geoblacklight_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5555:5432
# Set health checks to wait until postgres has started
options:
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

name: Test ${{ matrix.rails_version }}, ruby ${{ matrix.ruby_version }}
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true
cache-version: 2

- name: Node - v20
uses: actions/setup-node@v4
with:
node-version: '20.11.0'

- name: Yarn - Setup
run: exec "yarnpkg"

- name: Install dependencies
run: bundle install

- name: Run Tests
run: |
bundle exec rake ci
env:
RAILS_ENV: test
ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-coffee'
SOLR_URL: http://solr:SolrRocks@localhost:8983/solr/blacklight-core

- name: Artifacts - Upload coverage
uses: actions/upload-artifact@v4
if: always()
with:
name: Coverage & Screenshots
path: |
coverage/
tmp/screenshots/
7 changes: 0 additions & 7 deletions .solr_wrapper.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .standard.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
format: progress
ignore:
- 'db/seeds.rb'
- 'db/migrate/**'
- 'db/migrate/**'
- 'app/models/document/bbox_validator.rb'
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ else
gem "awesome_print"
gem "blacklight_advanced_search"
gem "devise-bootstrap-views", "~> 1.0"
gem "devise_invitable", "~> 2.0.0"
gem "dotenv-rails"
gem "haml"
gem "inline_svg"
Expand Down
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,19 @@ You need a PostgreSQL database to use this project.

### Install Template

Use Ruby v3.3 and Rails v7.0.8.1 to bootstrap a new GeoBlacklight + GBL Admin application using the template script:
#### 1. Create your geoblacklight_admin_development PostgreSQL database

```bash
rails _7.0.8.1_ new gbl_admin -m https://raw.githubusercontent.com/geobtaa/geoblacklight_admin/develop/template.rb
psql postgres
CREATE DATABASE geoblacklight_admin_development;
```

#### 2. Bootstrap a new GeoBlacklight + GBL Admin application using the template script:

```bash
rails _7.2.2_ new gbl_admin -m https://raw.githubusercontent.com/geobtaa/geoblacklight_admin/develop/template.rb
cd gbl_admin
bundle exec rake gbl_admin:server
bundle exec rake geoblacklight:server
```

You have now generated the .internal_test_app and populated the Elements / FormElements tables for OMG Aardvark support.
Expand All @@ -44,7 +51,7 @@ You have now generated the .internal_test_app and populated the Elements / FormE
2. Click on the "Sign in" link
3. Enter email: [email protected] and password: 123456
4. Click on the "GBL Admin" link
5. Import some CSV (test/fixtures/files/btaa_sample_records.csv)
5. Import some CSV data (test/fixtures/files/btaa_sample_records.csv)

-----

Expand All @@ -58,10 +65,12 @@ The gem is available as open source under the terms of the [Apache 2.0 License](
## TODOs / Roadmap
* ~~Send GBLADMIN JavaScript pack to NPM like Blacklight~~
* ~~Improve test coverage~~
* Fix CI test runner
* Debug Rails 7.2 support
* Separate dct_references_s support into a separate model
* Import/Export dct_references_s outside of the main document model
* Migrate our GBL api controllers to just RSolr-based models
* ~~Fix CI test runner~~
* ~~Debug Rails 7.2 support (remove devise_invitable, see [#915](https://github.com/scambra/devise_invitable/issues/915))~~
* ~~Separate dct_references_s support into a separate model~~
* ~~Import/Export dct_references_s outside of the main document model~~
* Migrate our GBL API controllers to just RSolr-based models
* DRY up Gem dependencies and Engine routing
* Gazetteer: Add GeoNames support
* Gazetteer: Add Who's On First support
* Remove any remaining GEOMG references
130 changes: 83 additions & 47 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require "rubygems"
require "rails"
require "database_cleaner/active_record"

require "bundler/setup"

Expand All @@ -13,15 +14,12 @@ load "rails/tasks/statistics.rake"

require "bundler/gem_tasks"

require "solr_wrapper"

require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)

require "rubocop/rake_task"
RuboCop::RakeTask.new(:rubocop)

require "solr_wrapper/rake_task"
require "engine_cart/rake_task"
require "geoblacklight_admin/version"
require "rake/testtask"
Expand All @@ -40,66 +38,104 @@ end
task default: :test

desc "Run test suite"
task ci: ["geoblacklight:generate"] do
within_test_app do
require "simple_form"
system "RAILS_ENV=test bin/rails db:migrate"
system "RAILS_ENV=test rake db:seed"
system "RAILS_ENV=test rails webpacker:compile"
task :ci do
# Reset the database if the test app exists
if File.exist? EngineCart.destination
within_test_app do
system "bundle exec rake db:reset"
end
end

# Run RSpec tests with Coverage
Rake::Task["geoblacklight:coverage"].invoke
end
# Start docker
Rake::Task["geoblacklight:admin:docker:start"].invoke

namespace :geoblacklight do
desc "Run tests with coverage"
task :coverage do
ENV["COVERAGE"] = "true"
# Rake::Task["spec"].invoke
Rake::Task["test"].invoke
end
# Create the test rails app
Rake::Task["geoblacklight:admin:generate"].invoke

desc "Create the test rails app"
task generate: ["engine_cart:generate"] do
# Intentionally Empty Block
end
# Run Minitest tests with Coverage
Rake::Task["geoblacklight:admin:coverage"].invoke

namespace :internal do
task seed: ["engine_cart:generate"] do
within_test_app do
system "bundle exec rake db:seed"
system "bundle exec rake geoblacklight:downloads:mkdir"
end
end
end
# Stop docker
Rake::Task["geoblacklight:admin:docker:stop"].invoke
end

desc "Run Solr and seed with sample data"
task :solr do
if File.exist? EngineCart.destination
within_test_app do
system "bundle update"
namespace :geoblacklight do
namespace :admin do
desc "Run GeoBlacklight Admin and Solr with seed data for interactive development"
task :server, [:rails_server_args] do |_t, args|
if File.exist? EngineCart.destination
within_test_app do
system "bundle update"
end
else
Rake::Task["engine_cart:generate"].invoke
end
else
Rake::Task["engine_cart:generate"].invoke
end

SolrWrapper.wrap(port: "8983") do |solr|
solr.with_collection(name: "blacklight-core",
dir: File.join(File.expand_path(".", File.dirname(__FILE__)),
"solr", "conf")) do
Rake::Task["geoblacklight:internal:seed"].invoke
system "docker compose up -d"
Rake::Task["geoblacklight:admin:internal:seed"].invoke

begin
within_test_app do
puts "\nSolr server running: http://localhost:#{solr.port}/solr/#/blacklight-core"
puts "\n^C to stop"
puts "\nSolr server running: http://localhost:8983/solr/#/blacklight-core"
puts "\nPostgreSQL server running: http://localhost:5555"
puts " "
begin
sleep
system "bundle exec rails s #{args[:rails_server_args]}"
rescue Interrupt
puts "Shutting down..."
end
end
ensure
system "docker compose down"
end
end

desc "Run tests with coverage"
task :coverage do
ENV["COVERAGE"] = "true"
Rake::Task["test"].invoke
end

desc "Create the test rails app"
task generate: ["engine_cart:generate"] do
# system "bundle exec rake db:reset"
end

namespace :internal do
task seed: ["engine_cart:generate"] do
within_test_app do
system "Settings.reload!"
system "bundle exec rake db:reset"
system "bundle exec rake db:seed"
system "bundle exec rake geoblacklight:downloads:mkdir"
end
end
end

desc "Run Solr and seed with sample data"
task :solr do
if File.exist? EngineCart.destination
within_test_app do
system "bundle update"
end
else
Rake::Task["engine_cart:generate"].invoke
end
end

namespace :docker do
desc "Start docker and seed with sample data"
task :start do
system "docker compose up -d"
Rake::Task["geoblacklight:admin:internal:seed"].invoke
puts "\nSolr server running: http://localhost:8983/solr/#/blacklight-core"
puts "\nPostgreSQL server running: http://localhost:5555"
puts " "
end

desc "Stop docker"
task :stop do
system "docker compose down"
end
end
end
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/geoblacklight_admin/chosen.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// VanillaJS Ready
// @TODO: Replace with Tom Select
document.addEventListener('DOMContentLoaded', function() {
var elements = document.querySelectorAll('.chosen-select');
Array.prototype.forEach.call(elements, function(el, i){
Expand Down
24 changes: 24 additions & 0 deletions app/assets/stylesheets/geoblacklight_admin/_core.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,34 @@ footer.gbl-admin {
box-shadow: inset 0 0 0 50vw rgba(0, 0, 0, 0.8);
}

main#gbl-admin {
min-height: 75vh;
margin-top: 0rem;
}

main.container-fluid {
margin-top: 5rem;
}

.navbar-brand.gbl-admin {
background: none;
}

kbd {
background-color:aliceblue;
}

a.btn.btn-gbl-admin {
color: black;
border-color: #ffc107;
margin: 1rem 0;

&:visited {
color: black;
background-color: #ffc107;
}
}

div.dropdown-menu.show {
z-index: 2000;
}
5 changes: 0 additions & 5 deletions app/assets/stylesheets/geoblacklight_admin/modules/_nav.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// Keep Document Cancel and Update buttons visible
.admin-header {
top:4rem;
}

// Keep View in Geoportal visible
.make-me-sticky {
top:8rem;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
th.header{
position: sticky;
top: 55px;
top: 0.25rem;
}
Loading

0 comments on commit 2424e4b

Please sign in to comment.