Skip to content

Commit

Permalink
update gems and workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
niquerio committed Aug 22, 2023
1 parent 137985d commit a8ecc3e
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 62 deletions.
25 changes: 25 additions & 0 deletions .github/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
#!/bin/sh

set -e
rubyfiles=$(git diff --cached --name-only --diff-filter=ACM "*.rb" "Gemfile" | tr '\n' ' ')
[ -z "$rubyfiles" ] && exit 0

# Standardize all ruby files
echo "🧹 Formatting staged Ruby files using standardrb ($(echo $rubyfiles | wc -w | awk '{print $1}') total)"
echo "$rubyfiles" | xargs docker-compose run --rm web bundle exec standardrb --fix

# Add back the modified/prettified files to staging
echo "$rubyfiles" | xargs git add

echo "📋 Running tests with rspec"
docker-compose run --rm web bundle exec rspec --format progress

exit 0
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Create .env file
run: cat .env-example .env-dev-values > .env
run: cat env.* > .env
- name: Load .env file
uses: xom9ikk/dotenv@v2
- name: Set up Ruby 3.2
Expand Down
51 changes: 27 additions & 24 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.4)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
anyway_config (2.4.2)
anyway_config (2.5.1)
ruby-next-core (>= 0.14.0)
ast (2.4.2)
base64 (0.1.1)
byebug (11.1.3)
climate_control (1.2.0)
coderay (1.1.3)
Expand Down Expand Up @@ -36,28 +37,28 @@ GEM
parser (3.2.2.3)
ast (~> 2.4.1)
racc
prometheus-client (2.1.0)
prometheus-client (4.2.1)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (>= 0.13, < 0.15)
public_suffix (5.0.3)
puma (6.3.0)
puma (6.3.1)
nio4r (~> 2.0)
racc (1.7.1)
rack (2.2.7)
rack-protection (3.0.6)
rack
rack (2.2.8)
rack-protection (3.1.0)
rack (~> 2.2, >= 2.2.4)
rack-test (2.1.0)
rack (>= 1.3)
rainbow (3.1.1)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
regexp_parser (2.8.1)
rexml (3.2.5)
rexml (3.2.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
Expand All @@ -71,19 +72,21 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
rubocop (1.52.1)
rubocop (1.56.1)
base64 (~> 0.1.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.3)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.0, < 2.0)
rubocop-ast (>= 1.28.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-performance (1.18.0)
rubocop-performance (1.19.0)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
ruby-next-core (0.15.3)
Expand All @@ -95,41 +98,41 @@ GEM
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
sinatra (3.0.6)
sinatra (3.1.0)
mustermann (~> 3.0)
rack (~> 2.2, >= 2.2.4)
rack-protection (= 3.0.6)
rack-protection (= 3.1.0)
tilt (~> 2.0)
sinatra-contrib (3.0.6)
sinatra-contrib (3.1.0)
multi_json
mustermann (~> 3.0)
rack-protection (= 3.0.6)
sinatra (= 3.0.6)
rack-protection (= 3.1.0)
sinatra (= 3.1.0)
tilt (~> 2.0)
standard (1.30.1)
standard (1.31.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.52.0)
rubocop (~> 1.56.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.1.0)
standard-performance (~> 1.2)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.1.1)
standard-performance (1.2.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.18.0)
rubocop-performance (~> 1.19.0)
tilt (2.2.0)
unicode-display_width (2.4.2)
webmock (3.18.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
yabeda (0.11.0)
yabeda (0.12.0)
anyway_config (>= 1.0, < 3)
concurrent-ruby
dry-initializer
yabeda-prometheus (0.8.0)
prometheus-client (>= 0.10, < 3.0)
yabeda-prometheus (0.9.0)
prometheus-client (>= 3.0, < 5.0)
rack
yabeda (~> 0.10)
yabeda-puma-plugin (0.7.1)
Expand Down
41 changes: 7 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,17 @@ Connect to the U-M Library VPN

![Screen Shot 2021-11-18 at 2 44 56 PM](https://user-images.githubusercontent.com/27687379/142486728-5fe21b80-b02c-4e89-a2ef-e74440e99bfa.png)

Copy the environment file example
```
cp -r .env-example .env
```

Get the actual values from a developer, and update the `.env` file.
```
BIBLIO_SOLR='http://biblio-server'
CATALOG_SOLR='http://catalog-solr-server'
CALLNUMBERS_CORE='callnumbers'
AUTHORS_CORE='authors'
AUTHOR_ON='true'
SUBJECT_ON='true'
run the `init.sh` script.
```bash
./init.sh
```

Build the image
```
docker-compose build
```
edit .env with the appropriate environment variables

Install the gems
```
docker-compose run --rm web bundle install
```
start containers

Install the npm packages
```
docker-compose run --rm web npm install
```

Start the app
```
docker-compose up
```

Build the styles
```
docker-compose run --rm web npm run build
```bash
docker-compose up -d
```

Run the tests
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
- SHELL=/bin/bash
env_file:
- .env
- .env-dev-values
- env.development

volumes:
gem_cache:
File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

#must be run from the project root directory
if [ -f ".env" ]; then
echo "🌎 .env exists. Leaving alone"
else
echo "🌎 .env does not exist. Copying env.example to .env"
cp env.example .env
fi

if [ -f ".git/hooks/pre-commit" ]; then
echo "🪝 .git/hooks/pre-commit exists. Leaving alone"
else
echo " 🪝 .git/hooks/pre-commit does not exist. Copying .github/pre-commit to .git/hooks/"
cp .github/pre-commit .git/hooks/pre-commit
fi

echo "🚢 Build docker images"
docker-compose build

echo "📦 Installing Gems"
docker-compose run --rm web bundle

echo "📦 Installing Node modules"
docker-compose run --rm web npm install

echo "📦 Building js and css"
docker-compose run --rm web npm run build
4 changes: 2 additions & 2 deletions lib/catalog_solr_client.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "faraday"
require_relative "./catalog_solr_client/configuration"
require_relative "./catalog_solr_client/client"
require_relative "catalog_solr_client/configuration"
require_relative "catalog_solr_client/client"

module CatalogSolrClient
class << self
Expand Down

0 comments on commit a8ecc3e

Please sign in to comment.