Versions:
- Ruby: 3.1.0
- Rails: 7.1
- Blacklight: 7.38.0
-
In order to run locally, you must have Lando installed for your system - see https://docs.lando.dev/getting-started/installation.html.
-
If you don't have
yarn
installed you can install it withnpm install -g yarn
-
You may need to install the bundler referenced in the Gemfile.lock, e.g.
gem install bundler:2.3.26
To install run
bundle install
yarn install
On macOS: If the command yarn install
gives error "No Xcode or CLT version detected" try re-installing xCode tools.
All commands are assumed to be run from your local orangelight directory
-
Start all the servers/set up database/seed index (this uses Lando to bring up the postgres database, and both the development and test Solr instances)
bundle exec rake servers:start
*Note: You can stop everything with
rake servers:stop
-
Run a rails server
bundle exec rails s
This will continue running until you Ctrl C, you will need a new tab or window for the next step
Default branch for deployment is main
. You can specify a branch using the BRANCH environment variable.
BRANCH=my_branch bundle exec cap staging deploy # deploys my_branch to staging
bundle exec cap staging deploy # deploys main branch to staging
To see mail that has been sent on the staging server you must ssh tunnel into the server
ssh -L 1082:localhost:1080 pulsys@catalog-staging1
To see mail that has been sent on the qa server you must ssh tunnel into the server
ssh -L 1082:localhost:1080 pulsys@catalog-qa1
Once the tunnel is open you can see the mail that has been sent on staging here
-
Start all the servers/set up database/seed index
bundle exec rake servers:start
*Note: You can stop everything with
rake servers:stop
-
initialize the browse lists see instructions
-
Run the all the tests
bundle exec rake spec
-
To run just the rspec tests
bundle exec rspec spec
-
To run just the javascript tests
yarn test
- Run steps one and two above
- run the individual test
bundle exec rake spec SPEC=path/to/your_spec.rb:linenumber
RUN_IN_BROWSER=true bundle exec rspec spec/system
The browser will only display for system specs with js: true
.
$ yarn install
$ yarn test
- Place a
debugger;
line in your javascript - Open up Chrome and type in the address bar: chrome://inspect
- Click on "Open dedicated DevTools for Node"
- Back in terminal run
yarn test:debug [path_to_test]
(This has been added to package.json)
- erblint
bundle exec erblint --lint-all
bundle exec rubocop
bundle exec reek app
yarn stylelint "**/*.scss"
This command runs a rails server, so you will need to stop any rails server that is already running locally before running the commands below.
bundle exec rake servers:start # if you have not yet started the servers
npm install -g @lhci/cli@0.14.x
lhci autorun
You can safely ignore the message "GitHub token is not set" -- this is for an integration that we don't currently use.
It will tell you if you've passed the assertion(s) specified
in lighthouserc.js
. It will also give you a URL where you
can see the complete lighthouse results.
If you get a CodeQL warning on your branch, you may wish to run CodeQL locally to learn more about the issue.
brew install codeql
codeql database create orangelight-codeql --language=ruby # creates a gitignored folder for codeql to do its work
codeql database analyze orangelight-codeql --format=csv --output=codeql_results.csv --download codeql/ruby-queries
Your results will then be available in the file codeql_results.csv.
RAILS_ENV=test bundle exec rake browse:all
RAILS_ENV=test bundle exec rake browse:load_all
bundle exec rake pulsearch:solr:deindex
bundle exec rake pulsearch:solr:index
Use an example.xml marc record. Start bibdata in the dev environment. Use the bibdata solr url from lando and run:
bundle exec traject -c marc_to_solr/lib/traject_config.rb path-to-xml/example.xml -u http://localhost:<solr-port-number>/solr/name-of-local-solr-index -w Traject::JsonWriter
This will print a JSON. Copy the JSON and add it to the bottom of spec/fixtures/current_fixtures.json
. Note that file
contains a list so you have to make sure you add a comma to the end of the last
record and keep the closing bracket at the end of the file. Then run rake pulsearch:solr:index
for both the dev and the test environment, as specified above.
Run the following command to update pull in Solr configuration updates from the pul_solr repo:
bundle exec rake pulsearch:solr:update
Orangelight is configured to use two environment variables in order to query and retrieve IIIF Manifests for resources linked to catalog records in the Figgy digital object repository. By default, these are provided with the following values:
GRAPHQL_API_URL=https://figgy.princeton.edu/graphql
FIGGY_URL=https://figgy.princeton.edu
This will ensure that Orangelight will search for linked resources in the production environment. To test against linked resources in the staging environment, please use the following invocation when starting the Rails server:
GRAPHQL_API_URL=https://figgy-staging.princeton.edu/graphql FIGGY_URL=https://figgy-staging.princeton.edu bundle exec rails s
To start up a copy of the project with a solr index of fixture data
bundle exec rake servers:start
Then, in another terminal window build browse index csv files in /tmp:
RAILS_ENV=development bundle exec rake browse:all
Then, load browse data into the development database:
RAILS_ENV=development bundle exec rake browse:load_all
For more information, see requests dev hints.
You will need a working local copy of Bibdata.
Start the Bibdata server, and then set the bidata_base
value in OrangeLight's config/requests.yml
file to the local URL where Bibdata is running (e.g., http://localhost:{port}
) or use the BIBDATA_BASE
environment variable.
-
run mail catcher run once
gem install mailcatcher
run every time
mailcatcher
- If you don't have access to this private repo, speak to others on the team about getting access
- Click "Raw". This should give you a url that looks something like
https://raw.githubusercontent.com/PrincetonUniversityLibrary/ezproxy_conf/main/shim/hosts.dat?token=MY_LONG_TOKEN
- Copy the url, and set it to a variable on the command line
MY_URL=the url you copied above
- Copy the latest version of the remote file to the local file
curl $MY_URL -o config/hosts.dat
- Optionally, alphabetize the file using your local editor
- To see the current announcement message and feature status, run
bundle exec rake announcement:show
- To set a new announcement message, run
bundle exec rake announcement:set\["My message in a string. Must escape quotes."\]
- To toggle announcements on and off, sign in and go to /features and toggle message display.
Changes need to be made in 'simple-git-hooks':
- Make the change in package.json
"simple-git-hooks": {
"pre-commit": "yarn lint-staged"
},
"lint-staged": {
"*.js": [
"prettier --write",
"eslint"
]
}
- Run
yarn simple-git-hooks
to reconfigure the settings.