sul-dlss/sul_pub

Name: sul_pub

Owner: Stanford University Digital Library

Description: SUL system for harvest and managing publications for Stanford CAP, with controlled API access.

Created: 2016-05-25 17:58:18.0

Updated: 2018-05-22 04:05:05.0

Pushed: 2018-05-22 23:18:57.0

Homepage: http://cap.stanford.edu

Size: 11273

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Build Status | Coverage Status | Dependency Status

SUL Bibliographic Management System

SUL Bibliographic Management System by Stanford University Libraries.

Configuration

Configurations are currently being managed in multiple ways. The goal is to consolidate the approach. New configurations should be added in settings.yml. Never check in private settings. This project uses the config gem for managing settings. Private settings can be added locally in a *.local.yml file. See Developer specific config files.

Legacy configuration files to review are:

Developer Setup

This is a ruby on rails application with an rspec test suite. The ruby version currently used could be any version used in the .travis.yml configuration file (preferably the latest stable version). The application gems are managed by bundler, so the gem versions are all defined in the Gemfile (and Gemfile.lock).

Code Conventions

The conventions to follow are noted in the DLSS developer playbook. The code style conventions are checked by rubocop, using the DLSS cops.

Initial Setup
clone git@github.com:sul-dlss/sul_pub.git
ul_pub
le install
Database Setup

The application uses MySQL. Install MySQL, review config/database.yml, and run some rake tasks to confirm everything is working, e.g.:

le exec rake db:create
le exec rake db:migrate
Running the Test Suite

The test suite uses the VCR gem to manage HTTP request and response data. The configuration for VCR does not and should not allow new HTTP requests that are not managed by VCR. When any new specs require retrieval of data from subscription services, the private configuration files must be used (see below). Otherwise, the existing VCR cassettes should suffice.

To run the test suite:

 necessary, use private configuration files.
le exec rake ci

To run specific tests, use rspec directly, e.g.

n only the publications_api_spec:
S_ENV=test bundle exec rspec spec/api/publications_api_spec.rb
n only a subset of the publications_api_spec:
S_ENV=test bundle exec rspec spec/api/publications_api_spec.rb:157
Running integration tests

This repository also uses the RSpec tag data-integration to define tests that are reliant on external APIs. When creating data-integration specs, make sure to add the RSpec tag 'data-integration': true.

To run the data-integration tests, make sure that your private credentials are appropriately configured. There is a convenient rake task to use for running the specs:

le exec rake spec:data-integration
Private Configuration Files

There are private configuration data for this application, manged in a private github repository. These configuration files contain private credentials for access to subscription resources and for client access to the application API.

Updating the VCR Cassettes Using Private Configuration Files

First, follow the instructions above for using private configuration files. Then run the test suite and commit any changes to the VCR cassettes.

e commands above for using private configuration files.
rf fixtures/vcr_cassettes/*
le exec rake ci
add fixtures/vcr_cassettes/
commit -m "Update VCR cassettes"
reset --hard  # cleanup the private configuration files
Deployment

The application is deployed using capistrano (see cap -T for a list of available tasks). A developer can deploy the application when they have Kerberos authentication enabled for the remote user@host definition of the deployment target. The config/deploy path in the private configuration files (see above) contains all the deployment target definitions, see:

To update shared configs on the server, use:
le exec cap [ENVIRONMENT] shared_configs:update

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.